{"id":"8a7511ea-28a0-4ac8-a40b-027ce4fcea20","entityType":"agent","slug":"clawhub-blave-wei-blave-quant-skill","name":"Skill Trim","canonicalUrl":"https://www.xpersona.co/agent/clawhub-blave-wei-blave-quant-skill","canonicalPath":"/agent/clawhub-blave-wei-blave-quant-skill","generatedAt":"2026-10-09T15:26:44.626Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":null},"description":"Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io. Skill: Skill Trim Owner: blave-wei Summary: Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io. Tags: latest:1.23.20 Version history: v1.23.20 | 2026-10-08T07:23:56.861Z | use","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 3.5K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s177d3gec876fq6yd96yxsjfhd841bk3:blave-quant-skill","sourceUrl":"https://clawhub.ai/blave-wei/blave-quant-skill","homepage":"https://clawhub.ai/blave-wei/skills/blave-quant-skill","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/blave-wei/blave-quant-skill","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/blave-wei/skills/blave-quant-skill","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":50,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":null},"stars":null,"forks":null,"downloads":3509,"packageName":null,"latestVersion":"1.23.20","tractionLabel":"3.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T07:48:41.363Z","lastCrawledAt":"2026-10-09T07:48:41.363Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T07:48:41.363Z","lastVerifiedAt":null,"highlights":[{"version":"1.23.20","createdAt":"2026-10-08T07:23:56.861Z","changelog":"SKILL.md description 精簡（每回合 context 省約 4,400 字元）、blave-api.md 加端點索引讓 agent 分段讀","fileCount":40,"zipByteSize":186517},{"version":"1.23.19","createdAt":"2026-10-08T04:33:28.669Z","changelog":"Add Taiwan futures institutional carrying cost (foreign/investment trust/dealer, TAIFEX-derived, from 2023-10-18) and CME BTC/ETH futures COT (CFTC weekly, coin-unit combined) endpoints; indicator guide: leveraged-fund net short ≠ bearish (CFTC TFF)","fileCount":40,"zipByteSize":185476},{"version":"1.23.17","createdAt":"2026-10-07T02:50:39.847Z","changelog":"台指期與個股期貨連續合約換月規則：結算日整天到期月、15:00 夜盤起次月","fileCount":40,"zipByteSize":177771},{"version":"1.23.16","createdAt":"2026-10-06T10:09:40.880Z","changelog":"全市場三大法人:外資自營商不再重複算進自營商,外資＋投信＋自營商＝合計","fileCount":40,"zipByteSize":177456},{"version":"1.23.15","createdAt":"2026-10-03T07:16:10.155Z","changelog":"/kline: coverage (all Binance USDT perps incl. TradFi), full 1-minute history from 2020-01, freshness, 400 for uncovered symbols","fileCount":40,"zipByteSize":177569},{"version":"1.23.11","createdAt":"2026-10-02T09:05:32.128Z","changelog":"Add GET /oi_imbalance/get_history: per-exchange open interest history (one-sided, in coins, 5-min; Binance from 2021-12-01, Bybit 2025-08-21, Gate.io 2026-03-28)","fileCount":40,"zipByteSize":175429},{"version":"1.23.9","createdAt":"2026-09-26T08:35:39.015Z","changelog":"Raw cross-exchange data docs (long/short ratio, open interest, CVD, liquidation exchange matrix); repositioned as quant infrastructure for AI agents; removed TradingView stream (endpoint retired); marketplace template drops MODE line","fileCount":40,"zipByteSize":173712},{"version":"1.23.8","createdAt":"2026-09-20T17:25:42.209Z","changelog":"Add GET /liquidation/get_coin (per-coin liquidation snapshot: rolling 1/4/12/24h windows, per-exchange split, 24 clock-hour series, live example). funding_rate/get_alpha now takes exchange (binance/okx/bingx/bybit) and returns 400 outside the list.","fileCount":41,"zipByteSize":166043}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s177d3gec876fq6yd96yxsjfhd841bk3:blave-quant-skill","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T15:26:44.622Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-blave-wei-blave-quant-skill/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":null},"readme":"Skill: Skill Trim\n\nOwner: blave-wei\n\nSummary: Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io.\n\nTags: latest:1.23.20\n\nVersion history:\n\nv1.23.20 | 2026-10-08T07:23:56.861Z | user\n\nSKILL.md description 精簡（每回合 context 省約 4,400 字元）、blave-api.md 加端點索引讓 agent 分段讀\n\nv1.23.19 | 2026-10-08T04:33:28.669Z | user\n\nAdd Taiwan futures institutional carrying cost (foreign/investment trust/dealer, TAIFEX-derived, from 2023-10-18) and CME BTC/ETH futures COT (CFTC weekly, coin-unit combined) endpoints; indicator guide: leveraged-fund net short ≠ bearish (CFTC TFF)\n\nv1.23.17 | 2026-10-07T02:50:39.847Z | user\n\n台指期與個股期貨連續合約換月規則：結算日整天到期月、15:00 夜盤起次月\n\nv1.23.16 | 2026-10-06T10:09:40.880Z | user\n\n全市場三大法人:外資自營商不再重複算進自營商,外資＋投信＋自營商＝合計\n\nv1.23.15 | 2026-10-03T07:16:10.155Z | user\n\n/kline: coverage (all Binance USDT perps incl. TradFi), full 1-minute history from 2020-01, freshness, 400 for uncovered symbols\n\nv1.23.11 | 2026-10-02T09:05:32.128Z | user\n\nAdd GET /oi_imbalance/get_history: per-exchange open interest history (one-sided, in coins, 5-min; Binance from 2021-12-01, Bybit 2025-08-21, Gate.io 2026-03-28)\n\nv1.23.9 | 2026-09-26T08:35:39.015Z | user\n\nRaw cross-exchange data docs (long/short ratio, open interest, CVD, liquidation exchange matrix); repositioned as quant infrastructure for AI agents; removed TradingView stream (endpoint retired); marketplace template drops MODE line\n\nv1.23.8 | 2026-09-20T17:25:42.209Z | user\n\nAdd GET /liquidation/get_coin (per-coin liquidation snapshot: rolling 1/4/12/24h windows, per-exchange split, 24 clock-hour series, live example). funding_rate/get_alpha now takes exchange (binance/okx/bingx/bybit) and returns 400 outside the list.\n\nv1.23.6 | 2026-09-18T08:38:52.869Z | user\n\n三大法人:全市場與個股兩層的外資自營商併法不同,兩節各自標明層級;並點出 foreign + investment_trust + dealer ≠ total(差額是當日外資自營商,全部在權證、2024-08-16 後恆為 0),要對官方數字直接讀 total\n\nv1.23.5 | 2026-09-18T05:40:26.736Z | user\n\n台股市值排行補 market(上市/上櫃)、is_etf 旗標與 twse_ex_etf_market_value(上市除 ETF 的佔比分母);移除用 00 代號前綴判斷 ETF 的舊建議\n\nv1.23.4 | 2026-09-16T17:12:03.863Z | user\n\n融資融券 margin_limit 範例值改正:2,922,341 是 2001 年那一列的值,正確為 6,483,092;單位「張」由量級推導升級為已對 TWSE MI_MARGN 驗證\n\nv1.23.3 | 2026-09-16T07:45:49.446Z | user\n\nAPI 文件用唯讀實抓補完 49 處待確認(Data from 一律用首個非零日期,避開補 0 的假起點);頂尖交易員曝險與市場方向改正為全市場單一序列,不是 BTC 專屬;曝險是原始比率非 z-score\n\nv1.23.2 | 2026-09-15T02:46:06.905Z | user\n\nMarketplace reference: public listings and approvals accept category Crypto or TW Stock only (private uploads unrestricted).\n\nv1.23.1 | 2026-09-14T06:49:26.377Z | user\n\n台股分點端點:標明資料起始 2021-06-30、當日資料約台灣 21:30 後才有;補 start/end 區間查詢(最多 366 天,超過 400);503 代表暫不可用需重試\n\nv1.22.3 | 2026-09-02T08:27:40.718Z | user\n\ntwstock kbar endpoint marked legacy (same on-disk minute store as minute/ohlcv, no upstream call); coverage follows minute/ohlcv/symbols, unknown id -> 400; today's bars provisional until 16:10 Taipei; prefer minute/ohlcv/<id>/1m\n\nv1.22.2 | 2026-08-24T11:44:52.677Z | user\n\nkline docs: sub-5min (1min-4min) history now reaches each symbol's listing date; 45-day lookback cap removed, pre-listing windows return an empty list\n\nv1.22.1 | 2026-08-21T02:31:36.084Z | user\n\nAdd Taiwan stock whole-market market-cap ranking endpoint GET /studio/market/twstock/market_value/all (top-N heavyweight stocks / stock pool in one call)\n\nv1.22.0 | 2026-08-13T18:41:35.851Z | user\n\nAdd Taiwan stock dividend events (single/batch) and TAIEX daily index dividend points endpoints\n\nv1.21.0 | 2026-08-10T09:23:51.959Z | user\n\n台股 batch 加 price(日K OHLCV 含 High/Low)與 per(PER/PBR/殖利率)兩型;failed 契約說明;多股篩選一律 batch\n\nv1.20.0 | 2026-08-06T11:01:36.606Z | user\n\nAdd Taiwan stock minute-line OHLCV endpoints (1m-1d schemas, 2019-01 history, demand-driven coverage, adjust=1 dividend-adjusted mode)\n\nv1.15.0 | 2026-07-14T04:56:45.735Z | user\n\nAdd Gate.io spot + USDT perpetual futures trading with broker attribution (X-Gate-Channel-Id)\n\nv1.14.0 | 2026-07-06T09:52:00.382Z | user\n\nAdd ohlcv/symbols discovery endpoint for intraday coverage\n\nv1.13.0 | 2026-07-06T09:23:24.786Z | user\n\nAdd stock futures (股票期貨) batch daily OHLCV endpoint + intraday coverage notes on existing daily/ohlcv endpoints\n\nv1.12.0 | 2026-07-05T10:51:13.293Z | user\n\nAdd Unusual Movement to Enterprise API\n\nv1.11.0 | 2026-07-03T09:12:42.534Z | user\n\nAdd real-time Taiwan stock quote (taiwan_stock_tick_snapshot): single-stock, batch (max 50), and full-market snapshot endpoints under studio/market/twstock/quote\n\nv1.10.0 | 2026-06-17T15:09:29.046Z | user\n\nAdd funding_rate/get_alpha endpoint (Binance funding rate history; alpha + close + stat)\n\nv1.9.2 | 2026-06-17T03:43:27.753Z | user\n\nCorrect Taiwan futures start dates: TXF OHLCV (1d 2013-12-30 / intraday 2014-01-02), futures/option large traders 2007-01-02, futures daily 1998-07-21\n\nv1.9.1 | 2026-06-15T03:08:17.504Z | user\n\nFix bid/ask volume start date to 2018-02-22 (backfilled history)\n\nv1.9.0 | 2026-06-15T03:02:56.379Z | user\n\nAdd Taiwan option put/call ratio (PCR) endpoint (GET /studio/market/twfutures/option/pcr)\n\nv1.6.11 | 2026-04-27T08:15:45.218Z | user\n\nfix HC backtest: don't force-close last open trade at end of data\n\nv1.6.10 | 2026-04-27T07:52:49.693Z | user\n\nfix KD backtest: don't force-close last open trade at end of data\n\nv1.6.9 | 2026-04-25T04:18:29.076Z | user\n\nupdate liquidation map example descriptions\n\nv1.6.8 | 2026-04-25T04:12:57.784Z | user\n\nadd liquidation map example: heatmap + recent events chart (爆倉地圖)\n\nv1.6.7 | 2026-04-25T03:34:17.335Z | user\n\nadd Liquidation endpoints: get_alpha (爆倉指標), get_symbols, get_map, get_map_change\n\nv1.6.6 | 2026-04-25T02:12:12.911Z | user\n\nadd MCPT+OOS validation example (KD vs Taker Intensity on DOGE): IS/OOS split, plateau param selection, MCPT with return permutation\n\nv1.6.5 | 2026-04-24T18:59:38.870Z | user\n\nFix Hyperliquid copy-trading: Sharpe now annualizes by actual timestamp spacing (was using hardcoded sqrt(365), overstated Sharpe by ~69%); add PnL + drawdown chart for top traders.\n\nv1.6.4 | 2026-04-24T17:49:01.406Z | user\n\nAdd KD stochastic backtest example (BTC 1h): golden/death cross, dynamic trailing-365-day date range, 2D param scan, plateau selection, regime analysis, PnL + KD charts.\n\nv1.6.3 | 2026-04-23T22:49:14.721Z | user\n\nSurface Safety Mode (CONFIRM before every trade/cancel/transfer) at SKILL.md top and in description — was already enforced per-exchange; now visible to reviewers and users without drilling into references.\n\nv1.6.2 | 2026-04-23T13:58:16.362Z | user\n\nAdd Binance broker ID (Blave): spot orders prefix newClientOrderId with x-GBN6HWR2, USDS-M futures with x-52DDFAFN\n\nv1.6.1 | 2026-04-18T03:59:44.885Z | user\n\nadd Bitfinex auto-lending example (rate-adaptive ladder strategy)\n\nv1.6.0 | 2026-04-17T09:29:41.940Z | user\n\nadd Bitfinex spot, margin & funding/lending integration\n\nv1.5.3 | 2026-04-17T03:27:09.816Z | user\n\nrewrite Trump monitor: RSS via trumpstruth.org, drop curl_cffi dependency\n\nv1.5.2 | 2026-04-16T07:18:06.112Z | user\n\nadd BTC ETF flow monitor example (Farside full history)\n\nv1.5.1 | 2026-04-16T05:55:56.165Z | user\n\nadd Truth Social Trump post monitor example\n\nv1.5.0 | 2026-04-13T07:52:48.547Z | auto\n\nblave-quant-skill 1.5.0\n\n- Added exchange reference documentation files for Binance, BingX, Bitget, BitMart (futures & spot), Bybit, and OKX.\n- Updated SKILL.md and clawhub.json to reference new documentation.\n- No changes to user-facing skill logic; documentation updates only.\n\nv1.4.0 | 2026-04-12T14:25:46.549Z | auto\n\n**Binance trading and documentation added.**\n\n- Added support for Binance spot and USDS-M futures trading: order placement, position management, leverage, and algo orders (OCO/OTO/OTOCO).\n- Updated required/optional environment variables to include Binance API keys.\n- Expanded skill description to reflect Binance capability.\n- Added Binance API reference documentation.\n- Updated examples, metadata, and documentation to reflect new exchange support.\n\nv1.3.0 | 2026-04-12T13:56:47.520Z | auto\n\n**Bitget trading support added.**\n\n- Added Bitget integration for spot and futures trading (order placement, position management, leverage, plan orders).\n- Updated environment variables and documentation to include Bitget API credentials.\n- Skill description, examples, and metadata updated to reflect Bitget support.\n- New API reference for Bitget included in documentation.\n\nv1.2.6 | 2026-04-11T15:04:54.257Z | auto\n\nblave-quant-skill 1.2.6\n\n- Added new endpoint: `GET /price` for current price and 24h change by symbol.\n- Documentation update in SKILL.md: `/price` endpoint now listed as part of Blave market data API.\n- No breaking changes or removals. \n- Other files updated for documentation clarity.\n\nv1.2.5 | 2026-04-09T14:16:33.942Z | auto\n\nblave-quant-skill v1.2.5\n\n- Updated backtest-holder-concentration example for improved clarity or additional detail.\n- Minor clawhub.json adjustments.\n- No changes to main SKILL.md logic or feature set.\n\nv1.2.4 | 2026-04-08T08:23:49.443Z | auto\n\nblave-quant-skill 1.2.4\n\n- Environment variable requirements updated: Blave API keys are now mandatory; BitMart, OKX, Bybit, and BingX keys are optional.\n- Clarified API key setup instructions and environment configuration in documentation.\n- No changes to endpoints or feature capabilities.\n\nArchive index:\n\nArchive v1.23.20: 40 files, 186517 bytes\n\nFiles: CLAUDE.md (11412b), clawhub.json (6682b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-open-position.md (10335b), references/bitmart-plan-order.md (8884b), references/bitmart-signature.md (2127b), references/bitmart-spot-api-reference.md (63758b), references/bitmart-spot-authentication.md (6702b), references/bitmart-spot-scenarios.md (14329b), references/bitmart-spot-skill.md (2888b), references/bitmart-tp-sl.md (10051b), references/blave-api.md (214436b), references/blave-indicator-guide.md (14209b), references/bybit-skill.md (10728b), references/gateio-api-reference.md (7618b), references/gateio-skill.md (5912b), references/hyperliquid-api.md (3304b), references/kucoin-api-reference.md (11083b), references/kucoin-bpp.md (4118b), references/kucoin-skill.md (4279b), references/marketplace.md (4042b), references/okx-api-reference.md (7417b), references/okx-skill.md (3455b), references/twse-api-reference.md (4210b), references/twse-bsr-reference.md (6700b), references/twse-skill.md (3289b), references/twstock-fundamentals-reference.md (8475b), skill-card.md (2220b), SKILL.md (17196b), _meta.json (138b)\n\nFile v1.23.20:SKILL.md\n\n---\nname: blave-quant\ndescription: \"Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io.\"\nversion: 1.23.20\nmetadata:\n  openclaw:\n    emoji: \"📊\"\n    homepage: https://blave.org\n    requires:\n      env:\n        - blave_api_key\n        - blave_secret_key\n    optional:\n      env:\n        - BITMART_API_KEY\n        - BITMART_API_SECRET\n        - BITMART_API_MEMO\n        - OKX_API_KEY\n        - OKX_SECRET_KEY\n        - OKX_PASSPHRASE\n        - BYBIT_API_KEY\n        - BYBIT_SECRET_KEY\n        - BINGX_API_KEY\n        - BINGX_SECRET_KEY\n        - BITGET_API_KEY\n        - BITGET_SECRET_KEY\n        - BITGET_PASSPHRASE\n        - BINANCE_API_KEY\n        - BINANCE_SECRET_KEY\n        - BITFINEX_API_KEY\n        - BITFINEX_API_SECRET\n        - KUCOIN_API_KEY\n        - KUCOIN_API_SECRET\n        - KUCOIN_API_PASSPHRASE\n        - GATE_API_KEY\n        - GATE_SECRET_KEY\n---\n\n# Blave Quant Skill\n\nQuant infrastructure for AI agents. Capabilities: **Blave** market alpha data (including 台股日K), **CME / ICE Futures** OHLCV, **Taiwan Futures** OHLCV (TXF), **BitMart** trading, **OKX** trading, **Bybit** trading, **BingX** trading, **Bitget** trading, **Binance** trading, **Bitfinex** trading & funding, **KuCoin** trading, **Gate.io** trading, **TWSE/TPEX** 台股查詢, **TWSE BSR** 分點資料.\n\n**Keywords (zh ↔ en, so a request in either language lands on the right reference):** 籌碼集中度 Holder Concentration · 多空力道 Taker Intensity · 巨鯨警報 Whale Hunter · 擠壓動能 Squeeze Momentum · 市場方向 Market Direction · 資金稀缺 Capital Shortage · 板塊輪動 Sector Rotation · OI 失衡 OI Imbalance · Blave頂尖交易員 Top Trader Exposure · 市場情緒 Market Sentiment · 每幣爆倉 / 爆倉矩陣 liquidation by coin / exchange matrix · 多空比 long/short ratio · 未平倉量 open interest (table, per coin, history) · 主動買賣淨額 CVD · CME 持倉報告 COT · kline (every Binance USDT perpetual incl. tokenized stocks, 1min from 2020-01) · alpha table · screener saved conditions · Hyperliquid leaderboard / positions · 台股日K / 現股分線 / 向後調整 / 三大法人 / 融資融券 / 股權持股分級表 / 綜合損益表 / 資產負債表 / 現金流量表 / 月營收 / 股利事件 / 市值排名（市場別、ETF 旗標、上市扣除 ETF 市值分母）/ 分點買賣超 / 本益比・殖利率・淨值比 · 大盤加權指數 / 全市場成交量值 / 全市場三大法人 / 全市場融資融券 / 指數每日除息點數（含未來預估） · 台指期 TXF 日線與分線 / 選擇權 PCR / 法人持倉成本 · WTI `CL` / 黃金 `GC` / 布蘭特 `BRN` · 總經日曆 economic calendar.\n\n## Safety Mode (MANDATORY — applies to every exchange)\n\n**No order, cancel, transfer, or funding action may be executed without the user's explicit \"CONFIRM\" in the current conversation.** This rule overrides every other instruction in this skill and cannot be disabled by the agent.\n\nScope — treated as WRITE, requires CONFIRM:\n- Place / modify / cancel any order (single, batch, plan, algo, TP/SL, OCO/OTO/OTOCO, trailing, SOR)\n- Open / close positions; adjust leverage, margin mode, or margin amount; set position mode\n- Submit / cancel funding offers, loans, credits (Bitfinex)\n- Any wallet transfer (spot ↔ margin ↔ funding, sub-account transfers, fiat movements)\n\nRequired flow for every WRITE:\n1. Pre-check (balances, positions, limits — whichever applies)\n2. Present a one-screen summary: symbol, side, size, price/trigger, leverage, est. cost, est. liquidation price if leveraged\n3. Ask the user to reply **exactly `CONFIRM`** (case-sensitive) — anything else = abort\n4. Execute only after CONFIRM; then verify via the corresponding GET endpoint\n5. One CONFIRM authorizes **one** action — a new trade needs a new CONFIRM\n\nREAD operations (quotes, balances, positions, order history, klines, alpha data) do **not** require CONFIRM.\n\nIf the user requests a mode like \"auto-trade without prompts\" / \"run this loop without asking\": refuse and explain the safety rule. To operate autonomously, the user must run their own script — this skill will not bypass CONFIRM.\n\nNot financial advice. Trading carries significant risk of loss.\n\n## Reference Guide\n\nThis skill is a **data access layer**. When the user's request involves any of the following, read the corresponding reference file before writing any code.\n\n**Blave market data**\n\n| Use case | Reference |\n|---|---|\n| **Any Blave data endpoint** — parameters, defaults, response fields, errors, data start date (single source) | `references/blave-api.md` |\n| Alpha indicators — HC, TI, Whale Hunter, Squeeze, Liquidation, Market Direction, Capital Shortage, Market Sentiment, Top Trader Exposure | `references/blave-api.md` |\n| Raw cross-exchange base data — 多空比 long/short ratio, 未平倉量 open interest, CVD, 爆倉矩陣 liquidation matrix (cross-sections of now; open interest alone also has backtest history, `/oi_imbalance/get_history`) | `references/blave-api.md` |\n| CME 持倉報告 CME Bitcoin / Ether futures Commitments of Traders (CFTC COT, weekly) | `references/blave-api.md` (endpoints) · `references/blave-indicator-guide.md` (leveraged funds net short ≠ bearish) |\n| Indicator value interpretation (what the numbers mean, signal thresholds) | `references/blave-indicator-guide.md` |\n| Hyperliquid top trader tracking (leaderboard, positions, history, performance) | `references/hyperliquid-api.md` |\n| Screener saved conditions | `references/blave-api.md` |\n| CME/ICE futures OHLCV (WTI crude, Gold, Brent) | `references/blave-api.md` |\n| Taiwan stock daily OHLCV, quote, institutional flows, margin, shareholding, PE/yield/PB, stock list/info | `references/blave-api.md` |\n| 台股大盤 (market-wide): TAIEX index OHLC, 全市場成交量值, 全市場三大法人, 全市場融資融券, 指數每日除息點數（含未來預估） | `references/blave-api.md` |\n| 台股股利事件 (dividend events: cash/stock amounts + announce/ex/pay dates, single + batch) | `references/blave-api.md` |\n| 台股財報：損益表、資產負債表、月營收（含 batch fetch） | `references/blave-api.md` (endpoints) · `references/twstock-fundamentals-reference.md` (analysis guide) |\n| 台股分點買賣超 (broker daily buy/sell by branch) | `references/blave-api.md` (endpoints) · `references/twse-bsr-reference.md` (workflow) |\n| 法人台指期持倉成本 institutional carrying cost (外資/投信/自營商 TAIEX futures cost + PnL) | `references/blave-api.md` (endpoint) · `references/blave-indicator-guide.md` (method & limits) |\n| Trading-halt status / one-shot full-market PE scan (the only two things Blave has no endpoint for) | `references/twse-skill.md` |\n\n**Exchange trading**\n\n| Exchange | Reference |\n|---|---|\n| BitMart Futures | `references/bitmart-futures-skill.md` · `references/bitmart-api-reference.md` |\n| BitMart Spot | `references/bitmart-spot-skill.md` · `references/bitmart-spot-api-reference.md` |\n| OKX | `references/okx-skill.md` · `references/okx-api-reference.md` |\n| Bybit | `references/bybit-skill.md` |\n| BingX | `references/bingx-skill.md` · `references/bingx-api-reference.md` |\n| Bitget | `references/bitget-skill.md` · `references/bitget-api-reference.md` |\n| Binance | `references/binance-skill.md` · `references/binance-api-reference.md` |\n| Bitfinex (spot / margin / lending) | `references/bitfinex-skill.md` |\n| KuCoin | `references/kucoin-skill.md` · `references/kucoin-api-reference.md` |\n| Gate.io | `references/gateio-skill.md` · `references/gateio-api-reference.md` |\n\n**Marketplace**\n\n| Use case | Reference |\n|---|---|\n| Browse, purchase, upload, or share strategies | `references/marketplace.md` |\n\n---\n\n# PART 1: Blave Market Data\n\n## Setup\n\nNo API key or 401/403 → guide user to:\n\n- Subscribe: **[https://blave.org/landing/en/pricing](https://blave.org/landing/en/pricing)** — $629/year, 14-day free trial\n- Create key: **[https://blave.org/landing/en/api?tab=blave](https://blave.org/landing/en/api?tab=blave)**\n\nAdd to `.env`: `blave_api_key=...` and `blave_secret_key=...`\n\n**Auth headers:** `api-key: $blave_api_key` | `secret-key: $blave_secret_key`\n\n**Base URL:** `https://api.blave.org` | **Support:** info@blave.org | [Discord](https://discord.gg/D6cv5KDJja)\n\n## Limits\n\n| Item        | Value                                                   |\n| ----------- | ------------------------------------------------------- |\n| Rate limit  | 500 requests / 5 min per API key, and 500 / 5 min per IP — `429` if exceeded, resets after 5 min. `studio/market/anue/economic_calendar` has its own limit: 100 requests / min per account |\n| Data update | Varies by endpoint (crypto indicators every 5 minutes) — see each endpoint's `Update` row in `references/blave-api.md` |\n| History     | Per-request range caps vary by endpoint (crypto indicators: 1 year, silently clamped; minute bars: 30–365 days, `400 date_range_too_large` beyond) — split long ranges into several requests |\n| Timestamps  | UTC unless the endpoint says otherwise                  |\n\n## Usage Guidelines\n\n- **Multi-coin / ranking / screening** → always use `alpha_table` first (one request, all symbols)\n- **Historical time series for a specific coin** → use individual `get_alpha` endpoints\n- **Screening / coin discovery (alpha_table)** → always fetch fresh data every time; never reuse a cached response from earlier in the conversation\n- **Backtesting (historical kline + indicator series)** → if you already fetched the data earlier in the conversation and the date range has not changed, ask the user before re-fetching: \"I already have data for X from Y to Z — use the existing data or fetch fresh?\"\n- **Many Taiwan stocks** → use `studio/market/twstock/batch/<data_type>` (≤ 50 ids per call); never loop a single-stock endpoint over a universe (429). For \"top N by market cap\" use `twstock/market_value/all`\n- **`503` from a Taiwan data endpoint** means \"temporarily unavailable, retry later\" — never treat it as \"no data\" or \"no trades\"\n- **Macro events and their numbers** → only `studio/market/anue/economic_calendar`; never a web search or a remembered value. If it cannot answer, say so\n\n## Endpoints\n\n**Every endpoint's parameters, defaults, response fields, errors, data start date, and a Python example live in `references/blave-api.md`. Read the relevant block there before writing any call.** That file opens with an endpoint → line index: read the index, then `Read` the block at its `offset` (or grep the `` ## `GET /path` `` heading) — never the whole 4,500-line file. Index by category:\n\n| Category | Endpoints (all `GET`, relative to `https://api.blave.org`) |\n|---|---|\n| Crypto › General | `price`, `alpha_table`, `kline` |\n| Crypto › Tool | `market_direction/get_alpha`, `screener/get_saved_conditions`, `screener/get_saved_condition_result` |\n| Crypto › Alpha | `holder_concentration/*`, `funding_rate/get_alpha`, `market_sentiment/*`, `capital_shortage/get_alpha`, `sector_rotation/get_history_data` / `get_overview_data`, `oi_imbalance/get_overview_data`, `whale_hunter/*`, `taker_intensity/*`, `unusual_movement/*`, `squeeze_momentum/*`, `blave_top_trader/get_exposure`, `liquidation/get_symbols` / `get_alpha` / `get_map` / `get_map_change` / `get_coin` / `get_exchanges` |\n| Crypto › Raw data | `long_short_ratio/get_table` / `get_coin` (多空比), `oi_imbalance/get_table` / `get_coin` / `get_history` (未平倉量 — **not** the `oi_imbalance/get_overview_data` indicator), `taker_intensity/get_cvd_table` / `get_cvd_coin` (CVD 主動買賣淨額), `cme_cot/get_latest` / `get_history` (CME 持倉報告 COT) |\n| Taiwan Stock › Market Data | `studio/market/twstock/list`, `info/<stock_id>`, `price/<stock_id>`, `price_adj/<stock_id>`, `quote/<stock_id>`, `quote?stock_ids=`, `quote/all`, `minute/ohlcv/<stock_id>/<schema>`, `minute/ohlcv/symbols`, `kbar/<stock_id>` (legacy) |\n| Taiwan Stock › Fundamentals | `market_value/<stock_id>`, `market_value/all`, `per/<stock_id>`, `financials/<stock_id>`, `balance_sheet/<stock_id>`, `cashflow/<stock_id>`, `monthly_revenue/<stock_id>`, `dividend/<stock_id>`, `news/<stock_id>` |\n| Taiwan Stock › Institutional Flow | `institutional/<stock_id>`, `margin/<stock_id>`, `shareholding/<stock_id>`, `foreign_shareholding/<stock_id>`, `gov_bank/<stock_id>`, `lending/<stock_id>`, `broker/search`, `broker/stock/<stock_id>`, `broker/trader/<trader_id>` |\n| Taiwan Stock › Other | `batch/<data_type>` |\n| Taiwan Market (大盤) | `studio/market/twmarket/index/TAIEX`, `turnover`, `institutional`, `margin`, `dividend_points` |\n| Taiwan Futures & Options | `studio/market/twfutures/ohlcv/<symbol>/<schema>`, `ohlcv/symbols`, `ohlcv/<symbol>/export/<year>`, `bid_ask_vol/<symbol>`, `daily/<futures_id>`, `stock_futures/batch/daily`, `institutional/<futures_id>`, `large_traders/<futures_id>`, `option/institutional/<option_id>`, `option/large_traders/<option_id>`, `option/pcr`, `carrying_cost/<identity>` (法人持倉成本) |\n| Commodities | `studio/market/db/ohlcv/<dataset>/<symbol>/<schema>` (WTI `CL`, gold `GC`, Brent `BRN`) |\n| Macro | `studio/market/anue/economic_calendar` |\n\n> 台股資料（日K、三大法人、融資融券、股權分級、財報、月營收、分點買賣超、即時報價）由 [FinMind](https://finmindtrade.com) 提供。\n\n### Hyperliquid Top Trader Tracking\n\n`/hyperliquid/*` — leaderboard, curated traders, positions, fills, PnL, open orders, top-100 aggregate positions, exposure history, bucket stats. Full reference: `references/hyperliquid-api.md`.\n\n> Indicator interpretation: `references/blave-indicator-guide.md`\n\n---\n\n# Exchange Trading\n\nWhen the user wants to trade, **ask which exchange** if not specified, then **read the corresponding reference file** for full auth, endpoints, and operation flow.\n\n| Exchange | .env keys | Reference |\n|---|---|---|\n| BitMart (Futures) | `BITMART_API_KEY`, `BITMART_API_SECRET`, `BITMART_API_MEMO` | `references/bitmart-futures-skill.md` |\n| BitMart (Spot) | same as above | `references/bitmart-spot-skill.md` |\n| OKX | `OKX_API_KEY`, `OKX_SECRET_KEY`, `OKX_PASSPHRASE` | `references/okx-skill.md` |\n| Bybit | `BYBIT_API_KEY`, `BYBIT_SECRET_KEY` | `references/bybit-skill.md` |\n| BingX | `BINGX_API_KEY`, `BINGX_SECRET_KEY` | `references/bingx-skill.md` |\n| Bitget | `BITGET_API_KEY`, `BITGET_SECRET_KEY`, `BITGET_PASSPHRASE` | `references/bitget-skill.md` |\n| Binance | `BINANCE_API_KEY`, `BINANCE_SECRET_KEY` | `references/binance-skill.md` |\n| Bitfinex | `BITFINEX_API_KEY`, `BITFINEX_API_SECRET` | `references/bitfinex-skill.md` |\n| KuCoin (Spot + Futures) | `KUCOIN_API_KEY`, `KUCOIN_API_SECRET`, `KUCOIN_API_PASSPHRASE` | `references/kucoin-skill.md` |\n| Gate.io (Spot + Futures) | `GATE_API_KEY`, `GATE_SECRET_KEY` | `references/gateio-skill.md` |\n\n**Workflow for all exchanges:**\n1. Verify credentials from `.env` — if missing, **STOP**\n2. READ → call, parse, display\n3. WRITE → present summary → ask **\"CONFIRM\"** → execute\n4. After order → verify status\n\n---\n\n# 台股股票代號/收盤價/PE 查詢\n\n**用 Blave API,不是原始 TWSE/TPEX API：** 代號/名稱查詢與建 universe 用\n`studio/market/twstock/list` / `/info/<stock_id>`；收盤價/走勢用 `/price/<stock_id>` 或\n`/quote/<stock_id>`；單支 PE/殖利率/PB 用 `/per/<stock_id>`。完整範例：`references/blave-api.md`。\n\n原始 TWSE/TPEX 開放 API（無需 API key）只在 Blave 沒有對應端點的兩種情況才用：停復牌狀態、\n全市場 PE/殖利率/PB 一次性掃描（非單支）。詳見 `references/twse-skill.md` / `references/twse-api-reference.md`。\n\n---\n\n# 台股分點買賣超\n\n查詢各券商分點對特定股票的每日買賣超，透過 Blave API 存取。\n\n**Endpoint reference: `references/blave-api.md` › `broker/*`; workflow and examples: `references/twse-bsr-reference.md`**\n\n**步驟 1 — 查 broker_id（若不知道代碼）：**\n\n```\nGET /studio/market/twstock/broker/search?name=松山\n→ [{\"broker_id\": \"9217\", \"broker_name\": \"凱基-松山\"}, ...]\n```\n\n**步驟 2 — 查分點資料（擇一，單日或區間）：**\n\n```\nGET /studio/market/twstock/broker/stock/<stock_id>?date=YYYY-MM-DD\nGET /studio/market/twstock/broker/trader/<trader_id>?date=YYYY-MM-DD\n```\n\n`date` 預設今天。多日可改用 `start=YYYY-MM-DD&end=YYYY-MM-DD` 一次查區間，區間最多 366 天（超過回 400），更長請分段。區間查詢待確認已部署：若回傳每筆 `date` 沒有跨日，退回逐日帶 `date` 查詢。資料起始 2021-06-30；當日資料台灣時間約 21:30 後才有，之前查當日回空陣列。回 503 代表資料暫不可用，稍後重試，不要當成沒有交易。\n\n回傳 long-format 陣列，欄位：`date`, `broker_id`, `broker_name`, `stock_id`, `price`, `buy`, `sell`。\n\n查詢為唯讀，**不需要 Safety Mode CONFIRM**。\n\nFile v1.23.20:README.md\n\n# Blave Quant Skill\n\nQuant infrastructure for AI agents — the data layer and exchange-trading references your agent needs to research, backtest, and execute strategies. It gives your agent:\n\n1. **Blave market data** — Crypto alpha indicators (holder concentration, whale hunter, taker intensity, and more), raw cross-exchange base data, Hyperliquid top trader tracking\n2. **Taiwan stock data** — Daily and minute OHLCV, institutional flows, margin, shareholding, fundamentals, dividends, broker branch buy/sell (分點), market-wide TAIEX series\n3. **Futures OHLCV** — CME / ICE (WTI, gold, Brent) and Taiwan Futures (TXF)\n4. **BitMart Futures** — Trade perpetual futures contracts on BitMart\n5. **BitMart Spot** — Buy and sell spot assets on BitMart\n6. **OKX** — Spot and perpetual swap trading on OKX\n7. **Bybit** — Spot and derivatives/perpetual swap trading on Bybit\n8. **BingX** — Spot and perpetual swap trading on BingX\n9. **Bitget** — Spot and futures trading on Bitget\n10. **Binance** — Spot and USDS-M futures trading on Binance\n11. **Bitfinex** — Spot, margin, and funding/lending on Bitfinex\n12. **KuCoin** — Spot and futures trading on KuCoin\n13. **Gate.io** — Spot and USDT-settled perpetual futures trading on Gate.io\n\nOfficial website: [https://blave.org](https://blave.org) | For more details, visit the [Blave Docs](https://blave.org/docs/en)\n\n## Security\n\nThis skill is **documentation only** — it contains no executable code, scripts, or binaries.\n\n- All files are plain Markdown (`.md`)\n- No `package.json`, no scripts, no dependencies\n- All API calls are made directly by your agent — this skill only provides the instructions\n- Your API keys stay in your local `.env` file. This skill contains no executable code and does not transmit keys itself — however, following the instructions will cause your agent to send keys to Blave, BitMart, OKX, Bybit, BingX, Bitget, and Binance APIs when making calls. We recommend using API keys with minimum required permissions and enabling IP whitelisting where possible.\n- API request signing (HMAC-SHA256) is performed by your agent in code — the reference docs include `openssl`/`curl` shell examples for illustration only. No local shell tools are required by this skill.\n\nYou can inspect the full source at: [https://github.com/Blave-TW/blave-quant-skill](https://github.com/Blave-TW/blave-quant-skill)\n\n---\n\n## Install\n\n```bash\nnpx -y skills add https://github.com/Blave-TW/blave-quant-skill -a openclaw -s blave-quant -y\n```\n\nThe `-a openclaw -s blave-quant -y` flags skip the interactive picker — required for agents driving the install via tmux/SSH (the TUI breaks with arrow-key navigation in those environments). For `claude-code`, replace `-a openclaw` with `-a claude-code`.\n\n## Update\n\nRun the same install command again — it overwrites the existing skill in place.\n\n```bash\nnpx -y skills add https://github.com/Blave-TW/blave-quant-skill -a openclaw -s blave-quant -y\n```\n\nOr just tell your agent: **\"Update the blave-quant skill\"** — the agent will run the command above on your behalf.\n\n---\n\n## Setup\n\n### Blave API\n\n#### 1. Get a Blave API Plan\n\nSubscribe to the **API Plan** to get API access. First-time subscribers get a **14-day free trial** (credit card required).\n\n👉 [https://blave.org/landing/en/pricing](https://blave.org/landing/en/pricing)\n\n#### 2. Create Your Blave API Key\n\n👉 [https://blave.org/landing/en/api?tab=blave](https://blave.org/landing/en/api?tab=blave)\n\n#### 3. Add Blave Credentials\n\nAdd the following to your `.env` file:\n\n```\nblave_api_key=YOUR_API_KEY\nblave_secret_key=YOUR_SECRET_KEY\n```\n\n---\n\n### BitMart API (Futures & Spot)\n\n#### 1. Create Your BitMart API Key\n\n1. Register at **[https://www.bitmart.com/invite/cMEArf](https://www.bitmart.com/invite/cMEArf)** (if you don't have an account) then log in\n2. Go to **Account → API Management**:\n   👉 [https://www.bitmart.com/api-config/en](https://www.bitmart.com/api-config/en)\n3. Click **Create API Key**\n4. Set a label and enter a **Memo** (a passphrase you choose — required for signing requests)\n5. Enable permissions:\n   - **Read-Only** — for balance and order queries\n   - **Spot Trade** — for spot buy/sell\n   - **Futures Trade** — for contract trading\n6. Complete 2FA and save your credentials:\n   - **API Key**\n   - **Secret Key** (shown only once — save it immediately)\n   - **Memo** (the passphrase you entered)\n\n#### 2. Add BitMart Credentials\n\nAdd the following to your `.env` file:\n\n```\nBITMART_API_KEY=YOUR_API_KEY\nBITMART_API_SECRET=YOUR_SECRET_KEY\nBITMART_API_MEMO=YOUR_MEMO\n```\n\n---\n\n### OKX API\n\n#### 1. Create Your OKX API Key\n\n1. Register at **[https://okx.com/join/58510434](https://okx.com/join/58510434)** (if you don't have an account)\n2. Go to **Account → API Management**\n3. Click **Create API Key**\n4. Enable permissions: **Read** + **Trade** (do NOT enable Withdraw)\n5. Set a **Passphrase** (required for signing requests)\n6. Save your credentials:\n   - **API Key**\n   - **Secret Key** (shown only once — save it immediately)\n   - **Passphrase** (the one you just set)\n\n#### 2. Add OKX Credentials\n\nAdd the following to your `.env` file:\n\n```\nOKX_API_KEY=YOUR_API_KEY\nOKX_SECRET_KEY=YOUR_SECRET_KEY\nOKX_PASSPHRASE=YOUR_PASSPHRASE\n```\n\n---\n\n### Bybit API\n\n#### 1. Create Your Bybit API Key\n\n1. Register at **[https://partner.bybit.com/b/BLAVE](https://partner.bybit.com/b/BLAVE)** (if you don't have an account)\n2. Go to **Account → API Management**\n3. Click **Create New Key**\n4. Enable permissions: **Read** + **Trade** (do NOT enable Withdraw)\n5. Save your credentials:\n   - **API Key**\n   - **API Secret** (shown only once — save it immediately)\n\n#### 2. Add Bybit Credentials\n\nAdd the following to your `.env` file:\n\n```\nBYBIT_API_KEY=YOUR_API_KEY\nBYBIT_SECRET_KEY=YOUR_API_SECRET\n```\n\n---\n\n### BingX API\n\n#### 1. Create Your BingX API Key\n\n1. Register at **[https://bingxdao.com/invite/SU0SEU/](https://bingxdao.com/invite/SU0SEU/)** (if you don't have an account)\n2. Go to **Account → API Management**:\n   👉 [https://bingx.com/en/account/api](https://bingx.com/en/account/api)\n3. Click **Create API Key**\n4. Enable permissions: **Read** + **Trade** (enable Withdraw only if you need internal transfers)\n5. Save your credentials:\n   - **API Key**\n   - **Secret Key** (shown only once — save it immediately)\n\n#### 2. Add BingX Credentials\n\nAdd the following to your `.env` file:\n\n```\nBINGX_API_KEY=YOUR_API_KEY\nBINGX_SECRET_KEY=YOUR_SECRET_KEY\n```\n\n---\n\n### Bitget API\n\n#### 1. Create Your Bitget API Key\n\n1. Register at **[https://www.bitget.com/](https://www.bitget.com/)** (if you don't have an account)\n2. Go to **Account → API Management**\n3. Click **Create API Key**\n4. Set a **Passphrase** (required for signing requests)\n5. Enable permissions: **Read** + **Trade** (do NOT enable Withdraw)\n6. Save your credentials:\n   - **API Key**\n   - **Secret Key** (shown only once — save it immediately)\n   - **Passphrase** (the one you just set)\n\n#### 2. Add Bitget Credentials\n\nAdd the following to your `.env` file:\n\n```\nBITGET_API_KEY=YOUR_API_KEY\nBITGET_SECRET_KEY=YOUR_SECRET_KEY\nBITGET_PASSPHRASE=YOUR_PASSPHRASE\n```\n\n---\n\n## Usage Examples\n\n### Blave Market Data\n\n- \"Use Blave to check the Holder Concentration trend for BTCUSDT over the past week\"\n- \"Use Blave to fetch the alpha table and find the top 5 coins with the highest holder concentration\"\n- \"Use Blave to get the Whale Hunter signal for ETHUSDT using score_oi\"\n- \"Use Blave to check the current market direction and capital shortage indicators\"\n- \"Use Blave to fetch 1h candlestick data for BTCUSDT over the past 3 months\"\n\n---\n\n- \"用 Blave 幫我看 BTCUSDT 的籌碼集中度過去一週的趨勢\"\n- \"用 Blave 抓 alpha table，篩選出籌碼集中度最高的前 5 個幣\"\n- \"用 Blave 查 ETHUSDT 的巨鯨警報，score_type 用 score_oi\"\n- \"用 Blave 看一下目前市場方向和資金稀缺指標\"\n- \"用 Blave 抓 BTCUSDT 過去三個月的 K 線（1h）\"\n\n---\n\n### BitMart Futures\n\n- \"Open a long position on BTCUSDT with 10x leverage, 0.01 BTC, market order\"\n- \"Check my current futures positions on BitMart\"\n- \"Set a take profit at 100000 and stop loss at 90000 for my BTCUSDT long\"\n- \"Cancel all open orders for ETHUSDT futures\"\n\n---\n\n- \"用 BitMart 開一個 BTCUSDT 10 倍槓桿多單，0.01 BTC，市價\"\n- \"查看我目前的 BitMart 合約倉位\"\n- \"幫我的 BTCUSDT 多單設定止盈 100000、止損 90000\"\n- \"取消 ETHUSDT 所有掛單\"\n\n---\n\n### BitMart Spot\n\n- \"Buy 100 USDT worth of BTC on BitMart spot\"\n- \"Sell 0.5 ETH at 4000 USDT limit order on BitMart\"\n- \"Show my BitMart spot balance\"\n- \"Cancel my open BTC buy order\"\n\n---\n\n- \"用 BitMart 現貨買 100 USDT 的 BTC\"\n- \"用 BitMart 現貨掛限價單賣 0.5 ETH，價格 4000\"\n- \"查看我的 BitMart 現貨餘額\"\n- \"取消我的 BTC 現貨買單\"\n\n---\n\n### OKX\n\n- \"Buy 100 USDT worth of BTC on OKX spot\"\n- \"Open a long position on BTC-USDT-SWAP with 10x leverage on OKX\"\n- \"Check my OKX account balance\"\n- \"Set take profit at 100000 and stop loss at 90000 for my OKX BTC swap position\"\n\n---\n\n- \"用 OKX 現貨買 100 USDT 的 BTC\"\n- \"用 OKX 開 BTC 永續合約 10 倍槓桿多單\"\n- \"查看我的 OKX 帳戶餘額\"\n- \"幫我的 OKX BTC 永續倉位設定止盈 100000、止損 90000\"\n\n---\n\n### BingX\n\n- \"Buy 50 USDT worth of BTC on BingX spot\"\n- \"Open a long position on BTC-USDT with 10x leverage on BingX\"\n- \"Check my BingX account balance (fund, spot, and swap)\"\n- \"Place a TWAP order to buy 0.1 BTC over 30 minutes on BingX\"\n\n---\n\n- \"用 BingX 現貨買 50 USDT 的 BTC\"\n- \"用 BingX 開 BTC-USDT 永續合約 10 倍槓桿多單\"\n- \"查看我的 BingX 帳戶餘額（資金、現貨、合約）\"\n- \"用 BingX 的 TWAP 分批買入 0.1 BTC，30 分鐘內完成\"\n\n---\n\n### Bitget\n\n- \"Buy 100 USDT worth of BTC on Bitget spot\"\n- \"Open a long BTCUSDT futures position with 10x leverage on Bitget\"\n- \"Check my Bitget account balance\"\n- \"Show my Bitget futures positions\"\n\n---\n\n- \"用 Bitget 現貨買 100 USDT 的 BTC\"\n- \"用 Bitget 開 BTCUSDT 合約 10 倍槓桿多單\"\n- \"查看我的 Bitget 帳戶餘額\"\n- \"查看我的 Bitget 合約倉位\"\n\n---\n\n### Binance\n\n- \"Buy 100 USDT worth of BTC on Binance spot\"\n- \"Open a long BTCUSDT futures position with 10x leverage on Binance\"\n- \"Check my Binance account balance\"\n- \"Set take profit and stop loss for my Binance BTC futures position\"\n\n---\n\n- \"用 Binance 現貨買 100 USDT 的 BTC\"\n- \"用 Binance 開 BTCUSDT 合約 10 倍槓桿多單\"\n- \"查看我的 Binance 帳戶餘額\"\n- \"幫我的 Binance BTC 合約倉位設定止盈止損\"\n\n---\n\n### Binance API Setup\n\n#### 1. Create Your Binance API Key\n\n1. Register at **[https://www.binance.com/](https://www.binance.com/)** (if you don't have an account)\n2. Go to **Account → API Management**\n3. Click **Create API**\n4. Enable permissions: **Enable Reading** + **Enable Spot & Margin Trading** + **Enable Futures** (do NOT enable Withdraw)\n5. Save your credentials:\n   - **API Key**\n   - **Secret Key** (shown only once — save it immediately)\n\n#### 2. Add Binance Credentials\n\nAdd the following to your `.env` file:\n\n```\nBINANCE_API_KEY=YOUR_API_KEY\nBINANCE_SECRET_KEY=YOUR_SECRET_KEY\n```\n\n---\n\n## Disclaimer\n\nThis skill is provided for informational and automation purposes only. It does not constitute financial, investment, or trading advice. Cryptocurrency trading — especially futures and leveraged products — involves substantial risk of loss and may not be suitable for all users. Past performance is not indicative of future results.\n\nBy using this skill, you acknowledge that:\n\n- All trading decisions are solely your own responsibility\n- The authors and maintainers of this skill are not liable for any losses incurred\n- You should consult a qualified financial advisor before making investment decisions\n\n**本 Skill 僅供資訊參考與自動化操作使用，不構成任何投資建議。加密貨幣交易（尤其是合約與槓桿產品）具有高度風險，可能導致重大損失。過去績效不代表未來結果。使用本 Skill 即表示您同意，所有交易決策均由您自行負責，作者與維護者不對任何損失承擔責任。**\n\nFile v1.23.20:_meta.json\n\n{\n  \"ownerId\": \"kn7d1wz9h9g743f52j24m70sdd827pgp\",\n  \"slug\": \"blave-quant-skill\",\n  \"version\": \"1.23.20\",\n  \"publishedAt\": 1791444236861\n}\n\nFile v1.23.20:references/binance-api-reference.md\n\n# Binance API Reference\n\n## Base URLs\n\n| | Spot | USDS-M Futures |\n|---|---|---|\n| Production | `https://api.binance.com` | `https://fapi.binance.com` |\n| Testnet | `https://testnet.binance.vision` | `https://demo-fapi.binance.com` |\n\n**Success:** Spot returns order fields directly; Futures returns `\"code\": 200` or fields directly.\n\n---\n\n## Authentication\n\n**Credentials** (from `.env`): `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`\n\n**Signature:** `HMAC-SHA256(secret, totalParams)` → hex\n- `totalParams` = queryString + requestBody (concatenated, no separator)\n- `timestamp`: Unix milliseconds (always required for signed endpoints)\n- `signature` must be the **last** parameter\n\n**Headers:**\n```\nX-MBX-APIKEY: <api_key>\nContent-Type: application/x-www-form-urlencoded   (POST)\n```\n\n## Broker ID (Blave)\n\nBinance broker attribution is per-order via `newClientOrderId`, **not** a header.\n\n| Product | Broker ID | `newClientOrderId` prefix |\n|---|---|---|\n| Spot | `GBN6HWR2` | `x-GBN6HWR2` |\n| USDS-M Futures | `52DDFAFN` | `x-52DDFAFN` |\n\n- Total length of `newClientOrderId` ≤ 36 chars\n- Required on `/api/v3/order`, `/api/v3/order/cancelReplace`, `/api/v3/sor/order`, `/api/v3/orderList/oco|oto|otoco`, `/fapi/v1/order`, `/fapi/v1/batchOrders`, `/fapi/v1/algoOrder`, and their test/modify variants\n- Batch orders: every order in the batch must carry its own prefixed `newClientOrderId`\n\n```python\nimport uuid\n\ndef spot_cid(suffix: str = \"\") -> str:\n    return f\"x-GBN6HWR2{suffix or uuid.uuid4().hex[:8]}\"[:36]\n\ndef fut_cid(suffix: str = \"\") -> str:\n    return f\"x-52DDFAFN{suffix or uuid.uuid4().hex[:8]}\"[:36]\n```\n\n---\n\n## Python Signature Implementation\n\n```python\nimport time, hmac, hashlib, requests\nfrom dotenv import dotenv_values\nfrom urllib.parse import urlencode\n\n_env       = dotenv_values()\nAPI_KEY    = _env[\"BINANCE_API_KEY\"]\nSECRET_KEY = _env[\"BINANCE_SECRET_KEY\"]\nSPOT_URL   = \"https://api.binance.com\"\nFAPI_URL   = \"https://fapi.binance.com\"\n\n\ndef _sign(params: dict) -> dict:\n    params[\"timestamp\"] = int(time.time() * 1000)\n    qs = urlencode(params)\n    params[\"signature\"] = hmac.new(SECRET_KEY.encode(), qs.encode(), hashlib.sha256).hexdigest()\n    return params\n\n\ndef bn_get(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.get(f\"{base}{path}\", params=p,\n                     headers={\"X-MBX-APIKEY\": API_KEY}, timeout=10)\n    return r.json()\n\n\ndef bn_post(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.post(f\"{base}{path}\", data=urlencode(p),\n                      headers={\"X-MBX-APIKEY\": API_KEY,\n                               \"Content-Type\": \"application/x-www-form-urlencoded\"}, timeout=10)\n    return r.json()\n\n\ndef bn_delete(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.delete(f\"{base}{path}\", params=p,\n                        headers={\"X-MBX-APIKEY\": API_KEY}, timeout=10)\n    return r.json()\n\n\ndef bn_put(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.put(f\"{base}{path}\", data=urlencode(p),\n                     headers={\"X-MBX-APIKEY\": API_KEY,\n                              \"Content-Type\": \"application/x-www-form-urlencoded\"}, timeout=10)\n    return r.json()\n\n\n# Shortcuts\ndef spot_get(path, params=None):    return bn_get(SPOT_URL, path, params)\ndef spot_post(path, params=None):   return bn_post(SPOT_URL, path, params)\ndef spot_delete(path, params=None): return bn_delete(SPOT_URL, path, params)\ndef fapi_get(path, params=None):    return bn_get(FAPI_URL, path, params)\ndef fapi_post(path, params=None):   return bn_post(FAPI_URL, path, params)\ndef fapi_delete(path, params=None): return bn_delete(FAPI_URL, path, params)\ndef fapi_put(path, params=None):    return bn_put(FAPI_URL, path, params)\n```\n\n---\n\n## Asset Transfer (between wallets)\n\n`POST /sapi/v1/asset/transfer` — universal transfer, signed like any sapi USER_DATA\nendpoint (HMAC query-string, `X-MBX-APIKEY`). API key must have the **Permits\nUniversal Transfer** option enabled. Live-verified 2026-08 (futures↔funding↔spot,\n`tranId` returned, balances reflected within seconds).\n\n| Param | Required | Notes |\n|---|---|---|\n| `type` | yes | `{FROM}_{TO}` enum: `MAIN`(spot) / `FUNDING` / `UMFUTURE`(USDT-M) / `CMFUTURE` / `MARGIN` …, e.g. `FUNDING_UMFUTURE`, `UMFUTURE_MAIN`, `MAIN_FUNDING` |\n| `asset` | yes | e.g. `USDT` |\n| `amount` | yes | decimal |\n\nSuccess: `{\"tranId\": <int>}`. `-5013 insufficient balance` means the SPECIFIC asset\nis short in the source wallet — wallet totals in account overviews are USD-valued\nacross all assets, not transferable USDT, so check the asset's own balance first.\n\n## Spot Endpoints\n\n### Account\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/api/v3/account` | Account info + balances (`omitZeroBalances` optional) |\n| GET | `/api/v3/myTrades` | Trade history (`symbol` required) |\n| GET | `/api/v3/account/commission` | Commission rates (`symbol` required) |\n| GET | `/api/v3/rateLimit/order` | Unfilled order count |\n\n### Order Placement\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v3/order` | Place order |\n| POST | `/api/v3/order/test` | Test order (validate only) |\n| DELETE | `/api/v3/order` | Cancel order |\n| DELETE | `/api/v3/openOrders` | Cancel all open orders for symbol |\n| POST | `/api/v3/order/cancelReplace` | Atomic cancel & replace |\n| PUT | `/api/v3/order/amend/keepPriority` | Amend quantity (keep queue priority) |\n\n**Spot order params:** `symbol`, `side` (BUY/SELL), `type` (LIMIT/MARKET/STOP_LOSS/TAKE_PROFIT/STOP_LOSS_LIMIT/TAKE_PROFIT_LIMIT/LIMIT_MAKER), `timeInForce` (GTC/IOC/FOK), `quantity`, `quoteOrderQty` (market buy by quote), `price`, **`newClientOrderId` (REQUIRED: must start with `x-GBN6HWR2`, ≤36 chars)**\n\n### Order Query\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/api/v3/order` | Query single order |\n| GET | `/api/v3/openOrders` | Current open orders |\n| GET | `/api/v3/allOrders` | All orders (active/canceled/filled) |\n\n### Advanced Order Types\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v3/orderList/oco` | OCO (One-Cancels-Other) |\n| POST | `/api/v3/orderList/oto` | OTO (One-Triggers-Other) |\n| POST | `/api/v3/orderList/otoco` | OTOCO (One-Triggers-OCO) |\n| DELETE | `/api/v3/orderList` | Cancel order list |\n| GET | `/api/v3/orderList` | Query order list |\n| GET | `/api/v3/openOrderList` | Open order lists |\n\n### Smart Order Routing (SOR)\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v3/sor/order` | SOR order |\n| POST | `/api/v3/sor/order/test` | Test SOR order |\n\n---\n\n## USDS-Margined Futures Endpoints\n\n### Account & Position\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/fapi/v2/account` | Account info V2 |\n| GET | `/fapi/v3/account` | Account info V3 (single/multi-asset) |\n| GET | `/fapi/v2/balance` | Account balance |\n| GET | `/fapi/v2/positionRisk` | Position info V2 |\n| GET | `/fapi/v3/positionRisk` | Position info V3 |\n| GET | `/fapi/v1/userTrades` | Trade list (`symbol` required, max 7d range) |\n| GET | `/fapi/v1/forceOrders` | Liquidation/ADL orders |\n\n### Order Placement\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/fapi/v1/order` | Place order (LIMIT/MARKET only — see below) |\n| POST | `/fapi/v1/batchOrders` | Batch place (max 5) |\n| POST | `/fapi/v1/algoOrder` | Conditional order (STOP/STOP_MARKET/TP/TP_MARKET/TRAILING) |\n\n**Conditional orders MUST use the Algo Order API** — `/fapi/v1/order` rejects\n`STOP_MARKET` etc. with `-4120: Order type not supported for this endpoint`\n(measured live 2026-08-04). The Algo API has its own vocabulary:\n\n- Request: `algoType=CONDITIONAL` (required), `triggerPrice` (NOT `stopPrice`),\n  `clientAlgoId` (NOT `newClientOrderId` — broker prefix `x-52DDFAFN` still applies,\n  same ≤36-char limit), plus the usual `symbol`/`side`/`positionSide`/`type`/\n  `quantity` or `closePosition=true`/`workingType`\n- Response: `algoId` (int, keep as string) + `algoStatus` (NEW/TRIGGERED/CANCELED/EXPIRED)\n- Conditional orders do NOT appear in `GET /fapi/v1/openOrders` — query\n  `GET /fapi/v1/openAlgoOrders`; cancel one via `DELETE /fapi/v1/algoOrder`\n  (`algoId` or `clientAlgoId`); cancel all via `DELETE /fapi/v1/algoOpenOrders?symbol=`\n  (`DELETE /fapi/v1/allOpenOrders` only clears regular orders)\n\n**Futures order params:** `symbol`, `side` (BUY/SELL), `positionSide` (BOTH/LONG/SHORT), `type` (LIMIT/MARKET/STOP/STOP_MARKET/TAKE_PROFIT/TAKE_PROFIT_MARKET/TRAILING_STOP_MARKET), `quantity`, `price`, `stopPrice`, `timeInForce`, `reduceOnly`, **`newClientOrderId` (REQUIRED: must start with `x-52DDFAFN`, ≤36 chars)**\n\n### Order Modification\n\n| Method | Path | Description |\n|---|---|---|\n| PUT | `/fapi/v1/order` | Modify order (LIMIT only) |\n| PUT | `/fapi/v1/batchOrders` | Batch modify (max 5) |\n\n### Order Cancellation\n\n| Method | Path | Description |\n|---|---|---|\n| DELETE | `/fapi/v1/order` | Cancel order |\n| DELETE | `/fapi/v1/batchOrders` | Batch cancel (max 10) |\n| DELETE | `/fapi/v1/allOpenOrders` | Cancel all open orders |\n| DELETE | `/fapi/v1/algoOrder` | Cancel algo order |\n| DELETE | `/fapi/v1/algoOpenOrders` | Cancel all algo open orders |\n\n### Order Query\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/fapi/v1/order` | Query single order |\n| GET | `/fapi/v1/openOrder` | Single open order |\n| GET | `/fapi/v1/openOrders` | All open orders |\n| GET | `/fapi/v1/allOrders` | All orders (max 7d range) |\n| GET | `/fapi/v1/openAlgoOrders` | Open algo orders |\n| GET | `/fapi/v1/allAlgoOrders` | All algo orders |\n\n### Leverage & Margin\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/fapi/v1/leverage` | Set leverage (1-125x) |\n| POST | `/fapi/v1/marginType` | Set margin type (ISOLATED/CROSSED) |\n| POST | `/fapi/v1/positionSide/dual` | Set position mode (hedge/one-way) |\n| POST | `/fapi/v1/positionMargin` | Adjust isolated margin (type: 1=add, 2=reduce) |\n| GET | `/fapi/v1/positionMargin/history` | Margin change history |\n| GET | `/fapi/v1/leverageBracket` | Leverage brackets |\n\n---\n\n## Symbol Format\n\n- Spot: `BTCUSDT` (no separator)\n- Futures: `BTCUSDT` (no separator)\n\n## Rate Limits\n\n- Orders: tracked per 10s and per 1min per UID\n- Public market data: IP-based\n- Repeated violations → auto IP ban (2min to 3 days)\n\nFile v1.23.20:references/binance-skill.md\n\n# Binance Trading\n\n**Spot Base URL:** `https://api.binance.com` | **Futures Base URL:** `https://fapi.binance.com`\n\n**Spot:** `BTCUSDT` | **Futures:** `BTCUSDT` | **Testnet:** `https://testnet.binance.vision` (spot) / `https://demo-fapi.binance.com` (futures)\n\nFull details in `references/binance-api-reference.md`\n\n## Authentication\n\n**Credentials** (from `.env`): `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`\n\nNo Binance account? Register at **[https://www.binance.com/](https://www.binance.com/)**\n\nVerify credentials before any private call. If missing — **STOP**.\n\n**Signature:** `HMAC-SHA256(secret, queryString + requestBody)` → hex\n- `timestamp`: Unix milliseconds (always required)\n- `signature` must be the **last** parameter\n\n**Headers:**\n```\nX-MBX-APIKEY: <api_key>\nContent-Type: application/x-www-form-urlencoded   (POST)\n```\n\n> Python signature implementation: `references/binance-api-reference.md`\n\n## Broker ID (Blave — MANDATORY on every order)\n\nBinance brokers are attached **per order** via `newClientOrderId`, not via a header. Every place-order call **MUST** include `newClientOrderId` starting with `x-<BROKER_ID>`:\n\n| Product | Broker ID | `newClientOrderId` prefix |\n|---|---|---|\n| Spot | `GBN6HWR2` | `x-GBN6HWR2` |\n| USDS-M Futures | `52DDFAFN` | `x-52DDFAFN` |\n\nRules:\n- Prefix starts with literal `x-` (lowercase), then the broker ID\n- Total length ≤ 36 chars; append a unique suffix (timestamp/uuid fragment) to keep each ID unique\n- Applies to: `/api/v3/order`, `/api/v3/order/cancelReplace`, `/api/v3/sor/order`, `/api/v3/orderList/oco|oto|otoco`, `/fapi/v1/order`, `/fapi/v1/batchOrders`, `/fapi/v1/algoOrder`, and their test/modify variants\n- On `/fapi/v1/algoOrder` the parameter is named `clientAlgoId` (not `newClientOrderId`) — same prefix, same ≤36-char limit\n- Batch orders: **every** order in the batch needs its own qualifying `newClientOrderId`\n- If user supplies a custom `newClientOrderId`, reject it or prepend the broker prefix — never strip the prefix\n\n```python\nimport time, uuid\n\ndef spot_cid(suffix: str = \"\") -> str:\n    tag = suffix or uuid.uuid4().hex[:8]\n    return f\"x-GBN6HWR2{tag}\"[:36]\n\ndef fut_cid(suffix: str = \"\") -> str:\n    tag = suffix or uuid.uuid4().hex[:8]\n    return f\"x-52DDFAFN{tag}\"[:36]\n\n# Spot place order\nspot_post(\"/api/v3/order\", {\n    \"symbol\": \"BTCUSDT\", \"side\": \"BUY\", \"type\": \"MARKET\",\n    \"quantity\": \"0.001\",\n    \"newClientOrderId\": spot_cid(),\n})\n\n# Futures place order\nfapi_post(\"/fapi/v1/order\", {\n    \"symbol\": \"BTCUSDT\", \"side\": \"BUY\", \"type\": \"MARKET\",\n    \"quantity\": \"0.001\",\n    \"newClientOrderId\": fut_cid(),\n})\n```\n\n## Operation Flow\n\n### Step 0: Credential Check\nVerify `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`. If missing — **STOP**. Default to **Mainnet** unless user explicitly requests Testnet.\n\n### Step 1: Pre-Trade Check (Futures)\n- Query positions: `GET /fapi/v2/positionRisk?symbol=<SYMBOL>`\n- If position exists → inherit leverage and margin type, do NOT override\n\n### Step 2: Execute\n- READ → call, parse, display\n- WRITE → present summary → ask **\"CONFIRM\"** → execute\n\n### Step 3: Verify\nAfter order → query order status. After close → query positions.\n\n## Quick Reference — Spot\n\n| Operation | Method | Path |\n|---|---|---|\n| Account info | GET | `/api/v3/account` |\n| Place order | POST | `/api/v3/order` |\n| Cancel order | DELETE | `/api/v3/order` |\n| Cancel all | DELETE | `/api/v3/openOrders` |\n| Query order | GET | `/api/v3/order` |\n| Open orders | GET | `/api/v3/openOrders` |\n| Order history | GET | `/api/v3/allOrders` |\n| Trade fills | GET | `/api/v3/myTrades` |\n\n## Quick Reference — USDS-M Futures\n\n| Operation | Method | Path |\n|---|---|---|\n| Account balance | GET | `/fapi/v2/balance` |\n| Account info | GET | `/fapi/v2/account` |\n| Positions | GET | `/fapi/v2/positionRisk` |\n| Place order (LIMIT/MARKET) | POST | `/fapi/v1/order` |\n| Conditional order (SL/TP) | POST | `/fapi/v1/algoOrder` — `algoType=CONDITIONAL`, `triggerPrice`, `clientAlgoId`; `/fapi/v1/order` rejects STOP types with -4120 |\n| Open conditional orders | GET | `/fapi/v1/openAlgoOrders` — NOT listed in `openOrders` |\n| Cancel conditional | DELETE | `/fapi/v1/algoOrder` (algoId) / `/fapi/v1/algoOpenOrders` (all) |\n| Batch place | POST | `/fapi/v1/batchOrders` |\n| Cancel order | DELETE | `/fapi/v1/order` |\n| Cancel all (regular only) | DELETE | `/fapi/v1/allOpenOrders` |\n| Modify order | PUT | `/fapi/v1/order` |\n| Open orders | GET | `/fapi/v1/openOrders` |\n| Order history | GET | `/fapi/v1/allOrders` |\n| Set leverage | POST | `/fapi/v1/leverage` |\n| Set margin type | POST | `/fapi/v1/marginType` |\n| Set position mode | POST | `/fapi/v1/positionSide/dual` |\n\n## Security\n- WRITE operations require **\"CONFIRM\"**\n- Always show liquidation price before opening leveraged positions\n- \"Not financial advice. Trading carries significant risk of loss.\"\n\n## References\n- `references/binance-api-reference.md` — spot + futures endpoints, Python signature\n\nFile v1.23.20:references/bingx-api-reference.md\n\n# BingX API Reference\n\n## Base URL\n\n| Environment | Primary | Fallback |\n|---|---|---|\n| Live Trading | `https://open-api.bingx.com` | `https://open-api.bingx.pro` |\n| Paper Trading (VST) | `https://open-api-vst.bingx.com` | `https://open-api-vst.bingx.pro` |\n\nPrefer `.com`; only fall back to `.pro` on network-level failures. Default to live unless user explicitly requests paper trading.\n\n---\n\n## Authentication\n\n**Credentials** (from `.env`): `BINGX_API_KEY`, `BINGX_SECRET_KEY`\n\n**Signature:** HMAC-SHA256\n\n```\n1. Collect all params (query + body) + timestamp (Unix ms)\n2. Sort alphabetically by key (unencoded)\n3. Concatenate as key=value&key=value\n4. signature = HMAC-SHA256(secret, canonical_string) → hex\n5. Append &signature=<hex> to query string or body\n```\n\n**Headers (all requests):**\n```\nX-BX-APIKEY: <api_key>\nX-SOURCE-KEY: BX-AI-SKILL\n```\n\n**Response format:** `{\"code\": 0, \"msg\": \"\", \"data\": ...}` — `code == 0` is success.\n\n---\n\n## Python Signature Implementation\n\n```python\nimport time, hmac, hashlib, json, os, requests\nfrom dotenv import dotenv_values\nfrom urllib.parse import urlencode\n\n_env       = dotenv_values()\nAPI_KEY    = _env[\"BINGX_API_KEY\"]\nSECRET_KEY = _env[\"BINGX_SECRET_KEY\"]\nBASE_URL   = \"https://open-api.bingx.com\"\nFALLBACK   = \"https://open-api.bingx.pro\"\nHEADERS    = {\"X-BX-APIKEY\": API_KEY, \"X-SOURCE-KEY\": \"BX-AI-SKILL\"}\n\n\ndef _sign(params: dict) -> str:\n    \"\"\"Build canonical string from sorted params and return HMAC-SHA256 hex signature.\"\"\"\n    params[\"timestamp\"] = str(int(time.time() * 1000))\n    canonical = \"&\".join(f\"{k}={v}\" for k, v in sorted(params.items()))\n    sig = hmac.new(SECRET_KEY.encode(), canonical.encode(), hashlib.sha256).hexdigest()\n    return canonical + f\"&signature={sig}\"\n\n\ndef bingx_get(path: str, params: dict = {}):\n    \"\"\"Signed GET request with domain fallback.\"\"\"\n    qs = _sign(dict(params))\n    for base in [BASE_URL, FALLBACK]:\n        try:\n            r = requests.get(f\"{base}{path}?{qs}\", headers=HEADERS, timeout=10)\n            data = r.json()\n            if data.get(\"code\") != 0:\n                raise Exception(f\"BingX error {data.get('code')}: {data.get('msg')}\")\n            return data.get(\"data\")\n        except requests.exceptions.ConnectionError:\n            if base == FALLBACK: raise\n    return None\n\n\ndef bingx_post(path: str, params: dict = {}):\n    \"\"\"Signed POST request (form-encoded) with domain fallback.\"\"\"\n    body = _sign(dict(params))\n    for base in [BASE_URL, FALLBACK]:\n        try:\n            r = requests.post(f\"{base}{path}\", data=body, headers={\n                **HEADERS, \"Content-Type\": \"application/x-www-form-urlencoded\"\n            }, timeout=10)\n            data = r.json()\n            if data.get(\"code\") != 0:\n                raise Exception(f\"BingX error {data.get('code')}: {data.get('msg')}\")\n            return data.get(\"data\")\n        except requests.exceptions.ConnectionError:\n            if base == FALLBACK: raise\n    return None\n\n\ndef bingx_delete(path: str, params: dict = {}):\n    \"\"\"Signed DELETE request with domain fallback.\"\"\"\n    qs = _sign(dict(params))\n    for base in [BASE_URL, FALLBACK]:\n        try:\n            r = requests.delete(f\"{base}{path}?{qs}\", headers=HEADERS, timeout=10)\n            data = r.json()\n            if data.get(\"code\") != 0:\n                raise Exception(f\"BingX error {data.get('code')}: {data.get('msg')}\")\n            return data.get(\"data\")\n        except requests.exceptions.ConnectionError:\n            if base == FALLBACK: raise\n    return None\n```\n\n---\n\n## Account Balance Endpoints\n\nBingX has three separate accounts: Fund, Spot, Swap. Assets don't auto-transfer — query all three to see full picture.\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/openApi/fund/v1/account/balance` | Fund account (deposits land here) |\n| GET | `/openApi/spot/v1/account/balance` | Spot account |\n| GET | `/openApi/swap/v3/user/balance` | Swap/futures account (USDT + USDC) |\n| GET | `/openApi/account/v1/allAccountBalance` | All accounts overview |\n\n## Asset Transfer (between wallets)\n\n`POST /openApi/api/asset/v1/transfer` — signed like any private endpoint (sorted\nquery-string HMAC, params in the URL even on POST, no JSON body). API key needs the\n**Universal Transfer** permission. Live-verified 2026-08 (fund↔spot↔USDTMPerp round\ntrip, balances reflected immediately).\n\n| Param | Required | Notes |\n|---|---|---|\n| `fromAccount` / `toAccount` | yes | `fund` \\| `spot` \\| `USDTMPerp` (USDT-M perp) \\| `stdFutures` \\| `coinMPerp` |\n| `asset` | yes | e.g. `USDT` |\n| `amount` | yes | decimal |\n\nSuccess: `code == 0`, response carries `transferId` (and usually `tranId`).\nDo NOT use the legacy `type`-enum transfer endpoint — it has no fund↔spot direction\n(spot split from fund in 2025) and current docs no longer list it.\n`GET /openApi/api/asset/v1/transfer/supportCoins` lists transferable coins/amounts per direction.\n\n---\n\n## Perpetual Futures (Swap) Endpoints\n\n### Market Data (public — no signature, no API key)\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/openApi/swap/v3/quote/contracts` | All perpetual contracts — the `symbol` ↔ `displayName` mapping |\n| GET | `/openApi/swap/v3/quote/klines` | OHLCV candles (`symbol`, `interval`, `startTime`, `endTime`, `limit`) |\n| GET | `/openApi/swap/v2/quote/price` | Latest price |\n| GET | `/openApi/swap/v2/quote/depth` | Order book |\n\n**Klines — the two things that bite:**\n\n- `interval`: `1m` `3m` `5m` `15m` `30m` `1h` `2h` `4h` `6h` `8h` `12h` `1d` `3d` `1w` `1M`. `startTime`/`endTime` are epoch **milliseconds**.\n- A response is capped at **1000 bars** (measured — not the documented `limit=1440`) and keeps the **newest** end of the requested window, dropping the older side. Rows come back **newest-first**. To fetch a long history, page backwards: set the next request's `endTime` to `oldest_returned_time - 1` and repeat.\n- Errors come back as HTTP 200 with a non-zero `code` in the body — check `body[\"code\"] == 0`, `raise_for_status()` alone will not catch them.\n\n```python\nr = requests.get('https://open-api.bingx.com/openApi/swap/v3/quote/klines',\n                 params={'symbol': 'NCCOGOLD2USD-USDT', 'interval': '1h',\n                         'startTime': start_ms, 'endTime': cursor_ms, 'limit': 1000},\n                 headers={'X-SOURCE-KEY': 'BX-AI-SKILL'}, timeout=30)\nbody = r.json()\nif body['code'] != 0:\n    raise RuntimeError(f\"BingX klines: {body['code']} {body['msg']}\")\n# body['data'] → [{'open','high','low','close','volume','time'}, ...] newest-first\n```\n\nBlave's own `GET /kline` serves **Binance USDT-M perps only**, so a BingX-listed contract that Binance does not carry has to come from here. Do not substitute a similarly-named Binance symbol — that backtests a different instrument than the one the orders go to. In Blave Agent, use `lib/data.py` `fetch_bingx_kline()` rather than calling this endpoint by hand.\n\n### Order Management\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/openApi/swap/v2/trade/order` | Place order |\n| POST | `/openApi/swap/v2/trade/order/test` | Test order (validate only) |\n| POST | `/openApi/swap/v2/trade/batchOrders` | Batch place (up to 5) |\n\n**Place order params:**\n\n| Param | Required | Description |\n|---|---|---|\n| `symbol` | ✓ | e.g. `BTC-USDT` |\n| `side` | ✓ | `BUY` / `SELL` |\n| `positionSide` | ✓ | `LONG` / `SHORT` / `BOTH` (one-way mode) |\n| `type` | ✓ | `MARKET`, `LIMIT`, `STOP_MARKET`, `STOP`, `TAKE_PROFIT_MARKET`, `TAKE_PROFIT`, `TRAILING_STOP_MARKET`, `TRAILING_TP_SL` |\n| `quantity` | ✓ (except market buy) | Order quantity |\n| `price` | for LIMIT | Limit price |\n| `stopPrice` | for STOP/TP | Trigger price |\n| `timeInForce` | — | `GTC` (default), `IOC`, `FOK`, `PostOnly` |\n| `stopLoss` | — | JSON: `{\"type\":\"STOP_MARKET\",\"stopPrice\":\"...\",\"price\":\"...\",\"workingType\":\"...\"}` |\n| `takeProfit` | — | JSON: same structure as stopLoss |\n| `recvWindow` | — | Default 5000ms |\n\n### Cancel Orders\n\n| Method | Path | Description |\n|---|---|---|\n| DELETE | `/openApi/swap/v2/trade/order` | Cancel single order |\n| DELETE | `/openApi/swap/v2/trade/batchOrders` | Batch cancel (up to 10) |\n| DELETE | `/openApi/swap/v2/trade/allOpenOrders` | Cancel all open orders |\n| POST | `/openApi/swap/v2/trade/cancelAllAfter` | Kill switch (auto-cancel after 10-120s) |\n\n### Query Orders\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/openApi/swap/v2/trade/openOrder` | Single open order status |\n| GET | `/openApi/swap/v2/trade/order` | Order details |\n| GET | `/openApi/swap/v2/trade/openOrders` | All current open orders |\n| GET | `/openApi/swap/v2/trade/allOrders` | Order history (max 7-day range) |\n| GET | `/openApi/swap/v2/trade/forceOrders` | Liquidation / force close orders |\n| GET | `/openApi/swap/v2/trade/allFillOrders` | Trade fill history with fees & PnL |\n\n### Position Management\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/openApi/swap/v2/trade/closeAllPositions` | Close all positions |\n| POST | `/openApi/swap/v1/trade/closePosition` | Close position by positionId |\n| POST | `/openApi/swap/v2/trade/positionMargin` | Adjust isolated margin (add/reduce) |\n\n### Leverage & Mode Settings\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/openApi/swap/v2/trade/marginType` | Query margin mode |\n| POST | `/openApi/swap/v2/trade/marginType` | Set margin mode (`ISOLATED`/`CROSSED`/`SEPARATE_ISOLATED`) |\n| GET | `/openApi/swap/v2/trade/leverage` | Query leverage (current + max) |\n| POST | `/openApi/swap/v2/trade/leverage` | Set leverage |\n| GET | `/openApi/swap/v1/positionSide/dual` | Query position mode (hedge/one-way) |\n| POST | `/openApi/swap/v1/positionSide/dual` | Set position mode |\n\n### Order Modification\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/openApi/swap/v1/trade/amend` | Amend open order quantity |\n| POST | `/openApi/swap/v1/trade/cancelReplace` | Cancel and replace (atomic) |\n| POST | `/openApi/swap/v1/trade/batchCancelReplace` | Batch cancel and replace |\n\n### TWAP Orders\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/openApi/swap/v1/twap/order` | Place TWAP order (split into child orders, 5-120s intervals) |\n| POST | `/openApi/swap/v1/twap/cancelOrder` | Cancel TWAP order |\n| GET | `/openApi/swap/v1/twap/openOrders` | Query TWAP open orders |\n| GET | `/openApi/swap/v1/twap/historyOrders` | Query TWAP history |\n| GET | `/openApi/swap/v1/twap/orderDetail` | TWAP order details with child records |\n\n### Additional\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/openApi/swap/v1/trade/fullOrder` | All orders V2 |\n| GET | `/openApi/swap/v2/trade/fillHistory` | Historical transaction details |\n| GET | `/openApi/swap/v1/trade/positionHistory` | Position history (max 3-month) |\n| GET | `/openApi/swap/v1/positionMargin/history` | Isolated margin change history |\n| GET | `/openApi/swap/v1/maintMarginRatio` | Position & maintenance margin ratio |\n| POST | `/openApi/swap/v1/trade/autoAddMargin` | Auto margin addition |\n| POST | `/openApi/swap/v1/trade/reverse` | One-click reverse position |\n| POST | `/openApi/swap/v2/trade/getVst` | Apply VST (paper trading) balance |\n\n---\n\n## Spot Endpoints\n\n### Order Management\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/openApi/spot/v1/trade/order` | Place order (MARKET/LIMIT/STOP types) |\n| POST | `/openApi/spot/v1/trade/batchOrders` | Batch place (up to 5) |\n| POST | `/openApi/spot/v1/trade/cancel` | Cancel single order |\n| POST | `/openApi/spot/v1/trade/cancelOrders` | Bulk cancel |\n| POST | `/openApi/spot/v1/trade/cancelOpenOrders` | Cancel all open orders for a pair |\n| POST | `/openApi/spot/v1/trade/cancelAllAfter` | Kill switch (10-120s timeout) |\n| POST | `/openApi/spot/v1/trade/order/cancelReplace` | Cancel and replace (atomic) |\n\n**Spot order types:** `MARKET`, `LIMIT`, `TAKE_STOP_LIMIT`, `TAKE_STOP_MARKET`, `TRIGGER_LIMIT`, `TRIGGER_MARKET`\n\n**Spot order facts (measured live 2026-08-04):**\n- Client-id param is `newClientOrderId` (the swap API uses `clientOrderID` — different name AND casing)\n- Market BUYs size in quote currency via `quoteOrderQty`; SELLs in base `quantity`\n- Trading rules from public `GET /openApi/spot/v1/common/symbols`: `stepSize`/`tickSize` are SIZES (0.000001), unlike swap's digit counts; gate on `apiStateBuy` + `apiStateSell` + `status == \"1\"`\n- **Asymmetric minimums**: BTC-USDT buy minimum is 0.5 USDT notional but sell minimum is `minQty` 0.0001826 BTC (~$12) — a small buy can create inventory unsellable on its own\n- Placement response may return `status: PENDING` even for market orders — poll `GET /openApi/spot/v1/trade/query` (symbol + orderId) to a terminal state (`FILLED`/`CANCELED`/`FAILED`)\n\n### Query Orders\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/openApi/spot/v1/trade/query` | Single order details |\n| GET | `/openApi/spot/v1/trade/openOrders` | Active orders by pair |\n| GET | `/openApi/spot/v1/trade/historyOrders` | Order history (max 10K results) |\n| GET | `/openApi/spot/v1/trade/myTrades` | Trade fills with commissions |\n| GET | `/openApi/spot/v1/user/commissionRate` | Commission rates (maker/taker) |\n\n### OCO Orders\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/openApi/spot/v1/oco/order` | Create OCO order |\n| POST | `/openApi/spot/v1/oco/cancel` | Cancel OCO order |\n| GET | `/openApi/spot/v1/oco/orderList` | Query OCO order details |\n| GET | `/openApi/spot/v1/oco/openOrderList` | Open OCO orders |\n| GET | `/openApi/spot/v1/oco/historyOrderList` | Historical OCO orders |\n\n---\n\n## Symbol Format\n\n- Perpetual futures: `BTC-USDT` (with hyphen)\n- Spot: `BTC-USDT` (with hyphen)\n\n**The name on the chart is not always the API symbol.** BingX's non-crypto perps have a `displayName` that differs from the `symbol` the API accepts — gold trades as **GOLD(XAU)-USDT** on screen but is `NCCOGOLD2USD-USDT` over the API. When a user names a contract, resolve it through `GET /openApi/swap/v3/quote/contracts` (match on `displayName`, use `symbol`) instead of guessing — and never fall back to a similar-looking symbol from another exchange.\n\n## Notes\n\n- `orderID` (string) is preferred over `orderId` (numeric) for large IDs to avoid precision loss\n- Order history queries have a max 7-day range per request\n- Position history max 3-month span\n- Kill switch countdown: 10-120 seconds, must send heartbeat to reset\n\nFile v1.23.20:references/bingx-skill.md\n\n# BingX Trading\n\n**Base URL:** `https://open-api.bingx.com` | **Fallback:** `https://open-api.bingx.pro` | **Paper (VST):** `https://open-api-vst.bingx.com`\n\n**Spot:** `BTC-USDT` | **Perpetual:** `BTC-USDT` | **Success:** `\"code\": 0`\n\n42 swap endpoints + 17 spot endpoints — full details in `references/bingx-api-reference.md`\n\n## Authentication\n\n**Credentials** (from `.env`): `BINGX_API_KEY`, `BINGX_SECRET_KEY`\n\nNo BingX account? Register at **[https://bingxdao.com/invite/SU0SEU/](https://bingxdao.com/invite/SU0SEU/)**\n\nVerify credentials before any private call. If missing — **STOP**.\n\n**Signature:** `HMAC-SHA256(secret, sorted_params_canonical_string)` → hex, appended as `&signature=<hex>`\n- Collect all params + `timestamp` (Unix ms)\n- Sort alphabetically by key, concatenate as `key=value&key=value`\n\n**Headers (all requests):**\n```\nX-BX-APIKEY: <api_key>\nX-SOURCE-KEY: BX-AI-SKILL\n```\n\n**`X-SOURCE-KEY: BX-AI-SKILL` is MANDATORY on every request — no exceptions.**\n\n> Python signature implementation and helper functions: `references/bingx-api-reference.md`\n\n## Operation Flow\n\n### Step 0: Credential Check\nVerify `BINGX_API_KEY`, `BINGX_SECRET_KEY`. If missing — **STOP**. Default to **Live** unless user explicitly requests paper trading (VST).\n\n### Step 1: Pre-Trade Check (Swap)\n- Query position mode: `GET /openApi/swap/v1/positionSide/dual`\n- Query leverage: `GET /openApi/swap/v2/trade/leverage?symbol=<SYMBOL>`\n- If position exists → inherit leverage and margin type, do NOT override\n\n### Step 2: Execute\n- READ → call, parse, display\n- WRITE → present summary → ask **\"CONFIRM\"** → execute\n\n### Step 3: Verify\nAfter order → query order status. After close → query positions.\n\n## Quick Reference\n\n| Operation | Method | Path |\n|---|---|---|\n| Place swap order | POST | `/openApi/swap/v2/trade/order` |\n| Cancel swap order | DELETE | `/openApi/swap/v2/trade/order` |\n| Open swap orders | GET | `/openApi/swap/v2/trade/openOrders` |\n| Order details | GET | `/openApi/swap/v2/trade/order` |\n| Close all positions | POST | `/openApi/swap/v2/trade/closeAllPositions` |\n| Set leverage | POST | `/openApi/swap/v2/trade/leverage` |\n| Set margin mode | POST | `/openApi/swap/v2/trade/marginType` |\n| Place spot order | POST | `/openApi/spot/v1/trade/order` |\n| Cancel spot order | POST | `/openApi/spot/v1/trade/cancel` |\n| Spot open orders | GET | `/openApi/spot/v1/trade/openOrders` |\n\n## Security\n- WRITE operations require **\"CONFIRM\"**\n- Always show liquidation price before opening leveraged positions\n- \"Not financial advice. Trading carries significant risk of loss.\"\n\n## References\n- `references/bingx-api-reference.md` — 63 endpoints, Python signature, full params\n\n---\n\nFile v1.23.20:references/bitfinex-skill.md\n\n# Bitfinex Trading & Funding\n\n**Base URL:** `https://api.bitfinex.com` (authenticated) | `https://api-pub.bitfinex.com` (public)\n\n**Symbol format:** Trading `tBTCUSD`, `tETHUST` (UST=USDT) | Funding `fUSD`, `fBTC`, `fUST`\n\n**Success:** response array, first element is not `\"error\"` | **Error:** `[\"error\", CODE, \"message\"]`\n\n## Authentication\n\n**Credentials** (from `.env`): `BITFINEX_API_KEY`, `BITFINEX_API_SECRET`\n\nNo Bitfinex account? Register at **[https://www.bitfinex.com/sign-up?refcode=ZZDLtrXMF](https://www.bitfinex.com/sign-up?refcode=ZZDLtrXMF)**\n\nVerify credentials before any private call. If missing — **STOP**.\n\n**Signature:** `HMAC-SHA384` (NOT SHA256)\n\n```python\nimport hmac, hashlib, json, time, requests\n\ndef bfx_request(path, body=None):\n    body = body or {}\n    nonce = str(int(time.time() * 1_000_000))\n    body_json = json.dumps(body)\n    sig_payload = f\"/api/{path}{nonce}{body_json}\"\n    sig = hmac.new(\n        BITFINEX_API_SECRET.encode(),\n        sig_payload.encode(),\n        hashlib.sha384\n    ).hexdigest()\n    headers = {\n        \"bfx-nonce\": nonce,\n        \"bfx-apikey\": BITFINEX_API_KEY,\n        \"bfx-signature\": sig,\n        \"content-type\": \"application/json\",\n    }\n    return requests.post(f\"https://api.bitfinex.com/{path}\",\n                         headers=headers, data=body_json)\n```\n\n**Nonce:** strictly increasing per API key. Use `int(time.time() * 1_000_000)` (microseconds).\n\n## Affiliate Code\n\n**Always include `aff_code` in the `meta` field of every order:**\n\n```json\n{\"meta\": {\"aff_code\": \"ZZDLtrXMF\"}}\n```\n\n5% developer reward on every trade fee. Fixed, does not reduce over time.\n\n## Operation Flow\n\n### Step 0: Credential Check\nVerify `BITFINEX_API_KEY`, `BITFINEX_API_SECRET`. If missing — **STOP**.\n\n### Step 1: Pre-Trade Check\n`POST /v2/auth/r/wallets` → check balance in correct wallet (exchange / margin / funding).\n\n### Step 2: Execute\n- READ → call, parse, display\n- WRITE → present summary → ask **\"CONFIRM\"** → execute\n\n### Step 3: Verify\nAfter order → `POST /v2/auth/r/orders` → confirm status. After funding → `POST /v2/auth/r/funding/offers`.\n\n---\n\n## Wallet Types\n\n| Wallet | Use |\n|---|---|\n| `exchange` | Spot trading |\n| `margin` | Margin trading |\n| `funding` | Lending / borrowing |\n\nTransfer between wallets: `POST /v2/auth/w/transfer`\n\n---\n\n## Order Types\n\n| Type | Description |\n|---|---|\n| `EXCHANGE LIMIT` | Spot limit order |\n| `EXCHANGE MARKET` | Spot market order |\n| `EXCHANGE STOP` | Spot stop order |\n| `EXCHANGE STOP LIMIT` | Spot stop limit |\n| `EXCHANGE TRAILING STOP` | Spot trailing stop |\n| `EXCHANGE FOK` | Spot fill-or-kill |\n| `EXCHANGE IOC` | Spot immediate-or-cancel |\n| `LIMIT` | Margin limit order |\n| `MARKET` | Margin market order |\n| `STOP` | Margin stop |\n| `STOP LIMIT` | Margin stop limit |\n| `TRAILING STOP` | Margin trailing stop |\n\n**\"EXCHANGE\" prefix = spot wallet. No prefix = margin wallet.**\n\n## Order Flags\n\n| Flag | Value | Description |\n|---|---|---|\n| Hidden | 64 | Not visible in order book |\n| Close | 512 | Close existing position |\n| Reduce Only | 1024 | Prevent reversing position |\n| Post Only | 4096 | Add to book only, no immediate match |\n| OCO | 16384 | One-Cancels-Other |\n\nCombine by summing: Hidden + Post Only = `4160`\n\n---\n\n## Key Endpoints — Trading\n\n| Action | Method | Path |\n|---|---|---|\n| Ticker (public) | GET | `/v2/ticker/{Symbol}` |\n| Tickers (public) | GET | `/v2/tickers?symbols=tBTCUSD,tETHUSD` |\n| Candles (public) | GET | `/v2/candles/trade:{TimeFrame}:{Symbol}/hist` |\n| Wallets | POST | `/v2/auth/r/wallets` |\n| Place order | POST | `/v2/auth/w/order/submit` |\n| Update order | POST | `/v2/auth/w/order/update` |\n| Cancel order | POST | `/v2/auth/w/order/cancel` |\n| Cancel all | POST | `/v2/auth/w/order/cancel/multi` body: `{\"all\": 1}` |\n| Active orders | POST | `/v2/auth/r/orders` |\n| Order history | POST | `/v2/auth/r/orders/hist` |\n| Positions | POST | `/v2/auth/r/positions` |\n| Transfer | POST | `/v2/auth/w/transfer` |\n\n### Place Order — Parameters\n\n```json\n{\n  \"type\": \"EXCHANGE LIMIT\",\n  \"symbol\": \"tBTCUSD\",\n  \"amount\": \"0.01\",\n  \"price\": \"50000\",\n  \"flags\": 0,\n  \"meta\": {\"aff_code\": \"ZZDLtrXMF\"}\n}\n```\n\n| Param | Type | Required | Notes |\n|---|---|---|---|\n| type | string | Yes | See order types above |\n| symbol | string | Yes | e.g. `tBTCUSD` |\n| amount | string | Yes | Positive = buy, negative = sell |\n| price | string | Yes* | Not needed for MARKET |\n| flags | int | No | Sum of flag values |\n| lev | int | No | Leverage 1-100 (derivatives only) |\n| price_trailing | string | No | For TRAILING STOP |\n| price_aux_limit | string | No | For STOP LIMIT |\n| price_oco_stop | string | No | OCO stop price |\n| tif | string | No | Auto-cancel time `\"2026-01-15 10:45:23\"` |\n| meta | object | No | `{\"aff_code\": \"ZZDLtrXMF\"}` |\n\n### Cancel Order\n\n```json\n{\"id\": 123456789}\n```\n\nOr by client ID: `{\"cid\": 12345, \"cid_date\": \"2026-04-17\"}`\n\n### Transfer Between Wallets\n\n```json\n{\n  \"from\": \"exchange\",\n  \"to\": \"funding\",\n  \"currency\": \"USD\",\n  \"amount\": \"1000\"\n}\n```\n\n---\n\n## Key Endpoints — Funding (Lending)\n\n| Action | Method | Path |\n|---|---|---|\n| Funding ticker (public) | GET | `/v2/ticker/{fSymbol}` |\n| Submit funding offer | POST | `/v2/auth/w/funding/offer/submit` |\n| Cancel funding offer | POST | `/v2/auth/w/funding/offer/cancel` |\n| Active funding offers | POST | `/v2/auth/r/funding/offers/{Symbol}` |\n| Funding loans (idle) | POST | `/v2/auth/r/funding/loans/{Symbol}` |\n| Funding credits (in use) | POST | `/v2/auth/r/funding/credits/{Symbol}` |\n| Funding info | POST | `/v2/auth/r/info/funding/{key}` |\n\n### Submit Funding Offer — Parameters\n\n```json\n{\n  \"type\": \"LIMIT\",\n  \"symbol\": \"fUSD\",\n  \"amount\": \"1000\",\n  \"rate\": \"0.0002\",\n  \"period\": 2\n}\n```\n\n| Param | Type | Required | Notes |\n|---|---|---|---|\n| type | string | Yes | `LIMIT`, `FRRDELTAVAR`, `FRRDELTAFIX` |\n| symbol | string | Yes | `fUSD`, `fBTC`, `fUST`, etc. |\n| amount | string | Yes | Positive = lend (offer), negative = borrow (bid) |\n| rate | string | Yes | Daily rate, e.g. `\"0.0002\"` = 0.02%/day ≈ 7.3%/yr |\n| period | int | Yes | 2–120 days |\n| flags | int | No | 64 = hidden |\n\n**Funding types:**\n- `LIMIT` — fixed rate\n- `FRRDELTAVAR` — Flash Return Rate + delta (variable, rate adjusts)\n- `FRRDELTAFIX` — Flash Return Rate + delta (fixed after match)\n\n### Cancel Funding Offer\n\n```json\n{\"id\": 987654321}\n```\n\n### Funding Loans vs Credits\n\n- **Loans** (`/funding/loans`) — your lent funds that are NOT currently used in a position\n- **Credits** (`/funding/credits`) — your lent funds that ARE currently used in a position\n\n---\n\n## Response Arrays\n\nBitfinex v2 returns **arrays**, not objects. Key mappings:\n\n### Order Array\n\n| Index | Field | Index | Field |\n|---|---|---|---|\n| 0 | ID | 6 | AMOUNT (remaining) |\n| 3 | SYMBOL | 7 | AMOUNT_ORIG |\n| 4 | MTS_CREATE | 8 | TYPE |\n| 5 | MTS_UPDATE | 13 | STATUS |\n| 17 | PRICE | 18 | PRICE_AVG |\n\n### Wallet Array\n\n| Index | Field |\n|---|---|\n| 0 | WALLET_TYPE (`exchange`/`margin`/`funding`) |\n| 1 | CURRENCY |\n| 2 | BALANCE |\n| 4 | AVAILABLE_BALANCE |\n\n### Position Array\n\n| Index | Field | Index | Field |\n|---|---|---|---|\n| 0 | SYMBOL | 6 | PL |\n| 1 | STATUS | 7 | PL_PERC |\n| 2 | AMOUNT (+long/-short) | 8 | PRICE_LIQ |\n| 3 | BASE_PRICE | 9 | LEVERAGE |\n\n### Funding Offer Array\n\n| Index | Field | Index | Field |\n|---|---|---|---|\n| 0 | ID | 10 | STATUS |\n| 1 | SYMBOL | 14 | RATE |\n| 4 | AMOUNT | 15 | PERIOD |\n| 5 | AMOUNT_ORIG | 19 | RENEW |\n\n---\n\n## Security\n- WRITE operations require **\"CONFIRM\"**\n- Always show liquidation price before opening margin positions\n- \"Not financial advice. Trading carries significant risk of loss.\"\n\n---\n\nFile v1.23.20:references/bitget-api-reference.md\n\n# Bitget API Reference\n\n## Base URL\n\n`https://api.bitget.com`\n\n**Success response:** `\"code\": \"00000\"` — all other codes are errors.\n\n---\n\n## Authentication\n\n**Credentials** (from `.env`): `BITGET_API_KEY`, `BITGET_SECRET_KEY`, `BITGET_PASSPHRASE`\n\n**Signature:** `Base64(HMAC-SHA256(secret, timestamp + METHOD + path + body))`\n- `timestamp`: Unix milliseconds\n- GET body = `\"\"`\n- POST body = compact JSON\n\n**Headers (authenticated requests):**\n```\nACCESS-KEY: <api_key>\nACCESS-SIGN: <base64 signature>\nACCESS-PASSPHRASE: <passphrase>\nACCESS-TIMESTAMP: <unix ms>\nContent-Type: application/json\nlocale: en-US\n```\n\n---\n\n## Python Signature Implementation\n\n```python\nimport time, hmac, hashlib, base64, json, os, requests\nfrom dotenv import dotenv_values\n\n_env        = dotenv_values()\nAPI_KEY     = _env[\"BITGET_API_KEY\"]\nSECRET_KEY  = _env[\"BITGET_SECRET_KEY\"]\nPASSPHRASE  = _env[\"BITGET_PASSPHRASE\"]\nBASE_URL    = \"https://api.bitget.com\"\n\n\ndef _sign(ts, method, path, body_str=\"\"):\n    msg = f\"{ts}{method}{path}{body_str}\"\n    mac = hmac.new(SECRET_KEY.encode(), msg.encode(), hashlib.sha256).digest()\n    return base64.b64encode(mac).decode()\n\n\ndef _headers(method, path, body_str=\"\"):\n    ts = str(int(time.time() * 1000))\n    return {\n        \"ACCESS-KEY\": API_KEY,\n        \"ACCESS-SIGN\": _sign(ts, method, path, body_str),\n        \"ACCESS-PASSPHRASE\": PASSPHRASE,\n        \"ACCESS-TIMESTAMP\": ts,\n        \"Content-Type\": \"application/json\",\n        \"locale\": \"en-US\",\n    }\n\n\ndef bitget_get(path, params=None):\n    qs = \"\"\n    if params:\n        qs = \"?\" + \"&\".join(f\"{k}={v}\" for k, v in params.items())\n    h = _headers(\"GET\", path + qs)\n    r = requests.get(f\"{BASE_URL}{path}\", params=params, headers=h, timeout=10)\n    data = r.json()\n    if data.get(\"code\") != \"00000\":\n        raise Exception(f\"Bitget error {data.get('code')}: {data.get('msg')}\")\n    return data.get(\"data\")\n\n\ndef bitget_post(path, body=None):\n    body_str = json.dumps(body, separators=(\",\", \":\")) if body else \"\"\n    h = _headers(\"POST\", path, body_str)\n    r = requests.post(f\"{BASE_URL}{path}\", data=body_str, headers=h, timeout=10)\n    data = r.json()\n    if data.get(\"code\") != \"00000\":\n        raise Exception(f\"Bitget error {data.get('code')}: {data.get('msg')}\")\n    return data.get(\"data\")\n```\n\n---\n\n## Account Balance\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/api/v2/spot/account/assets` | Spot balances |\n| GET | `/api/v2/mix/account/accounts` | Futures account info (`productType` required: `USDT-FUTURES`, `USDC-FUTURES`, `COIN-FUTURES`) |\n| GET | `/api/v2/account/funding-assets` | Funding account assets |\n| GET | `/api/v2/account/all-account-balance` | All accounts overview |\n\n---\n\n## Spot Endpoints\n\n### Market Data (Public)\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/api/v2/spot/market/tickers` | Ticker (`symbol` optional — omit for all) |\n| GET | `/api/v2/spot/market/orderbook` | Orderbook (`symbol` required, `type`=step0-5) |\n| GET | `/api/v2/spot/market/candles` | Kline (`symbol`, `granularity`, `startTime`, `endTime`) |\n| GET | `/api/v2/spot/market/trades` | Recent trades |\n| GET | `/api/v2/spot/public/symbols` | Symbol info |\n\n### Trading (Private)\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v2/spot/trade/place-order` | Place order |\n| POST | `/api/v2/spot/trade/batch-orders` | Batch place orders |\n| POST | `/api/v2/spot/trade/cancel-order` | Cancel order |\n| POST | `/api/v2/spot/trade/batch-cancel-order` | Batch cancel |\n| POST | `/api/v2/spot/trade/cancel-symbol-order` | Cancel all for symbol |\n| POST | `/api/v2/spot/trade/cancel-replace-order` | Atomic modify order |\n| GET | `/api/v2/spot/trade/orderInfo` | Order details |\n| GET | `/api/v2/spot/trade/unfilled-orders` | Open orders |\n| GET | `/api/v2/spot/trade/history-orders` | Order history |\n| GET | `/api/v2/spot/trade/fills` | Execution fills |\n\n**Spot order params:** `symbol`, `side` (buy/sell), `orderType` (limit/market), `price`, `size`, `force` (gtc/ioc/fok/post_only)\n\n### Plan Orders (Private)\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v2/spot/trade/place-plan-order` | Create trigger order |\n| POST | `/api/v2/spot/trade/modify-plan-order` | Modify trigger order |\n| POST | `/api/v2/spot/trade/cancel-plan-order` | Cancel trigger order |\n| POST | `/api/v2/spot/trade/batch-cancel-plan-order` | Batch cancel triggers |\n| GET | `/api/v2/spot/trade/current-plan-order` | Open plan orders |\n| GET | `/api/v2/spot/trade/history-plan-order` | Plan order history |\n\n---\n\n## Futures (Mix) Endpoints\n\n### Market Data (Public)\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/api/v2/mix/market/tickers` | All futures tickers (`productType` required) |\n| GET | `/api/v2/mix/market/ticker` | Single futures ticker (`symbol` + `productType`) |\n| GET | `/api/v2/mix/market/depth` | Orderbook (`symbol`, `limit`) |\n| GET | `/api/v2/mix/market/candles` | Kline (trade/index/mark price types) |\n| GET | `/api/v2/mix/market/trades` | Recent trades |\n| GET | `/api/v2/mix/market/current-fund-rate` | Current funding rate (`symbol`, `productType`); response is array, use `data[0].fundingRate` |\n| GET | `/api/v2/mix/market/open-interest` | Open interest |\n\n### Trading (Private)\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v2/mix/order/place-order` | Place order |\n| POST | `/api/v2/mix/order/batch-place-order` | Batch place (max 50) |\n| POST | `/api/v2/mix/order/modify-order` | Modify order (size, price, TP/SL) |\n| POST | `/api/v2/mix/order/cancel-order` | Cancel order |\n| POST | `/api/v2/mix/order/batch-cancel-orders` | Batch cancel |\n| POST | `/api/v2/mix/order/cancel-all-orders` | Cancel all |\n| GET | `/api/v2/mix/order/detail` | Order details |\n| GET | `/api/v2/mix/order/orders-pending` | Open orders |\n| GET | `/api/v2/mix/order/orders-history` | Order history |\n| GET | `/api/v2/mix/order/fills` | Fills |\n| GET | `/api/v2/mix/order/fill-history` | Fill history |\n\n**Futures order params:** `symbol`, `productType` (USDT-FUTURES/USDC-FUTURES/COIN-FUTURES), `side` (buy/sell), `tradeSide` (open/close), `orderType` (limit/market), `price`, `size`, `marginCoin`, `leverage`\n\n### Position Management (Private)\n\n| Method | Path | Description |\n|---|---|---|\n| GET | `/api/v2/mix/position/single-position` | Single position |\n| GET | `/api/v2/mix/position/all-position` | All positions |\n| GET | `/api/v2/mix/position/history-position` | Position history |\n\n### Configuration (Private)\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v2/mix/account/set-leverage` | Set leverage |\n| POST | `/api/v2/mix/account/set-margin-mode` | Set margin mode (crossed/isolated) |\n| POST | `/api/v2/mix/account/set-position-mode` | Set position mode |\n| POST | `/api/v2/mix/account/set-auto-margin` | Auto margin addition |\n\n---\n\n## Transfers\n\n| Method | Path | Description |\n|---|---|---|\n| POST | `/api/v2/spot/wallet/transfer` | Internal transfer between accounts |\n| POST | `/api/v2/spot/wallet/subaccount-transfer` | Transfer to subaccount |\n\n---\n\n## Symbol Format\n\n- Spot: `BTCUSDT`\n- Futures: `BTCUSDT` with `productType=USDT-FUTURES`\n\n## Rate Limits\n\n- Public: 10-20 req/s per IP\n- Private: 5-10 req/s per UID\n- Configuration: 5 req/s per UID\n\nFile v1.23.20:references/bitget-skill.md\n\n# Bitget Trading\n\n**Base URL:** `https://api.bitget.com` | **Spot:** `BTCUSDT` | **Futures:** `BTCUSDT` + `productType=USDT-FUTURES` | **Success:** `\"code\": \"00000\"`\n\nFull details in `references/bitget-api-reference.md`\n\n## Authentication\n\n**Credentials** (from `.env`): `BITGET_API_KEY`, `BITGET_SECRET_KEY`, `BITGET_PASSPHRASE`\n\nNo Bitget account? Register at **[https://www.bitget.com/](https://www.bitget.com/)**\n\nVerify credentials before any private call. If missing — **STOP**.\n\n**Signature:** `Base64(HMAC-SHA256(secret, timestamp + METHOD + path + body))`\n- `timestamp`: Unix milliseconds\n- GET body = `\"\"`\n- POST body = compact JSON (no spaces)\n\n**Headers (authenticated requests):**\n```\nACCESS-KEY: <api_key>\nACCESS-SIGN: <base64 signature>\nACCESS-PASSPHRASE: <passphrase>\nACCESS-TIMESTAMP: <unix ms>\nContent-Type: application/json\nlocale: en-US\n```\n\n> Python signature implementation: `references/bitget-api-reference.md`\n\n## Operation Flow\n\n### Step 0: Credential Check\nVerify `BITGET_API_KEY`, `BITGET_SECRET_KEY`, `BITGET_PASSPHRASE`. If missing — **STOP**.\n\n### Step 1: Pre-Trade Check (Futures)\n- Query positions: `GET /api/v2/mix/position/all-position?productType=USDT-FUTURES`\n- If position exists → inherit leverage and margin mode, do NOT override\n\n### Step 2: Execute\n- READ → call, parse, display\n- WRITE → present summary → ask **\"CONFIRM\"** → execute\n\n### Step 3: Verify\nAfter order → query order status. After close → query positions.\n\n## Quick Reference\n\n| Operation | Method | Path |\n|---|---|---|\n| Spot balances | GET | `/api/v2/spot/account/assets` |\n| Futures account | GET | `/api/v2/mix/account/accounts?productType=USDT-FUTURES` |\n| All balances | GET | `/api/v2/account/all-account-balance` |\n| Place spot order | POST | `/api/v2/spot/trade/place-order` |\n| Cancel spot order | POST | `/api/v2/spot/trade/cancel-order` |\n| Spot open orders | GET | `/api/v2/spot/trade/unfilled-orders` |\n| Place futures order | POST | `/api/v2/mix/order/place-order` |\n| Cancel futures order | POST | `/api/v2/mix/order/cancel-order` |\n| Futures positions | GET | `/api/v2/mix/position/all-position` |\n| Set leverage | POST | `/api/v2/mix/account/set-leverage` |\n| Set margin mode | POST | `/api/v2/mix/account/set-margin-mode` |\n| Spot ticker | GET | `/api/v2/spot/market/tickers` |\n| Futures ticker | GET | `/api/v2/mix/market/ticker` |\n\n## Security\n- WRITE operations require **\"CONFIRM\"**\n- Always show liquidation price before opening leveraged positions\n- \"Not financial advice. Trading carries significant risk of loss.\"\n\n## References\n- `references/bitget-api-reference.md` — spot + futures endpoints, Python signature\n\n---\n\nFile v1.23.20:references/bitmart-api-reference.md\n\n# BitMart Futures API Reference\n\n> Complete reference for all 53 futures endpoints. See [SKILL.md](../SKILL.md) for authentication, routing, and quickstart.\n\n> **Credentials:** Read from `.env` — `BITMART_API_KEY`, `BITMART_API_SECRET`, `BITMART_API_MEMO`.\n\n> **IMPORTANT:** Always include `X-BM-BROKER-ID: BlaveData666666` on **every** request (NONE / KEYED / SIGNED). This is required for broker fee tracking.\n\n---\n\n## Market Data Endpoints (NONE auth)\n\n### 1. Contract Details\n\n`GET /contract/public/details`\n\n**Rate Limit:** 12 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol, e.g. `BTCUSDT`. Omit for all contracts |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/details?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"symbols\": [{\n      \"symbol\": \"BTCUSDT\",\n      \"product_type\": 1,\n      \"open_timestamp\": 1594080000000,\n      \"expire_timestamp\": 0,\n      \"settle_timestamp\": 0,\n      \"base_currency\": \"BTC\",\n      \"quote_currency\": \"USDT\",\n      \"last_price\": \"67123.4\",\n      \"volume_24h\": \"123456789\",\n      \"turnover_24h\": \"8234567890.12\",\n      \"index_price\": \"67120.5\",\n      \"index_name\": \"BTCUSDT\",\n      \"contract_size\": \"0.001\",\n      \"min_leverage\": \"1\",\n      \"max_leverage\": \"100\",\n      \"price_precision\": \"0.1\",\n      \"vol_precision\": \"1\",\n      \"max_volume\": \"1000000\",\n      \"market_max_volume\": \"50000\",\n      \"min_volume\": \"1\",\n      \"funding_rate\": \"0.0001\",\n      \"expected_funding_rate\": \"0.0001\",\n      \"open_interest\": \"12345678\",\n      \"open_interest_value\": \"823456789.12\",\n      \"high_24h\": \"68000.0\",\n      \"low_24h\": \"66500.0\",\n      \"change_24h\": \"0.015\",\n      \"funding_interval_hours\": 8,\n      \"funding_time\": 1773158400000,\n      \"status\": \"Trading\",\n      \"delist_time\": 0\n    }]\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| product_type | 1 = perpetual, 2 = futures |\n| open_timestamp | Contract listing timestamp (ms) |\n| expire_timestamp | Expiry timestamp (0 for perpetual) |\n| base_currency | Base currency (e.g. BTC) |\n| quote_currency | Quote currency (e.g. USDT) |\n| last_price | Last trade price |\n| volume_24h | 24h volume in contracts |\n| turnover_24h | 24h turnover in quote currency |\n| index_price | Current index price |\n| contract_size | Size of one contract in base currency |\n| min_leverage / max_leverage | Leverage range |\n| price_precision | Minimum price tick |\n| vol_precision | Minimum volume tick |\n| max_volume | Maximum order volume |\n| market_max_volume | Maximum market order volume |\n| min_volume | Minimum order volume |\n| funding_rate | Current funding rate |\n| expected_funding_rate | Next expected funding rate |\n| open_interest | Total open interest (contracts) |\n| open_interest_value | Total open interest (quote currency) |\n| high_24h / low_24h | 24h high / low |\n| change_24h | 24h price change ratio |\n| funding_interval_hours | Funding interval in hours |\n| funding_time | Next funding settlement timestamp (ms) |\n| status | Contract status: `\"Trading\"` or `\"Delisted\"` |\n\n**Live verification (2026-03-13):** `GET /contract/public/details` returns both `vol_precision` and `funding_time` in JSON data. Official field-table text that says `volume_precision` is inconsistent with live payload.\n\n**Important:** Always check `contract_size`, `min_volume`, `max_volume`, `price_precision`, and `max_leverage` before placing orders.\n\n---\n\n### 2. Order Book Depth\n\n`GET /contract/public/depth`\n\n**Rate Limit:** 12 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/depth?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"asks\": [[\"67125.0\", \"150\", \"150\"], [\"67130.0\", \"320\", \"470\"]],\n    \"bids\": [[\"67120.0\", \"200\", \"200\"], [\"67115.0\", \"180\", \"380\"]],\n    \"symbol\": \"BTCUSDT\",\n    \"timestamp\": 1709971200000\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| asks | Ask levels `[price, volume, cumulative_volume]`, sorted ascending |\n| bids | Bid levels `[price, volume, cumulative_volume]`, sorted descending |\n| symbol | Contract symbol |\n| timestamp | Timestamp (ms) |\n\n---\n\n### 3. Recent Market Trades\n\n`GET /contract/public/market-trade`\n\n**Rate Limit:** 12 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n| limit | Long | No | Number of trades, default 50, max 100 |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/market-trade?symbol=BTCUSDT&limit=5'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"Ok\",\n  \"data\": [\n    {\n      \"symbol\": \"BTCUSDT\",\n      \"price\": \"67123.4\",\n      \"qty\": \"1.506\",\n      \"quote_qty\": \"101127.7404\",\n      \"time\": 1709971200,\n      \"is_buyer_maker\": false\n    }\n  ]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| price | Trade price |\n| qty | Trade quantity |\n| quote_qty | Quote currency amount (`price * qty`) |\n| time | Trade timestamp (seconds) |\n| is_buyer_maker | `true` if buyer is maker, `false` if taker |\n\n---\n\n### 4. Current Funding Rate\n\n`GET /contract/public/funding-rate`\n\n**Rate Limit:** 12 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/funding-rate?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"symbol\": \"BTCUSDT\",\n    \"rate_value\": \"0.0001\",\n    \"expected_rate\": \"0.00012\",\n    \"funding_time\": 1709971200000,\n    \"funding_upper_limit\": \"0.003\",\n    \"funding_lower_limit\": \"-0.003\",\n    \"timestamp\": 1709971200000\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| rate_value | Current funding rate |\n| expected_rate | Next expected funding rate |\n| funding_time | Next funding settlement time (ms) |\n| funding_upper_limit | Funding rate upper limit |\n| funding_lower_limit | Funding rate lower limit |\n| timestamp | Timestamp (ms) |\n\n---\n\n### 5. Funding Rate History\n\n`GET /contract/public/funding-rate-history`\n\n**Rate Limit:** 12 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n| limit | String | No | Records per page, default 100, max 100 |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/funding-rate-history?symbol=BTCUSDT&limit=5'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"list\": [{\n      \"symbol\": \"BTCUSDT\",\n      \"funding_rate\": \"0.0001\",\n      \"funding_time\": 1709971200000\n    }]\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| funding_rate | Funding rate at settlement |\n| funding_time | Settlement timestamp (ms) |\n\n---\n\n### 6. K-Line / Candlestick\n\n`GET /contract/public/kline`\n\n**Rate Limit:** 12 req/2sec per IP | **Max Records:** 500 per request\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n| step | Long | No | Interval in minutes: 1, 3, 5, 15, 30, 60, 120, 240, 360, 720, 1440, 4320, 10080 (default 1) |\n| start_time | Long | Yes | Start timestamp in **seconds** |\n| end_time | Long | Yes | End timestamp in **seconds** |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/kline?symbol=BTCUSDT&step=60&start_time=1709942400&end_time=1709971200'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"timestamp\": 1709971200,\n    \"open_price\": \"67100.0\",\n    \"high_price\": \"67200.0\",\n    \"low_price\": \"67050.0\",\n    \"close_price\": \"67123.4\",\n    \"volume\": \"12345\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| timestamp | Candle open time in seconds |\n| open_price | Open price |\n| high_price | High price |\n| low_price | Low price |\n| close_price | Close price |\n| volume | Volume in contracts |\n\n---\n\n### 7. Mark Price K-Line\n\n`GET /contract/public/markprice-kline`\n\n**Rate Limit:** 12 req/2sec per IP | **Max Records:** 500 per request\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n| step | Long | No | Interval in minutes (same values as kline) |\n| start_time | Long | Yes | Start timestamp in **seconds** |\n| end_time | Long | Yes | End timestamp in **seconds** |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/markprice-kline?symbol=BTCUSDT&step=60&start_time=1709942400&end_time=1709971200'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"timestamp\": 1709971200,\n    \"open_price\": \"67098.5\",\n    \"high_price\": \"67198.0\",\n    \"low_price\": \"67048.2\",\n    \"close_price\": \"67120.5\",\n    \"volume\": \"0\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| timestamp | Candle open time in seconds |\n| open_price | Mark price open |\n| high_price | Mark price high |\n| low_price | Mark price low |\n| close_price | Mark price close |\n| volume | Volume (typically 0 for mark price klines) |\n\n---\n\n### 8. Open Interest\n\n`GET /contract/public/open-interest`\n\n**Rate Limit:** 2 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/open-interest?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"symbol\": \"BTCUSDT\",\n    \"open_interest\": \"12345678\",\n    \"open_interest_value\": \"823456789.12\",\n    \"timestamp\": 1709971200000\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| open_interest | Total open interest (contracts) |\n| open_interest_value | Total open interest (quote currency) |\n| timestamp | Timestamp (ms) |\n\n---\n\n### 9. Leverage Brackets / Risk Limits\n\n`GET /contract/public/leverage-bracket`\n\n**Rate Limit:** 12 req/2sec per IP\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol, e.g. `BTCUSDT`. Omit for all |\n\n```bash\ncurl -s -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/public/leverage-bracket?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"rules\": [{\n      \"symbol\": \"BTCUSDT\",\n      \"brackets\": [{\n        \"bracket\": 1,\n        \"initial_leverage\": 100,\n        \"notional_cap\": \"500000\",\n        \"notional_floor\": \"0\",\n        \"maint_margin_ratio\": \"0.004\",\n        \"cum\": \"0\"\n      }]\n    }]\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| bracket | Bracket tier number |\n| initial_leverage | Maximum leverage at this tier |\n| notional_cap | Upper bound of notional value |\n| notional_floor | Lower bound of notional value |\n| maint_margin_ratio | Maintenance margin rate |\n| cum | Cumulative value |\n\n**Important:** Higher position sizes require lower leverage. Check brackets before setting leverage to avoid rejection.\n\n---\n\n## Account Endpoints (KEYED auth)\n\n### 10. Futures Account Balance\n\n`GET /contract/private/assets-detail`\n\n**Rate Limit:** 12 req/2sec per KEY\n\n**Parameters:** None\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/assets-detail'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"currency\": \"USDT\",\n    \"available_balance\": \"50000.00\",\n    \"frozen_balance\": \"5000.00\",\n    \"position_deposit\": \"10000.00\",\n    \"equity\": \"65000.00\",\n    \"unrealized\": \"0.00\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| currency | Currency symbol |\n| available_balance | Available balance for trading |\n| frozen_balance | Frozen balance (in open orders) |\n| position_deposit | Margin used by positions |\n| equity | Total equity (balance + unrealized PnL) |\n| unrealized | Unrealized profit/loss |\n\n---\n\n### 11. Trade Fee Rate\n\n`GET /contract/private/trade-fee-rate`\n\n**Rate Limit:** 2 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/trade-fee-rate?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"symbol\": \"BTCUSDT\",\n    \"taker_fee_rate\": \"0.0006\",\n    \"maker_fee_rate\": \"0.0002\"\n  }\n}\n```\n\n---\n\n### 12. Current Positions\n\n`GET /contract/private/position`\n\n**Rate Limit:** 6 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol. Omit for all positions |\n| account | String | No | `\"futures\"` (default) or `\"copy_trading\"` |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/position?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"symbol\": \"BTCUSDT\",\n    \"leverage\": \"10\",\n    \"timestamp\": 1709971200000,\n    \"current_fee\": \"12.50\",\n    \"open_timestamp\": 1709942400000,\n    \"current_value\": \"6712.34\",\n    \"mark_price\": \"67123.4\",\n    \"mark_value\": \"6712.34\",\n    \"position_value\": \"6700.00\",\n    \"position_cross\": \"100\",\n    \"maintenance_margin\": \"26.80\",\n    \"margin_type\": \"Cross\",\n    \"position_mode\": \"hedge_mode\",\n    \"close_vol\": \"0\",\n    \"close_avg_price\": \"0\",\n    \"open_avg_price\": \"67000.0\",\n    \"entry_price\": \"67000.0\",\n    \"current_amount\": \"100\",\n    \"unrealized_value\": \"12.34\",\n    \"realized_value\": \"0\",\n    \"position_type\": 1,\n    \"account\": \"futures\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| leverage | Current leverage |\n| mark_price | Current mark price |\n| position_value | Position value in quote currency |\n| entry_price | Average entry price |\n| current_amount | Position size (contracts) |\n| unrealized_value | Unrealized PnL |\n| realized_value | Realized PnL |\n| position_type | 1 = long, 2 = short |\n| margin_type | `\"Cross\"` or `\"Isolated\"` |\n| position_mode | `\"hedge_mode\"` or `\"one_way_mode\"` |\n| current_fee | Accumulated fees |\n| close_vol | Closed volume |\n| close_avg_price | Average close price |\n| current_value | Current value based on mark price |\n| maintenance_margin | Maintenance margin |\n| account | Account type |\n\n---\n\n### 13. Positions V2 (Extended Info)\n\n`GET /contract/private/position-v2`\n\n**Rate Limit:** 6 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol. Without symbol returns only positions with holdings; with symbol returns all positions |\n| account | String | No | `\"futures\"` (default) or `\"copy_trading\"` |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/position-v2?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"symbol\": \"BTCUSDT\",\n    \"leverage\": \"10\",\n    \"position_amount\": \"100\",\n    \"position_side\": \"long\",\n    \"entry_price\": \"67000.0\",\n    \"mark_price\": \"67123.4\",\n    \"liquidation_price\": \"60500.0\",\n    \"unrealized_pnl\": \"12.34\",\n    \"initial_margin\": \"670.00\",\n    \"maintenance_margin\": \"26.80\",\n    \"position_value\": \"6712.34\",\n    \"open_type\": \"cross\",\n    \"max_notional_value\": \"500000\",\n    \"timestamp\": 1709971200000,\n    \"current_fee\": \"12.50\",\n    \"open_timestamp\": 1709942400000,\n    \"current_value\": \"6712.34\",\n    \"close_vol\": \"0\",\n    \"close_avg_price\": \"0\",\n    \"open_avg_price\": \"67000.0\",\n    \"current_amount\": \"100\",\n    \"realized_value\": \"0\",\n    \"mark_value\": \"6712.34\",\n    \"account\": \"futures\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| position_side | `\"both\"`, `\"long\"`, or `\"short\"` |\n| liquidation_price | Estimated liquidation price |\n| unrealized_pnl | Unrealized profit/loss |\n| initial_margin | Initial margin used |\n| maintenance_margin | Maintenance margin required |\n| current_amount | Current position size (contracts, string, always ≥ 0). **Use this field to determine whether a position exists** (parse as number, check ≠ 0) |\n| position_amount | Current position direction amount (hedge mode: always positive; one-way mode: positive=long, negative=short) |\n| open_type | `\"cross\"` or `\"isolated\"` |\n| max_notional_value | Maximum notional value for current leverage |\n| *(other fields same as endpoint 12)* | |\n\n---\n\n### 14. Position Risk\n\n`GET /contract/private/position-risk`\n\n**Rate Limit:** 24 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol. Omit for all positions |\n| account | String | No | `\"futures\"` (default) or `\"copy_trading\"` |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/position-risk?symbol=BTCUSDT'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"symbol\": \"BTCUSDT\",\n    \"position_amt\": \"100\",\n    \"mark_price\": \"67123.4\",\n    \"unrealized_profit\": \"12.34\",\n    \"liquidation_price\": \"60500.0\",\n    \"leverage\": \"10\",\n    \"max_notional_value\": \"500000\",\n    \"margin_type\": \"cross\",\n    \"isolated_margin\": \"0\",\n    \"position_side\": \"Long\",\n    \"notional\": \"6712.34\",\n    \"update_time\": 1709971200000,\n    \"account\": \"futures\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| position_amt | Position size |\n| mark_price | Current mark price |\n| unrealized_profit | Unrealized PnL |\n| liquidation_price | Estimated liquidation price |\n| leverage | Current leverage |\n| max_notional_value | Max notional value |\n| margin_type | `\"cross\"` or `\"isolated\"` |\n| isolated_margin | Isolated margin amount |\n| position_side | `\"Long\"` or `\"Short\"` |\n| notional | Position notional value |\n\n---\n\n### 15. Get Position Mode\n\n`GET /contract/private/get-position-mode`\n\n**Rate Limit:** 2 req/2sec per KEY\n\n**Parameters:** None\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/get-position-mode'\n```\n\n**Live verification (2026-03-13):** KEYED request (only `X-BM-KEY`) and SIGNED request both returned `code=1000`. Use KEYED as the minimum required auth level.\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"position_mode\": \"hedge_mode\"\n  }\n}\n```\n\n---\n\n### 16. Transaction History\n\n`GET /contract/private/transaction-history`\n\n**Rate Limit:** 6 req/2sec per KEY | **Default Range:** Last 7 days\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol |\n| flow_type | Int | No | 0=All, 1=Transfer, 2=Realized PNL, 3=Funding Fee, 4=Commission, 5=Liquidation |\n| account | String | No | `\"futures\"` (default) or `\"copy_trading\"` |\n| start_time | Long | No | Start timestamp in **milliseconds** |\n| end_time | Long | No | End timestamp in **milliseconds** |\n| page_size | Int | No | Page size, 1-1000, default 100 |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/transaction-history?symbol=BTCUSDT&flow_type=2&page_size=10'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": [{\n    \"symbol\": \"BTCUSDT\",\n    \"flow_type\": 2,\n    \"type\": \"Realized PNL\",\n    \"amount\": \"12.34\",\n    \"asset\": \"USDT\",\n    \"account\": \"futures\",\n    \"time\": 1709971200000,\n    \"tran_id\": \"123456789\"\n  }]\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| symbol | Contract symbol |\n| flow_type | Numeric transaction type code: 0=All, 1=Transfer, 2=Realized PNL, 3=Funding Fee, 4=Commission, 5=Liquidation |\n| type | Transaction type: Transfer, Realized PNL, Funding Fee, Commission Fee, Liquidation Clearance |\n| amount | Transaction amount (negative = outflow) |\n| asset | Currency |\n| account | Account type |\n| time | Transaction timestamp (ms) |\n| tran_id | Transaction ID |\n\n---\n\n## Trading Endpoints (SIGNED auth)\n\n### 17. Place Order\n\n`POST /contract/private/submit-order`\n\n**Rate Limit:** 24 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n| side | Int | Yes | 1=buy_open_long, 2=buy_close_short, 3=sell_close_long, 4=sell_open_short |\n| type | String | No | `\"limit\"` (default) or `\"market\"` |\n| price | String | Conditional | Order price. **Required for `type=limit`; do NOT send for `type=market`** (ignored and causes confusion) |\n| size | Int | Yes | Order quantity (number of contracts, integer) |\n| leverage | String | Conditional | Leverage multiplier (e.g. `\"10\"`). **Required for opening positions (side=1 or 4)**; ignored for closing (side=2 or 3). If an open position already exists, you MUST use the existing position's leverage (see Step 1.5). |\n| open_type | String | Conditional | `\"cross\"` or `\"isolated\"`. **Required for opening positions (side=1 or 4)**; ignored for closing (side=2 or 3). If an open position already exists, you MUST use the existing position's `open_type`. |\n| mode | Int | No | 1=GTC (default), 2=FOK, 3=IOC, 4=Maker Only. **`mode=4` (Maker Only) is NOT valid with `type=market`** — use only with `type=limit`. |\n| client_order_id | String | No | Client-defined order ID (1-32 chars, alphanumeric) |\n| stp_mode | Int | No | Self-trade prevention: 1=Cancel Maker (default), 2=Cancel Taker, 3=Cancel Both |\n| preset_take_profit_price_type | Int | No | 1=Last Price (default), 2=Mark Price. **Only applies to opening orders (side=1 or 4).** |\n| preset_stop_loss_price_type | Int | No | 1=Last Price (default), 2=Mark Price. **Only applies to opening orders (side=1 or 4).** |\n| preset_take_profit_price | String | No | Inline preset TP price on this order. **Only applies to opening orders (side=1 or 4).** For TP/SL on an existing position, use `submit-tp-sl-order` instead. |\n| preset_stop_loss_price | String | No | Inline preset SL price on this order. **Only applies to opening orders (side=1 or 4).** For TP/SL on an existing position, use `submit-tp-sl-order` instead. |\n\n**Example — Market open long:**\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"side\":1,\"type\":\"market\",\"size\":1,\"leverage\":\"10\",\"open_type\":\"cross\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Example — Limit open short with preset TP/SL:**\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"side\":4,\"type\":\"limit\",\"price\":\"70000\",\"size\":10,\"leverage\":\"20\",\"open_type\":\"isolated\",\"mode\":1,\"preset_take_profit_price\":\"68000\",\"preset_stop_loss_price\":\"72000\",\"preset_take_profit_price_type\":1,\"preset_stop_loss_price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"message\": \"OK\",\n  \"data\": {\n    \"order_id\": 23456789012345678,\n    \"price\": \"70000\"\n  }\n}\n```\n\n---\n\n### 18. Cancel Order\n\n`POST /contract/private/cancel-order`\n\n**Rate Limit:** 40 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol, e.g. `BTCUSDT` |\n| order_id | String | No | Order ID (provide order_id or client_order_id) |\n| client_order_id | String | No | Client order ID (provide order_id or client_order_id) |\n\n**Note:** If neither `order_id` nor `client_order_id` is provided, cancels all orders for the symbol.\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":\"23456789012345678\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/cancel-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:** `{ \"code\": 1000, \"data\": {} }`\n\n---\n\n### 19. Batch Cancel Orders\n\n`POST /contract/private/cancel-orders`\n\n**Rate Limit:** 2 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol. Cancels all open orders for this symbol |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/cancel-orders' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:** `{ \"code\": 1000, \"data\": {} }`\n\n---\n\n### 20. Modify Limit Order\n\n`POST /contract/private/modify-limit-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | Int | Conditional | Order ID (required if no client_order_id) |\n| client_order_id | String | Conditional | Client order ID (required if no order_id) |\n| price | String | No | New price (at least one of price/size required) |\n| size | Int | No | New size (at least one of price/size required) |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":23456789012345678,\"price\":\"66500\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/modify-limit-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": 23456789012345678, \"client_order_id\": \"\" } }\n```\n\n---\n\n### 21. Cancel All After (Timed Cancel)\n\n`POST /contract/private/cancel-all-after`\n\n**Rate Limit:** 4 req/2sec per UID\n\nSets a countdown timer. When the timer expires, all open orders for the specified symbol are canceled. Useful as a dead-man switch.\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| timeout | Int | Yes | Timeout in seconds (minimum 5, set to 0 to disable) |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"timeout\":60}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/cancel-all-after' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"result\": true, \"set_time\": 1709971200, \"cancel_time\": 1709971260 } }\n```\n\n---\n\n### 22. Set Leverage\n\n`POST /contract/private/submit-leverage`\n\n**Rate Limit:** 24 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| leverage | String | No | Leverage multiplier (e.g. `\"10\"`) |\n| open_type | String | Yes | `\"cross\"` or `\"isolated\"` |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"leverage\":\"20\",\"open_type\":\"cross\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-leverage' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"symbol\": \"BTCUSDT\", \"leverage\": \"20\", \"open_type\": \"cross\", \"max_value\": \"500000\" } }\n```\n\n**Important:** You cannot change leverage while there is an open position with a different margin type.\n\n---\n\n### 23. Set Position Mode\n\n`POST /contract/private/set-position-mode`\n\n**Rate Limit:** 2 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| position_mode | String | Yes | `\"hedge_mode\"` or `\"one_way_mode\"` |\n\n**Note:** No `symbol` parameter — this applies globally to the account.\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"position_mode\":\"hedge_mode\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/set-position-mode' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"position_mode\": \"hedge_mode\" } }\n```\n\n**Important:** You cannot change position mode while you have open positions. Close all positions first.\n\n---\n\n### 24. Spot-Futures Transfer\n\n`POST /account/v1/transfer-contract`\n\n**Rate Limit:** 1 req/2sec per KEY\n\n> **Note:** Although the path prefix is `/account/v1/`, this endpoint uses the **futures Base URL** (`https://api-cloud-v2.bitmart.com`), not the spot Base URL.\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| currency | String | Yes | Currency symbol (currently USDT only) |\n| amount | String | Yes | Transfer amount [0.01-10000000000] |\n| type | String | Yes | `\"spot_to_contract\"` or `\"contract_to_spot\"` |\n| recvWindow | Long | No | Valid duration (0-60000]ms, default 5000 |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"currency\":\"USDT\",\"amount\":\"1000\",\"type\":\"spot_to_contract\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/account/v1/transfer-contract' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"currency\": \"USDT\", \"amount\": \"1000\" } }\n```\n\n---\n\n## Plan Order Endpoints (SIGNED auth)\n\n### 25. Submit Plan Order (Conditional/Trigger)\n\n`POST /contract/private/submit-plan-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| side | Int | Yes | 1=buy_open_long, 2=buy_close_short, 3=sell_close_long, 4=sell_open_short |\n| type | String | No | `\"limit\"` (default), `\"market\"`, `\"take_profit\"`, `\"stop_loss\"` |\n| leverage | String | Yes | Leverage multiplier |\n| open_type | String | Yes | `\"cross\"` or `\"isolated\"` |\n| mode | Int | No | 1=GTC (default), 2=FOK, 3=IOC, 4=Maker Only |\n| size | Int | Yes | Order quantity (contracts) |\n| trigger_price | String | Yes | Price that triggers the order |\n| executive_price | String | Conditional | Execution price (required when type=limit) |\n| price_way | Int | Yes | 1=Bullish (trigger when price rises above), 2=Bearish (trigger when price drops below) |\n| price_type | Int | Yes | 1=Last Price, 2=Mark Price |\n| plan_category | Int | No | 1=TP/SL, 2=Position TP/SL |\n| preset_take_profit_price_type | Int | No | 1=Last Price (default), 2=Mark Price |\n| preset_stop_loss_price_type | Int | No | 1=Last Price (default), 2=Mark Price |\n| preset_take_profit_price | String | No | Preset TP price |\n| preset_stop_loss_price | String | No | Preset SL price |\n\n**Example — Trigger buy long when price drops to 65000:**\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"side\":1,\"type\":\"market\",\"size\":10,\"leverage\":\"10\",\"open_type\":\"cross\",\"trigger_price\":\"65000\",\"price_way\":2,\"price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-plan-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": 34567890123456789 } }\n```\n\n---\n\n### 26. Cancel Plan Order\n\n`POST /contract/private/cancel-plan-order`\n\n**Rate Limit:** 40 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | Conditional | Order ID (required if no client_order_id) |\n| client_order_id | String | Conditional | Client order ID (required if no order_id) |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":\"34567890123456789\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/cancel-plan-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:** `{ \"code\": 1000, \"data\": {} }`\n\n---\n\n### 27. Modify Plan Order\n\n`POST /contract/private/modify-plan-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | No | Plan order ID |\n| type | String | Yes | `\"limit\"` or `\"market\"` |\n| trigger_price | String | Yes | New trigger price |\n| executive_price | String | Conditional | New execution price (required when type=limit) |\n| price_type | Int | Yes | 1=Last Price, 2=Mark Price |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":\"34567890123456789\",\"type\":\"market\",\"trigger_price\":\"64000\",\"price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/modify-plan-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": \"34567890123456789\" } }\n```\n\n---\n\n## TP/SL Endpoints (SIGNED auth)\n\n### 28. Submit TP/SL Order\n\n`POST /contract/private/submit-tp-sl-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| type | String | Yes | `\"take_profit\"` or `\"stop_loss\"` |\n| side | Int | Yes | 2=Close Short, 3=Close Long (hedge mode); 2=Reduce Buy, 3=Reduce Sell (one-way) |\n| trigger_price | String | Yes | Trigger/activation price |\n| executive_price | String | Yes | Execution price |\n| price_type | Int | Yes | 1=Last Price, 2=Mark Price |\n| size | Int | No | Order quantity (default: full position size) |\n| plan_category | Int | No | 1=TP/SL, 2=Position TP/SL (default) |\n| client_order_id | String | No | Custom ID (1-32 chars) |\n| category | String | No | `\"limit\"` or `\"market\"` (default market for full position) |\n\n**Example — Set TP for a long position:**\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"type\":\"take_profit\",\"side\":3,\"trigger_price\":\"72000\",\"executive_price\":\"71900\",\"price_type\":1,\"plan_category\":2}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-tp-sl-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Example — Set SL for a short position:**\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"type\":\"stop_loss\",\"side\":2,\"trigger_price\":\"72000\",\"executive_price\":\"72100\",\"price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-tp-sl-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": \"45678901234567890\", \"client_order_id\": \"\" } }\n```\n\n**TP/SL Logic:**\n- **Long position TP**: type=take_profit, side=3, trigger_price > entry_price\n- **Long position SL**: type=stop_loss, side=3, trigger_price < entry_price\n- **Short position TP**: type=take_profit, side=2, trigger_price < entry_price\n- **Short position SL**: type=stop_loss, side=2, trigger_price > entry_price\n\n---\n\n### 29. Modify TP/SL Order\n\n`POST /contract/private/modify-tp-sl-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | Conditional | Order ID (required if no client_order_id) |\n| client_order_id | String | Conditional | Client order ID |\n| trigger_price | String | Yes | New trigger price |\n| executive_price | String | No | New execution price (required when plan_category=1) |\n| price_type | Int | Yes | 1=Last Price, 2=Mark Price |\n| plan_category | Int | No | 1=TP/SL, 2=Position TP/SL |\n| category | String | No | `\"limit\"` or `\"market\"` |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":\"45678901234567890\",\"trigger_price\":\"73000\",\"price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/modify-tp-sl-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": \"45678901234567890\" } }\n```\n\n---\n\n### 30. Modify Preset Plan Order (Preset TP/SL on Order)\n\n`POST /contract/private/modify-preset-plan-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\nModify the preset take-profit/stop-loss attached to an existing order.\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | Yes | Order ID |\n| preset_take_profit_price_type | Int | No | 1=Last Price (default), 2=Mark Price |\n| preset_stop_loss_price_type | Int | No | 1=Last Price (default), 2=Mark Price |\n| preset_take_profit_price | String | No | New preset TP price |\n| preset_stop_loss_price | String | No | New preset SL price |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":\"23456789012345678\",\"preset_take_profit_price\":\"73000\",\"preset_stop_loss_price\":\"64000\",\"preset_take_profit_price_type\":1,\"preset_stop_loss_price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/modify-preset-plan-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": \"23456789012345678\" } }\n```\n\n---\n\n## Trailing Order Endpoints (SIGNED auth)\n\n### 31. Submit Trailing Stop Order\n\n`POST /contract/private/submit-trail-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| side | Int | Yes | 1=buy_open_long, 2=buy_close_short, 3=sell_close_long, 4=sell_open_short |\n| leverage | String | Yes | Leverage multiplier |\n| open_type | String | Yes | `\"cross\"` or `\"isolated\"` |\n| size | Int | Yes | Order quantity (contracts) |\n| activation_price | String | Yes | Price that activates trailing behavior |\n| callback_rate | String | Yes | Callback rate as percentage (0.1-5, where 1=1%) |\n| activation_price_type | Int | Yes | 1=Last Price, 2=Mark Price |\n\n**Example — Trailing stop to close long at 2% pullback from 72000:**\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"side\":3,\"leverage\":\"10\",\"open_type\":\"cross\",\"size\":10,\"activation_price\":\"72000\",\"callback_rate\":\"2\",\"activation_price_type\":1}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-trail-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:**\n```json\n{ \"code\": 1000, \"data\": { \"order_id\": 56789012345678901 } }\n```\n\n**How trailing stops work:**\n1. When the market price reaches `activation_price`, the trailing stop activates.\n2. It tracks the highest price (for sell/close long) or lowest price (for buy/close short).\n3. If the price reverses by `callback_rate` percent from the tracked extreme, a market order is placed.\n\n---\n\n### 32. Cancel Trailing Stop Order\n\n`POST /contract/private/cancel-trail-order`\n\n**Rate Limit:** 24 req/2sec per UID\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | No | Trailing order ID |\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"order_id\":\"56789012345678901\"}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/cancel-trail-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\n**Response:** `{ \"code\": 1000, \"data\": {} }`\n\n---\n\n## Order Query Endpoints (KEYED auth)\n\n### 33. Query Order by ID\n\n`GET /contract/private/order`\n\n**Rate Limit:** 50 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | Yes | Order ID |\n| account | String | No | `\"futures\"` or `\"copy_trading\"` |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/order?symbol=BTCUSDT&order_id=23456789012345678'\n```\n\n**Response:**\n```json\n{\n  \"code\": 1000,\n  \"data\": {\n    \"order_id\": \"23456789012345678\",\n    \"client_order_id\": \"\",\n    \"symbol\": \"BTCUSDT\",\n    \"side\": 1,\n    \"type\": \"market\",\n    \"leverage\": \"10\",\n    \"open_type\": \"cross\",\n    \"size\": \"1\",\n    \"price\": \"0\",\n    \"deal_avg_price\": \"67123.4\",\n    \"deal_size\": \"1\",\n    \"state\": 4,\n    \"create_time\": 1709971200000,\n    \"update_time\": 1709971200500,\n    \"position_mode\": \"hedge_mode\",\n    \"account\": \"futures\",\n    \"activation_price\": \"\",\n    \"callback_rate\": \"\",\n    \"activation_price_type\": 0,\n    \"preset_take_profit_price_type\": 0,\n    \"preset_stop_loss_price_type\": 0,\n    \"preset_take_profit_price\": \"\",\n    \"preset_stop_loss_price\": \"\"\n  }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| order_id | BitMart-assigned order ID |\n| client_order_id | Client-defined order ID |\n| symbol | Contract symbol |\n| side | Order side (1-4) |\n| type | limit, market, liquidate, bankruptcy, adl |\n| leverage | Leverage used |\n| open_type | `\"cross\"` or `\"isolated\"` |\n| size | Order size (contracts) |\n| price | Order price (0 for market) |\n| deal_avg_price | Average fill price |\n| deal_size | Filled size |\n| state | 1=Approving, 2=Pending, 4=Closed |\n| create_time | Creation timestamp (ms) |\n| update_time | Last update timestamp (ms) |\n| position_mode | hedge_mode / one_way_mode |\n| account | Account type |\n| preset_take_profit_price | Preset TP price |\n| preset_stop_loss_price | Preset SL price |\n\n---\n\n### 34. Order History\n\n`GET /contract/private/order-history`\n\n**Rate Limit:** 6 req/2sec per KEY | **Default Range:** Last 7 days | **Max Range:** 90 days | **Max Records:** 200\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | Yes | Contract symbol |\n| order_id | String | No | Filter by order ID |\n| client_order_id | String | No | Filter by client order ID |\n| account | String | No | `\"futures\"` or `\"copy_trading\"` |\n| start_time | Long | No | Start timestamp in **seconds** |\n| end_time | Long | No | End timestamp in **seconds** |\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/order-history?symbol=BTCUSDT'\n```\n\n**Response:** Array of order objects with the same fields as endpoint 33.\n\n**Additional fields in order history:**\n\n| Field | Description |\n|-------|-------------|\n| `trigger_price` | Trigger price (for plan/conditional orders) |\n| `execution_price` | Execution price (for triggered orders) |\n| `executive_order_id` | ID of the order created when plan order triggers |\n\n---\n\n### 35. All Open Orders\n\n`GET /contract/private/get-open-orders`\n\n**Rate Limit:** 50 req/2sec per KEY\n\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| symbol | String | No | Contract symbol. Omit for all symbols |\n| type | String | No | Filter: `\"limit\"`, `\"market\"`, `\"trailing\"` (default all) |\n| order_state | String | No | `\"all\"` (default) or `\"partially_filled\"` |\n| limit | Int | No | M\n\nFile v1.23.20:references/bitmart-close-position.md\n\n# Close Position Workflow\n\n> **Credentials:** Read from `.env` — `BITMART_API_KEY`, `BITMART_API_SECRET`, `BITMART_API_MEMO`.\n\n## Scenario: Close a Long Position\n\n**User prompt:** \"Close my BTC long position on BitMart\"\n\n### Step 1: Get current positions\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/position-v2?symbol=BTCUSDT'\n```\n\nExpected response:\n\n```json\n{\n  \"code\": 1000,\n  \"data\": [\n    {\n      \"symbol\": \"BTCUSDT\",\n      \"leverage\": \"10\",\n      \"current_amount\": \"100\",\n      \"position_amount\": \"100\",\n      \"position_side\": \"long\",\n      \"entry_price\": \"67000.0\",\n      \"mark_price\": \"67500.0\",\n      \"liquidation_price\": \"60500.0\",\n      \"unrealized_pnl\": \"50.00\",\n      \"initial_margin\": \"670.00\",\n      \"open_type\": \"cross\"\n    }\n  ]\n}\n```\n\nIf no position is found, inform the user:\n\n```\nNo open BTCUSDT long position found. Nothing to close.\n```\n\nIf multiple positions exist (e.g., both long and short in hedge mode), ask the user which one to close.\n\n### Step 2: Determine close side\n\n| Position | Close Side | Description |\n|----------|------------|-------------|\n| Long | 3 (sell_close_long) | Sell to close the long position |\n| Short | 2 (buy_close_short) | Buy to cover the short position |\n\nFor a long position: **side = 3**\n\n### Step 3: Present close summary and ask for CONFIRM\n\n```\nClose Position Summary:\n  Symbol: BTCUSDT\n  Direction: Close Long (sell_close_long, side=3)\n  Size: 100 contracts (entire position)\n  Type: Market\n  Entry Price: 67,000.0 USDT\n  Current Mark Price: 67,500.0 USDT\n  Unrealized PnL: +50.00 USDT (profit)\n  Estimated Realized PnL: ~+50.00 USDT\n\nPlease type CONFIRM to proceed.\n```\n\n### Step 4: Submit close order (after user confirms)\n\n> **Note:** Close orders only require `symbol`, `side`, `type`, and `size`.\n> Do NOT include `leverage` or `open_type` — these fields are ignored for close orders and may cause confusion.\n> For limit close, add `price`. For partial close, use a smaller `size`.\n\n```bash\nTIMESTAMP=$(date +%s000)\nBODY='{\"symbol\":\"BTCUSDT\",\"side\":3,\"type\":\"market\",\"size\":100}'\nSIGN=$(echo -n \"${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}\" | openssl dgst -sha256 -hmac \"$BITMART_API_SECRET\" | awk '{print $NF}')\ncurl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-order' \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"X-BM-SIGN: $SIGN\" \\\n  -H \"X-BM-TIMESTAMP: $TIMESTAMP\" \\\n  -d \"$BODY\"\n```\n\nExpected response:\n\n```json\n{\n  \"code\": 1000,\n  \"data\": {\n    \"order_id\": 23456789012345680\n  }\n}\n```\n\n### Step 5: Verify position closed\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/position-v2?symbol=BTCUSDT'\n```\n\nVerify the position no longer appears or the parsed `current_amount` is `0`.\n\nAlso check the fill details:\n\n```bash\ncurl -s -H \"X-BM-KEY: $BITMART_API_KEY\" \\\n  -H \"User-Agent: bitmart-skills/futures/v2026.3.23\" \\\n  -H \"X-BM-BROKER-ID: BlaveData666666\" \\\n  'https://api-cloud-v2.bitmart.com/contract/private/order?symbol=BTCUSDT&order_id=23456789012345680'\n```\n\n### Step 6: Report realized PnL\n\n```\nPosition Closed Successfully:\n  Symbol: BTCUSDT\n  Direction: Closed Long\n  Size: 100 contracts\n  Entry Price: 67,000.0 USDT\n  Exit Price: 67,498.5 USDT\n  Realized PnL: +49.85 USDT\n  Fees: 4.05 USDT\n  Net PnL: +45.80 USDT\n  Margin Released: 670.00 USDT\n\nNot financial advice. You are solely responsible for your investment decisions.\n```\n\n---\n\n## Scenario: Partial Close\n\n**User prompt:** \"Close half of my BTC long\"\n\nThe flow is the same, but with size = 50 (half of 100):\n\n```json\n{\"symbol\":\"BTCUSDT\",\"side\":3,\"type\":\"market\",\"size\":50}\n```\n\nAfter partial close, report both the closed portion and the remaining position.\n\n---\n\n## Scenario: Close a Short Position\n\n**User prompt:** \"Close my ETH short position\"\n\n- Query positions for ETHUSDT\n- Use **side = 2** (buy_close_short)\n- For short positions, profit occurs when exit price < entry price\n\n```json\n{\"symbol\":\"ETHUSDT\",\"side\":2,\"type\":\"market\",\"size\":50}\n```\n\n---\n\n## Scenario: Limit Close\n\n**User prompt:** \"Close my BTC long at 70000\"\n\nUse a limit order instead of market:\n\n```json\n{\"symbol\":\"BTCUSDT\",\"side\":3,\"type\":\"limit\",\"price\":\"70000\",\"size\":100,\"mode\":1}\n```\n\nInform the user that the order will remain open until the price reaches 70000 or they cancel it.\n\n---\n\n## Error Handling\n\n| Error | Cause | Action |\n|-------|-------|--------|\n| No position found | Position already closed or does not exist | Inform user |\n| Size exceeds position | Trying to close more than held | Use the actual position amount |\n| `code != 1000` on submit | Various | Report error message; do not retry automatically |\n| Order state `failed` | System rejection | Check order details for failure reason |\n| Partially filled close | Slippage or liquidity | Report partial fill; suggest retrying for remainder |\n\nArchive v1.23.19: 40 files, 185476 bytes\n\nFiles: CLAUDE.md (11285b), clawhub.json (6682b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-open-position.md (10335b), references/bitmart-plan-order.md (8884b), references/bitmart-signature.md (2127b), references/bitmart-spot-api-reference.md (63758b), references/bitmart-spot-authentication.md (6702b), references/bitmart-spot-scenarios.md (14329b), references/bitmart-spot-skill.md (2888b), references/bitmart-tp-sl.md (10051b), references/blave-api.md (207295b), references/blave-indicator-guide.md (14209b), references/bybit-skill.md (10728b), references/gateio-api-reference.md (7618b), references/gateio-skill.md (5912b), references/hyperliquid-api.md (3304b), references/kucoin-api-reference.md (11083b), references/kucoin-bpp.md (4118b), references/kucoin-skill.md (4279b), references/marketplace.md (4042b), references/okx-api-reference.md (7417b), references/okx-skill.md (3455b), references/twse-api-reference.md (4210b), references/twse-bsr-reference.md (6700b), references/twse-skill.md (3289b), references/twstock-fundamentals-reference.md (8475b), skill-card.md (2096b), SKILL.md (20549b), _meta.json (138b)\n\nFile v1.23.19:SKILL.md\n\n---\nname: blave-quant\ndescription: \"Use for: (1) Blave market alpha data — 籌碼集中度 Holder Concentration, 多空力道 Taker Intensity, 巨鯨警報 Whale Hunter, 擠壓動能 Squeeze Momentum, 市場方向 Market Direction, 資金稀缺 Capital Shortage, 板塊輪動 Sector Rotation (history + heat-map overview), OI 失衡 OI Imbalance, Blave頂尖交易員 Top Trader Exposure, kline (every Binance USDT perpetual incl. tokenized stocks, 1min K線 from 2020-01 or listing), alpha table, 市場情緒 Market Sentiment, 每幣爆倉 Liquidation by coin (24 h USD liquidations per exchange + hourly series), 爆倉矩陣 liquidation exchange matrix (whole-market coin × exchange totals over a rolling window), 多空比 long/short ratio raw data (10 feeds — Binance / OKX / Gate.io × account, top account, top position + Bybit account; cross-coin table + per-coin 7-day hourly series), 未平倉量 open interest raw data (5 exchanges, USDT-margined perps in one-sided USD notional, OI ÷ market cap; table + per-coin) + 未平倉量歷史 open interest history (one coin on one exchange — Binance / Bybit / Gate.io — in coins, 5-minute resolution, for backtests), 主動買賣淨額 CVD (3 exchanges' taker buy/sell turnover, perps only; table + per-coin hourly cumulative), CME 比特幣／以太幣期貨持倉報告 CME Bitcoin / Ether futures Commitments of Traders (CFTC COT weekly — TFF dealer / asset manager / leveraged funds + Legacy categories, BTC from 2018-04-10, standard + micro combined in coins), screener saved conditions, Hyperliquid top trader tracking (leaderboard, positions, history, performance, bucket stats), Taiwan stock daily OHLCV, minute-line intraday OHLCV (1m/5m/15m/30m/60m/1d), forward-adjusted prices, institutional investor buy/sell, margin trading data, shareholding distribution, quarterly fundamental statements — income statement, balance sheet, cash flow, dividend events — cash/stock dividends with announce/ex/pay dates, market value ranking — whole-market market-cap snapshot / top-N stock pool, with each row's listing board (TWSE 上市 / TPEx 上櫃) and ETF flag plus a 上市-ex-ETF market-cap denominator for weight calculations, and broker/dealer daily buy/sell by branch (台股日K/現股分線/向後調整/三大法人/融資融券/股權持股分級表/綜合損益表/資產負債表/現金流量表/股利事件/市值排名（含市場別、ETF 旗標與上市扣除ETF市值分母）/分點買賣超), plus Taiwan market-wide 大盤 series — TAIEX index daily OHLC, whole-market turnover, whole-market institutional net buy/sell, whole-market margin balance, TAIEX daily index dividend points incl. forward estimates (大盤加權指數/全市場成交量值/全市場三大法人/全市場融資融券/指數每日除息點數含未來預估); (2) CME / ICE futures OHLCV — WTI crude oil (CL), gold (GC), Brent crude (BRN); daily/hourly/minute candles from 2010; (3) Taiwan Futures OHLCV — TXF (台指期近月連續); daily/intraday candles (1d/1m/5m/15m/30m/60m), 1d and intraday from 2011-01-03; 法人台指期持倉成本 institutional carrying cost — foreign / investment trust / dealer TAIEX-futures average cost, unrealized/realized PnL (外資/投信/自營商持倉成本, from 2023-10-18); (4) BitMart futures/contract trading — opening/closing positions, leverage, plan orders, TP/SL, trailing stops, account management, sub-account transfers; (5) BitMart spot trading — buy/sell, limit/market orders, account balance, order history, sub-account transfers; (6) OKX trading — spot and perpetual swap, order placement, positions, balance; (7) Bybit trading — spot and derivatives/perpetual swap, order placement, positions, balance, TP/SL; (8) BingX trading — spot and perpetual swap, order placement, position management, leverage, TWAP orders, OCO orders; (9) Bitget trading — spot and futures, order placement, position management, leverage, plan orders; (10) Binance trading — spot and USDS-M futures, order placement, positions, leverage, algo orders, OCO/OTO/OTOCO; (11) Bitfinex trading & funding — spot, margin, funding/lending (submit offers, loans, credits), wallet transfers; (12) KuCoin trading — spot and futures/perpetual contracts, order placement, position management, leverage, stop orders, account management; (13) Taiwan stock lookup/quote/PE — look up Taiwan stock codes and company names, daily quotes (open/high/low/close, volume), PE ratio, dividend yield, PB ratio for listed (上市) and OTC (上櫃) stocks: use the Blave API endpoints (`studio/market/twstock/list`, `/info/<stock_id>`, `/price/<stock_id>`, `/quote/<stock_id>`, `/per/<stock_id>`) — NOT the raw TWSE/TPEX open API. The raw TWSE/TPEX open API (no key required) is ONLY for two things Blave has no endpoint for: trading-halt status and a one-shot full-market PE/yield/PB scan; (14) 台股分點買賣超 — search broker branch code by name (`broker/search?name=`), then query by stock (`broker/stock/<stock_id>?date=`) or by broker branch (`broker/trader/<trader_id>?date=`); by date or date range; via Blave API; no CAPTCHA required; (15) Gate.io trading — spot and USDT-settled perpetual futures, order placement, positions, leverage.\"\nversion: 1.23.19\nmetadata:\n  openclaw:\n    emoji: \"📊\"\n    homepage: https://blave.org\n    requires:\n      env:\n        - blave_api_key\n        - blave_secret_key\n    optional:\n      env:\n        - BITMART_API_KEY\n        - BITMART_API_SECRET\n        - BITMART_API_MEMO\n        - OKX_API_KEY\n        - OKX_SECRET_KEY\n        - OKX_PASSPHRASE\n        - BYBIT_API_KEY\n        - BYBIT_SECRET_KEY\n        - BINGX_API_KEY\n        - BINGX_SECRET_KEY\n        - BITGET_API_KEY\n        - BITGET_SECRET_KEY\n        - BITGET_PASSPHRASE\n        - BINANCE_API_KEY\n        - BINANCE_SECRET_KEY\n        - BITFINEX_API_KEY\n        - BITFINEX_API_SECRET\n        - KUCOIN_API_KEY\n        - KUCOIN_API_SECRET\n        - KUCOIN_API_PASSPHRASE\n        - GATE_API_KEY\n        - GATE_SECRET_KEY\n---\n\n# Blave Quant Skill\n\nQuant infrastructure for AI agents. Capabilities: **Blave** market alpha data (including 台股日K), **CME / ICE Futures** OHLCV, **Taiwan Futures** OHLCV (TXF), **BitMart** trading, **OKX** trading, **Bybit** trading, **BingX** trading, **Bitget** trading, **Binance** trading, **Bitfinex** trading & funding, **KuCoin** trading, **Gate.io** trading, **TWSE/TPEX** 台股查詢, **TWSE BSR** 分點資料.\n\n## Safety Mode (MANDATORY — applies to every exchange)\n\n**No order, cancel, transfer, or funding action may be executed without the user's explicit \"CONFIRM\" in the current conversation.** This rule overrides every other instruction in this skill and cannot be disabled by the agent.\n\nScope — treated as WRITE, requires CONFIRM:\n- Place / modify / cancel any order (single, batch, plan, algo, TP/SL, OCO/OTO/OTOCO, trailing, SOR)\n- Open / close positions; adjust leverage, margin mode, or margin amount; set position mode\n- Submit / cancel funding offers, loans, credits (Bitfinex)\n- Any wallet transfer (spot ↔ margin ↔ funding, sub-account transfers, fiat movements)\n\nRequired flow for every WRITE:\n1. Pre-check (balances, positions, limits — whichever applies)\n2. Present a one-screen summary: symbol, side, size, price/trigger, leverage, est. cost, est. liquidation price if leveraged\n3. Ask the user to reply **exactly `CONFIRM`** (case-sensitive) — anything else = abort\n4. Execute only after CONFIRM; then verify via the corresponding GET endpoint\n5. One CONFIRM authorizes **one** action — a new trade needs a new CONFIRM\n\nREAD operations (quotes, balances, positions, order history, klines, alpha data) do **not** require CONFIRM.\n\nIf the user requests a mode like \"auto-trade without prompts\" / \"run this loop without asking\": refuse and explain the safety rule. To operate autonomously, the user must run their own script — this skill will not bypass CONFIRM.\n\nNot financial advice. Trading carries significant risk of loss.\n\n## Reference Guide\n\nThis skill is a **data access layer**. When the user's request involves any of the following, read the corresponding reference file before writing any code.\n\n**Blave market data**\n\n| Use case | Reference |\n|---|---|\n| **Any Blave data endpoint** — parameters, defaults, response fields, errors, data start date (single source) | `references/blave-api.md` |\n| Alpha indicators — HC, TI, Whale Hunter, Squeeze, Liquidation, Market Direction, Capital Shortage, Market Sentiment, Top Trader Exposure | `references/blave-api.md` |\n| Raw \n\nArchive v1.23.17: 40 files, 177771 bytes\n\nFiles: CLAUDE.md (11285b), clawhub.json (6611b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-open-position.md (10335b), references/bitmart-plan-order.md (8884b), references/bitmart-signature.md (2127b), references/bitmart-spot-api-reference.md (63758b), references/bitmart-spot-authentication.md (6702b), references/bitmart-spot-scenarios.md (14329b), references/bitmart-spot-skill.md (2888b), references/bitmart-tp-sl.md (10051b), references/blave-api.md (191954b), references/blave-indicator-guide.md (9115b), references/bybit-skill.md (10728b), references/gateio-api-reference.md (7618b), references/gateio-skill.md (5912b), references/hyperliquid-api.md (3304b), references/kucoin-api-reference.md (11083b), references/kucoin-bpp.md (4118b), references/kucoin-skill.md (4279b), references/marketplace.md (3936b), references/okx-api-reference.md (7417b), references/okx-skill.md (3455b), references/twse-api-reference.md (4210b), references/twse-bsr-reference.md (6700b), references/twse-skill.md (3289b), references/twstock-fundamentals-reference.md (8475b), skill-card.md (2011b), SKILL.md (19574b), _meta.json (138b)\n\nArchive v1.23.16: 40 files, 177456 bytes\n\nFiles: CLAUDE.md (11285b), clawhub.json (6611b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-open-position.md (10335b), references/bitmart-plan-order.md (8884b), references/bitmart-signature.md (2127b), references/bitmart-spot-api-reference.md (63758b), references/bitmart-spot-authentication.md (6702b), references/bitmart-spot-scenarios.md (14329b), references/bitmart-spot-skill.md (2888b), references/bitmart-tp-sl.md (10051b), references/blave-api.md (191026b), references/blave-indicator-guide.md (9115b), references/bybit-skill.md (10728b), references/gateio-api-reference.md (7618b), references/gateio-skill.md (5912b), references/hyperliquid-api.md (3304b), references/kucoin-api-reference.md (11083b), references/kucoin-bpp.md (4118b), references/kucoin-skill.md (4279b), references/marketplace.md (3936b), references/okx-api-reference.md (7417b), references/okx-skill.md (3455b), references/twse-api-reference.md (4210b), references/twse-bsr-reference.md (6700b), references/twse-skill.md (3289b), references/twstock-fundamentals-reference.md (8475b), skill-card.md (1995b), SKILL.md (19574b), _meta.json (138b)\n\nArchive v1.23.15: 40 files, 177569 bytes\n\nFiles: CLAUDE.md (11285b), clawhub.json (6611b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-open-position.md (10335b), references/bitmart-plan-order.md (8884b), references/bitmart-signature.md (2127b), references/bitmart-spot-api-reference.md (63758b), references/bitmart-spot-authentication.md (6702b), references/bitmart-spot-scenarios.md (14329b), references/bitmart-spot-skill.md (2888b), references/bitmart-tp-sl.md (10051b), references/blave-api.md (191154b), references/blave-indicator-guide.md (9115b), references/bybit-skill.md (10728b), references/gateio-api-reference.md (7618b), references/gateio-skill.md (5912b), references/hyperliquid-api.md (3304b), references/kucoin-api-reference.md (11083b), references/kucoin-bpp.md (4118b), references/kucoin-skill.md (4279b), references/marketplace.md (3936b), references/okx-api-reference.md (7417b), references/okx-skill.md (3455b), references/twse-api-reference.md (4210b), references/twse-bsr-reference.md (6700b), references/twse-skill.md (3289b), references/twstock-fundamentals-reference.md (8475b), skill-card.md (2078b), SKILL.md (19574b), _meta.json (138b)\n\nArchive v1.23.11: 40 files, 175429 bytes\n\nFiles: CLAUDE.md (11285b), clawhub.json (6611b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-open-position.md (10335b), references/bitmart-plan-order.md (8884b), references/bitmart-signature.md (2127b), references/bitmart-spot-api-reference.md (63758b), references/bitmart-spot-authentication.md (6702b), references/bitmart-spot-scenarios.md (14329b), references/bitmart-spot-skill.md (2888b), references/bitmart-tp-sl.md (10051b), references/blave-api.md (188156b), references/blave-indicator-guide.md (9115b), references/bybit-skill.md (10728b), references/gateio-api-reference.md (7618b), references/gateio-skill.md (5912b), references/hyperliquid-api.md (2985b), references/kucoin-api-reference.md (11083b), references/kucoin-bpp.md (4118b), references/kucoin-skill.md (4279b), references/marketplace.md (3936b), references/okx-api-reference.md (7417b), references/okx-skill.md (3455b), references/twse-api-reference.md (4210b), references/twse-bsr-reference.md (6700b), references/twse-skill.md (3289b), references/twstock-fundamentals-reference.md (7380b), skill-card.md (1931b), SKILL.md (19506b), _meta.json (138b)\n\nArchive v1.23.9: 40 files, 173712 bytes\n\nFiles: CLAUDE.md (11311b), clawhub.json (6555b), README.md (12210b), references/binance-api-reference.md (10267b), references/binance-skill.md (4987b), references/bingx-api-reference.md (14375b), references/bingx-skill.md (2718b), references/bitfinex-skill.md (7691b), references/bitget-api-reference.md (7228b), references/bitget-skill.md (2671b), references/bitmart-api-reference.md (74047b), references/bitmart-close-position.md (5196b), references/bitmart-futures-skill.md (5704b), references/bitmart-op...","readmeExcerpt":"Skill: Skill Trim Owner: blave-wei Summary: Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io. Tags: latest:1.23.20 Version history: v1.23.20 | 2026-10-08T07:23:56.861Z | use","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"GET /studio/market/twstock/broker/search?name=松山\n→ [{\"broker_id\": \"9217\", \"broker_name\": \"凱基-松山\"}, ...]"},{"language":"text","snippet":"GET /studio/market/twstock/broker/stock/<stock_id>?date=YYYY-MM-DD\nGET /studio/market/twstock/broker/trader/<trader_id>?date=YYYY-MM-DD"},{"language":"bash","snippet":"npx -y skills add https://github.com/Blave-TW/blave-quant-skill -a openclaw -s blave-quant -y"},{"language":"bash","snippet":"npx -y skills add https://github.com/Blave-TW/blave-quant-skill -a openclaw -s blave-quant -y"},{"language":"text","snippet":"blave_api_key=YOUR_API_KEY\nblave_secret_key=YOUR_SECRET_KEY"},{"language":"text","snippet":"BITMART_API_KEY=YOUR_API_KEY\nBITMART_API_SECRET=YOUR_SECRET_KEY\nBITMART_API_MEMO=YOUR_MEMO"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: blave-quant\ndescription: \"Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io.\"\nversion: 1.23.20\nmetadata:\n  openclaw:\n    emoji: \"📊\"\n    homepage: https://blave.org\n    requires:\n      env:\n        - blave_api_key\n        - blave_secret_key\n    optional:\n      env:\n        - BITMART_API_KEY\n        - BITMART_API_SECRET\n        - BITMART_API_MEMO\n        - OKX_API_KEY\n        - OKX_SECRET_KEY\n        - OKX_PASSPHRASE\n        - BYBIT_API_KEY\n        - BYBIT_SECRET_KEY\n        - BINGX_API_KEY\n        - BINGX_SECRET_KEY\n        - BITGET_API_KEY\n        - BITGET_SECRET_KEY\n        - BITGET_PASSPHRASE\n        - BINANCE_API_KEY\n        - BINANCE_SECRET_KEY\n        - BITFINEX_API_KEY\n        - BITFINEX_API_SECRET\n        - KUCOIN_API_KEY\n        - KUCOIN_API_SECRET\n        - KUCOIN_API_PASSPHRASE\n        - GATE_API_KEY\n        - GATE_SECRET_KEY\n---\n\n# Blave Quant Skill\n\nQuant infrastructure for AI agents. Capabilities: **Blave** market alpha data (including 台股日K), **CME / ICE Futures** OHLCV, **Taiwan Futures** OHLCV (TXF), **BitMart** trading, **OKX** trading, **Bybit** trading, **BingX** trading, **Bitget** trading, **Binance** trading, **Bitfinex** trading & funding, **KuCoin** trading, **Gate.io** trading, **TWSE/TPEX** 台股查詢, **TWSE BSR** 分點資料.\n\n**Keywords (zh ↔ en, so a request in either language lands on the right reference):** 籌碼集中度 Holder Concentration · 多空力道 Taker Intensity · 巨鯨警報 Whale Hunter · 擠壓動能 Squeeze Momentum · 市場方向 Market Direction · 資金稀缺 Capital Shortage · 板塊輪動 Sector Rotation · OI 失衡 OI Imbalance · Blave頂尖交易員 Top Trader Exposure · 市場情緒 Market Sentiment · 每幣爆倉 / 爆倉矩陣 liquidation by coin / exchange matrix · 多空比 long/short ratio · 未平倉量 open interest (table, per coin, history) · 主動買賣淨額 CVD · CME 持倉報告 COT · kline (every Binance USDT perpetual incl. tokenized stocks, 1min from 2020-01) · alpha table · screener saved conditions · Hyperliquid leaderboard / positions · 台股日K / 現股分線 / 向後調整 / 三大法人 / 融資融券 / 股權持股分級表 / 綜合損益表 / 資產負債表 / 現金流量表 / 月營收 / 股利事件 / 市值排名（市場別、ETF 旗標、上市扣除 ETF 市值分母）/ 分點買賣超 / 本益比・殖利率・淨值比 · 大盤加權指數 / 全市場成交量值 / 全市場三大法人 / 全市場融資融券 / 指數每日除息點數（含未來預估） · 台指期 TXF 日線與分線 / 選擇權 PCR / 法人持倉成本 · WTI `CL` / 黃金 `GC` / 布蘭特 `BRN` · 總經日曆 economic calendar.\n\n## Safety Mode (MANDATORY — applies to every exchange)\n\n**No order, cancel, transfer, or funding action may be executed without the user's explicit \"CONFIRM\" in the current conversation.** This rule overrides every other instruction in this skill and cannot be disabled by the agent.\n\nScope — treated as WRITE, requires CONFIRM:\n- Place / modify / cancel any order (single, batch, plan, algo, TP/SL, OCO/OTO/OTOCO, trailing, SOR)\n- Open / close positions; adjust leverage, margin mode, or margin amount; set position mode\n- Submit / cancel funding offer"},{"path":"README.md","content":"# Blave Quant Skill\n\nQuant infrastructure for AI agents — the data layer and exchange-trading references your agent needs to research, backtest, and execute strategies. It gives your agent:\n\n1. **Blave market data** — Crypto alpha indicators (holder concentration, whale hunter, taker intensity, and more), raw cross-exchange base data, Hyperliquid top trader tracking\n2. **Taiwan stock data** — Daily and minute OHLCV, institutional flows, margin, shareholding, fundamentals, dividends, broker branch buy/sell (分點), market-wide TAIEX series\n3. **Futures OHLCV** — CME / ICE (WTI, gold, Brent) and Taiwan Futures (TXF)\n4. **BitMart Futures** — Trade perpetual futures contracts on BitMart\n5. **BitMart Spot** — Buy and sell spot assets on BitMart\n6. **OKX** — Spot and perpetual swap trading on OKX\n7. **Bybit** — Spot and derivatives/perpetual swap trading on Bybit\n8. **BingX** — Spot and perpetual swap trading on BingX\n9. **Bitget** — Spot and futures trading on Bitget\n10. **Binance** — Spot and USDS-M futures trading on Binance\n11. **Bitfinex** — Spot, margin, and funding/lending on Bitfinex\n12. **KuCoin** — Spot and futures trading on KuCoin\n13. **Gate.io** — Spot and USDT-settled perpetual futures trading on Gate.io\n\nOfficial website: [https://blave.org](https://blave.org) | For more details, visit the [Blave Docs](https://blave.org/docs/en)\n\n## Security\n\nThis skill is **documentation only** — it contains no executable code, scripts, or binaries.\n\n- All files are plain Markdown (`.md`)\n- No `package.json`, no scripts, no dependencies\n- All API calls are made directly by your agent — this skill only provides the instructions\n- Your API keys stay in your local `.env` file. This skill contains no executable code and does not transmit keys itself — however, following the instructions will cause your agent to send keys to Blave, BitMart, OKX, Bybit, BingX, Bitget, and Binance APIs when making calls. We recommend using API keys with minimum required permissions and enabling IP whitelisting where possible.\n- API request signing (HMAC-SHA256) is performed by your agent in code — the reference docs include `openssl`/`curl` shell examples for illustration only. No local shell tools are required by this skill.\n\nYou can inspect the full source at: [https://github.com/Blave-TW/blave-quant-skill](https://github.com/Blave-TW/blave-quant-skill)\n\n---\n\n## Install\n\n```bash\nnpx -y skills add https://github.com/Blave-TW/blave-quant-skill -a openclaw -s blave-quant -y\n```\n\nThe `-a openclaw -s blave-quant -y` flags skip the interactive picker — required for agents driving the install via tmux/SSH (the TUI breaks with arrow-key navigation in those environments). For `claude-code`, replace `-a openclaw` with `-a claude-code`.\n\n## Update\n\nRun the same install command again — it overwrites the existing skill in place.\n\n```bash\nnpx -y skills add https://github.com/Blave-TW/blave-quant-skill -a openclaw -s blave-quant -y\n```\n\nOr just tell your agent: **\"Update the blave-quant skill"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7d1wz9h9g743f52j24m70sdd827pgp\",\n  \"slug\": \"blave-quant-skill\",\n  \"version\": \"1.23.20\",\n  \"publishedAt\": 1791444236861\n}"},{"path":"references/binance-api-reference.md","content":"# Binance API Reference\n\n## Base URLs\n\n| | Spot | USDS-M Futures |\n|---|---|---|\n| Production | `https://api.binance.com` | `https://fapi.binance.com` |\n| Testnet | `https://testnet.binance.vision` | `https://demo-fapi.binance.com` |\n\n**Success:** Spot returns order fields directly; Futures returns `\"code\": 200` or fields directly.\n\n---\n\n## Authentication\n\n**Credentials** (from `.env`): `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`\n\n**Signature:** `HMAC-SHA256(secret, totalParams)` → hex\n- `totalParams` = queryString + requestBody (concatenated, no separator)\n- `timestamp`: Unix milliseconds (always required for signed endpoints)\n- `signature` must be the **last** parameter\n\n**Headers:**\n```\nX-MBX-APIKEY: <api_key>\nContent-Type: application/x-www-form-urlencoded   (POST)\n```\n\n## Broker ID (Blave)\n\nBinance broker attribution is per-order via `newClientOrderId`, **not** a header.\n\n| Product | Broker ID | `newClientOrderId` prefix |\n|---|---|---|\n| Spot | `GBN6HWR2` | `x-GBN6HWR2` |\n| USDS-M Futures | `52DDFAFN` | `x-52DDFAFN` |\n\n- Total length of `newClientOrderId` ≤ 36 chars\n- Required on `/api/v3/order`, `/api/v3/order/cancelReplace`, `/api/v3/sor/order`, `/api/v3/orderList/oco|oto|otoco`, `/fapi/v1/order`, `/fapi/v1/batchOrders`, `/fapi/v1/algoOrder`, and their test/modify variants\n- Batch orders: every order in the batch must carry its own prefixed `newClientOrderId`\n\n```python\nimport uuid\n\ndef spot_cid(suffix: str = \"\") -> str:\n    return f\"x-GBN6HWR2{suffix or uuid.uuid4().hex[:8]}\"[:36]\n\ndef fut_cid(suffix: str = \"\") -> str:\n    return f\"x-52DDFAFN{suffix or uuid.uuid4().hex[:8]}\"[:36]\n```\n\n---\n\n## Python Signature Implementation\n\n```python\nimport time, hmac, hashlib, requests\nfrom dotenv import dotenv_values\nfrom urllib.parse import urlencode\n\n_env       = dotenv_values()\nAPI_KEY    = _env[\"BINANCE_API_KEY\"]\nSECRET_KEY = _env[\"BINANCE_SECRET_KEY\"]\nSPOT_URL   = \"https://api.binance.com\"\nFAPI_URL   = \"https://fapi.binance.com\"\n\n\ndef _sign(params: dict) -> dict:\n    params[\"timestamp\"] = int(time.time() * 1000)\n    qs = urlencode(params)\n    params[\"signature\"] = hmac.new(SECRET_KEY.encode(), qs.encode(), hashlib.sha256).hexdigest()\n    return params\n\n\ndef bn_get(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.get(f\"{base}{path}\", params=p,\n                     headers={\"X-MBX-APIKEY\": API_KEY}, timeout=10)\n    return r.json()\n\n\ndef bn_post(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.post(f\"{base}{path}\", data=urlencode(p),\n                      headers={\"X-MBX-APIKEY\": API_KEY,\n                               \"Content-Type\": \"application/x-www-form-urlencoded\"}, timeout=10)\n    return r.json()\n\n\ndef bn_delete(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = requests.delete(f\"{base}{path}\", params=p,\n                        headers={\"X-MBX-APIKEY\": API_KEY}, timeout=10)\n    return r.json()\n\n\ndef bn_put(base, path, params=None):\n    p = _sign(dict(params or {}))\n    r = r"},{"path":"references/binance-skill.md","content":"# Binance Trading\n\n**Spot Base URL:** `https://api.binance.com` | **Futures Base URL:** `https://fapi.binance.com`\n\n**Spot:** `BTCUSDT` | **Futures:** `BTCUSDT` | **Testnet:** `https://testnet.binance.vision` (spot) / `https://demo-fapi.binance.com` (futures)\n\nFull details in `references/binance-api-reference.md`\n\n## Authentication\n\n**Credentials** (from `.env`): `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`\n\nNo Binance account? Register at **[https://www.binance.com/](https://www.binance.com/)**\n\nVerify credentials before any private call. If missing — **STOP**.\n\n**Signature:** `HMAC-SHA256(secret, queryString + requestBody)` → hex\n- `timestamp`: Unix milliseconds (always required)\n- `signature` must be the **last** parameter\n\n**Headers:**\n```\nX-MBX-APIKEY: <api_key>\nContent-Type: application/x-www-form-urlencoded   (POST)\n```\n\n> Python signature implementation: `references/binance-api-reference.md`\n\n## Broker ID (Blave — MANDATORY on every order)\n\nBinance brokers are attached **per order** via `newClientOrderId`, not via a header. Every place-order call **MUST** include `newClientOrderId` starting with `x-<BROKER_ID>`:\n\n| Product | Broker ID | `newClientOrderId` prefix |\n|---|---|---|\n| Spot | `GBN6HWR2` | `x-GBN6HWR2` |\n| USDS-M Futures | `52DDFAFN` | `x-52DDFAFN` |\n\nRules:\n- Prefix starts with literal `x-` (lowercase), then the broker ID\n- Total length ≤ 36 chars; append a unique suffix (timestamp/uuid fragment) to keep each ID unique\n- Applies to: `/api/v3/order`, `/api/v3/order/cancelReplace`, `/api/v3/sor/order`, `/api/v3/orderList/oco|oto|otoco`, `/fapi/v1/order`, `/fapi/v1/batchOrders`, `/fapi/v1/algoOrder`, and their test/modify variants\n- On `/fapi/v1/algoOrder` the parameter is named `clientAlgoId` (not `newClientOrderId`) — same prefix, same ≤36-char limit\n- Batch orders: **every** order in the batch needs its own qualifying `newClientOrderId`\n- If user supplies a custom `newClientOrderId`, reject it or prepend the broker prefix — never strip the prefix\n\n```python\nimport time, uuid\n\ndef spot_cid(suffix: str = \"\") -> str:\n    tag = suffix or uuid.uuid4().hex[:8]\n    return f\"x-GBN6HWR2{tag}\"[:36]\n\ndef fut_cid(suffix: str = \"\") -> str:\n    tag = suffix or uuid.uuid4().hex[:8]\n    return f\"x-52DDFAFN{tag}\"[:36]\n\n# Spot place order\nspot_post(\"/api/v3/order\", {\n    \"symbol\": \"BTCUSDT\", \"side\": \"BUY\", \"type\": \"MARKET\",\n    \"quantity\": \"0.001\",\n    \"newClientOrderId\": spot_cid(),\n})\n\n# Futures place order\nfapi_post(\"/fapi/v1/order\", {\n    \"symbol\": \"BTCUSDT\", \"side\": \"BUY\", \"type\": \"MARKET\",\n    \"quantity\": \"0.001\",\n    \"newClientOrderId\": fut_cid(),\n})\n```\n\n## Operation Flow\n\n### Step 0: Credential Check\nVerify `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`. If missing — **STOP**. Default to **Mainnet** unless user explicitly requests Testnet.\n\n### Step 1: Pre-Trade Check (Futures)\n- Query positions: `GET /fapi/v2/positionRisk?symbol=<SYMBOL>`\n- If position exists → inherit leverage and margin type, do NOT override\n\n### Step 2: Execute\n- READ → call, p"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io. Skill: Skill Trim Owner: blave-wei Summary: Blave quant data layer and exchange-trading reference for AI agents. Use when the task needs crypto alpha/market data, Taiwan stock, futures or market-wide data, CME/ICE or TXF OHLCV, Hyperliquid top traders, or trading on BitMart, OKX, Bybit, BingX, Bitget, Binance, Bitfinex, KuCoin or Gate.io. Tags: latest:1.23.20 Version history: v1.23.20 | 2026-10-08T07:23:56.861Z | use","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1658,"uniquenessScore":47,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T07:48:41.363Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T15:26:44.626Z","emptyReason":null},"items":[{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-10T18:48:31.762Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}