okx-account
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOKX Account (Read-Only)
OKX 账户(只读)
Read-only OKX account tracker built on the official library.
Use it for account tracking, daily/weekly reports, risk alerts, and cashflow attribution.
python-okx基于官方库构建的只读OKX账户追踪工具。
可用于账户追踪、日/周度报告、风险预警以及现金流归因分析。
python-okxHow to Get an OKX API Key (Read-Only)
如何获取只读OKX API密钥
- Sign in at okx.com, top-right avatar → API
- Direct link: https://www.okx.com/account/my-api
- Create V5 API Key → complete 2FA verification
- Fill the form:
- API name: anything
- Passphrase: ⚠️ a brand-new password used to sign API requests, NOT your login password. Lose it and you can only delete the key and create a new one.
- Permissions: tick Read only, leave Trade / Withdraw off
- IP whitelist: leave empty
- Submit → immediately copy and save all three values: /
API Key/Secret Key(Secret is shown only once)Passphrase - Set them into this skill's environment variables
Reference: OKX official tutorial
Prerequisites
前置条件
1) API key
1) API密钥
In OKX API Management create a key with Read only. OKX requires three credentials: / / (the password you set when creating the key — not the login password).
api_keysecretpassphrase在OKX API管理页面创建一个只读权限的密钥。OKX需要三项凭证: / / (创建密钥时设置的密码,而非登录密码)。
api_keysecretpassphrase2) Environment variables
2) 环境变量
OKX_RO_API_KEY=...
OKX_RO_SECRET=...
OKX_RO_PASSPHRASE=...OKX_RO_API_KEY=...
OKX_RO_SECRET=...
OKX_RO_PASSPHRASE=...3) Geo restriction (required)
3) 地域限制(必填)
OKX geo-blocks server IPs. Scripts default to the SC internal HK proxy:
python
HK_PROXY = "http://hk:x@sc-vpn.internal:8080"Do not set a global .
HTTP_PROXYOKX对服务器IP有地域限制。脚本默认使用SC内部香港代理:
python
HK_PROXY = "http://hk:x@sc-vpn.internal:8080"请勿设置全局。
HTTP_PROXYScripts
脚本使用
bash
python3 skills/okx-account/scripts/okx_account.py <action> [options]
python3 skills/okx-account/scripts/account_scenarios.py <scenario> [options]bash
python3 skills/okx-account/scripts/okx_account.py <action> [options]
python3 skills/okx-account/scripts/account_scenarios.py <scenario> [options]Actions
操作指令
- : one-shot summary
summary - /
account_balance/account_config/positions/position_risk/fee_ratesbills - /
open_orders/order_historyfills_history - /
funding_balance/deposits/withdrawals/currenciesfunding_rate
- : 一键生成账户汇总信息
summary - /
account_balance/account_config/positions/position_risk/fee_rates(账户余额/账户配置/仓位/仓位风险/手续费率/账单)bills - /
open_orders/order_history(未成交订单/订单历史/成交历史)fills_history - /
funding_balance/deposits/withdrawals/currencies(资金余额/充值记录/提现记录/支持币种/资金费率)funding_rate
Scenarios
场景功能
- : full account snapshot
portfolio_snapshot - : perpetual risk monitoring (margin ratio + unrealized loss thresholds)
perp_risk - : deposits + withdrawals + 7d bills aggregation
cashflow - : recent fills activity by instType
trading_activity
- : 完整账户快照
portfolio_snapshot - : 永续合约风险监控(保证金比例+未实现亏损阈值)
perp_risk - : 充值+提现+7天账单汇总
cashflow - : 按产品类型统计近期成交活动
trading_activity
Common usage
常用示例
bash
python3 skills/okx-account/scripts/okx_account.py summary
python3 skills/okx-account/scripts/account_scenarios.py portfolio_snapshot
python3 skills/okx-account/scripts/account_scenarios.py perp_risk --loss-threshold 5000
python3 skills/okx-account/scripts/account_scenarios.py cashflow --limit 100
python3 skills/okx-account/scripts/account_scenarios.py trading_activity --inst-types SPOT,SWAPbash
python3 skills/okx-account/scripts/okx_account.py summary
python3 skills/okx-account/scripts/account_scenarios.py portfolio_snapshot
python3 skills/okx-account/scripts/account_scenarios.py perp_risk --loss-threshold 5000
python3 skills/okx-account/scripts/account_scenarios.py cashflow --limit 100
python3 skills/okx-account/scripts/account_scenarios.py trading_activity --inst-types SPOT,SWAPNotes
注意事项
- The is easy to forget — it is the password you set when creating the key, not your login password.
passphrase - If you bound an IP whitelist when creating the key, either disable it or add the proxy egress IP.
- Use time-windowed pagination for high-volume fills.
- 容易遗忘,它是创建密钥时设置的密码,而非登录密码。
passphrase - 如果创建密钥时绑定了IP白名单,请关闭该设置或添加代理出口IP。
- 对于大量成交记录,请使用时间窗口分页查询。