OKX Portfolio
Inspect OKX account state on Zo, including balances, positions, PnL, bills, fees, and selected account operations.
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
- Terminal for
okx account ...commands - Settings > Advanced for storing OKX credentials as Zo secrets
Credential Model
Zo secrets are the source of truth for:
OKX_API_KEYOKX_SECRET_KEYOKX_PASSPHRASE
If local OKX config is needed, generate it from those secrets on the Zo machine instead of asking the user to paste credentials into chat.
Prerequisites
- Install the CLI:
npm install -g @okx_ai/okx-trade-cli
Ensure OKX secrets exist in Settings > Advanced.
Generate local config from Zo secrets if required by the CLI flow:
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
- Verify configuration status:
okx config show
Profile Rule
Authenticated commands must always use an explicit profile:
demolive
If the user has not specified a profile and none is clearly established in the conversation, ask before proceeding.
Common Commands
okx --profile demo account balance
okx --profile demo account positions
okx --profile demo account positions-history
okx --profile demo account bills
okx --profile demo account fees --instType SPOT
okx --profile demo account config
Workflow
- Verify the CLI is available.
- Verify credentials are configured and masked correctly.
- Confirm the profile.
- Run the smallest account command that answers the user’s question.
- Summarize the output in chat and append the active profile.
Failure Handling
- If credentials are missing or invalid, stop and direct the user to Settings > Advanced.
- If config generation fails, do not proceed with authenticated account calls.
- If the profile is unclear, ask before continuing.
Output Rules
- Prefer concise portfolio summaries over raw output dumps.
- Mention whether the result came from
demoorlive. - Disclose scope when the result is partial, for example one currency or one position set.
Safety Notes
- Read-only portfolio queries do not require extra confirmation.
- If the action becomes a write action such as a transfer or account-setting change, confirm profile and intent first.
Related Skills
okx-cex-marketokx-cex-trade