Zo okx cex trade

From zocomputer/skills · View interactive version

Zo okx cex trade is an AI agent skill from the GitHub repository zocomputer/skills. Execute and manage OKX spot, perpetual, futures, and supported options trades on Zo. Use when the user wants to place, cancel, amend, or inspect tradable orders, but require explicit same-thread confirmation before any live execution.

How to use this skill

Skill file

OKX Trade

Execute OKX trades on Zo with a strict quote, validate, confirm, execute flow.

Preflight

Before running any OKX command in this session, follow ../_shared/preflight.md.

Use metadata.version from this file as the comparison version for drift checks.

What Zo Uses

Credential Model

Zo secrets are the source of truth for:

Generate local OKX config from those secrets if the CLI requires it. Do not ask the user to paste credentials into chat.

If the CLI needs a local config file, generate it from Zo secrets:

mkdir -p /root/.okx
cat > /root/.okx/config.toml <<EOF
default_profile = "demo"

[profiles.demo]
api_key = "${OKX_API_KEY}"
secret_key = "${OKX_SECRET_KEY}"
passphrase = "${OKX_PASSPHRASE}"
demo = true

[profiles.live]
api_key = "${OKX_API_KEY}"
secret_key = "${OKX_SECRET_KEY}"
passphrase = "${OKX_PASSPHRASE}"
EOF

Non-Negotiable Safety Rules

Profiles

If the user has not clearly specified one, ask.

Required Execution Pattern

1. Quote / Validate

Before any write action:

2. Confirm

Require explicit confirmation in the current conversation before executing any live write action.

For demo writes, still confirm if the order details are ambiguous.

3. Execute

Only after confirmation, run the specific command.

Common Command Shapes

Spot

okx --profile demo spot place --instId BTC-USDT --side buy --ordType market --sz 0.01
okx --profile demo spot cancel --instId BTC-USDT --ordId <ordId>
okx --profile demo spot amend --instId BTC-USDT --ordId <ordId> --newPx 100000

Perpetual / Futures

okx --profile demo swap place --instId BTC-USDT-SWAP --side buy --ordType market --sz 1 --tdMode cross --posSide long
okx --profile demo swap close --instId BTC-USDT-SWAP --mgnMode cross --posSide long
okx --profile demo swap leverage --instId BTC-USDT-SWAP --lever 10 --mgnMode cross

Algo / TP / SL

okx --profile demo swap algo trail --instId BTC-USDT-SWAP --side sell --sz 1 --tdMode cross --posSide long --callbackRatio 0.02

Reference Files

Load the matching reference file before running anything beyond the simplest spot or swap flow:

Derivatives Validation Rule

Before placing SWAP, FUTURES, or OPTION orders, retrieve instrument details and validate contract face value. Do not assume contract sizing.

Examples:

okx market instruments --instType SWAP --instId BTC-USDT-SWAP
okx market instruments --instType FUTURES --instId BTC-USDT-250328
okx market instruments --instType OPTION --instId BTC-USD-250328-95000-C

Use the validated contract value to explain:

Failure Handling

Output Rules

Scope Limits

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.