Bitmart Exchange Futuresのロゴ

Bitmart Exchange Futures

組織
bitmartexchange
bitmart-exchange-futures

BitMartの先物・契約取引や先物WebSocketストリームについてユーザーが質問するときに使用します。ポジションの新規作成・決済、レバレッジ設定、計画注文(条件付き注文)の発注、利確・損切り、トレーリング注文、先物ポジションの確認、先物口座の管理、ワンクリックでの全ポジション決済、資金口座と先物口座間の振替、サブアカウント間の振替、アフィリエイトやリベートに関する問い合わせ、シミュレーション取引、先物ティッカー・板ティッカー・取引・板の深さ・資金調達率・非公開注文・非公開ポジションのリアルタイム配信が対象です。現物取引には使用しないでください(bitmart-exchange-spotを使用)。

概要

公開者bitmartexchange
リポジトリbitmart-skills
スキル名bitmart-exchange-futures
スター
33
フォーク
0
同梱ファイル
7
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 7個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    bitmartexchangeがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Bitmart Exchange Futures」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/bitmartexchange/bitmart-skills/tree/master/skills/bitmart-exchange-futures
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bitmartexchange/bitmart-skills.git /tmp/bitmart-skills
mkdir -p .claude/skills
cp -r /tmp/bitmart-skills/skills/bitmart-exchange-futures .claude/skills/bitmart-exchange-futures
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでBitmart Exchange Futuresを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にBitmart Exchange Futuresを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Bitmart Exchange Futuresは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

BitMart Futures Trading

Overview

60 endpoints total. Table:

#CategoryAPI EndpointTypeDescription
1Market DataGET /contract/public/detailsREADContract specifications
2Market DataGET /contract/public/depthREADOrder book
3Market DataGET /contract/public/market-tradeREADRecent trades (max 100)
4Market DataGET /contract/public/funding-rateREADCurrent funding rate (single symbol)
5Market DataGET /contract/public/funding-rate-v2READCurrent funding rate (all symbols, or filter by symbol)
6Market DataGET /contract/public/funding-rate-historyREADHistorical funding rates
7Market DataGET /contract/public/klineREADK-line (steps: 1,3,5,15,30,60,120,240,360,720,1440,4320,10080)
8Market DataGET /contract/public/markprice-klineREADMark price K-line
9Market DataGET /contract/public/open-interestREADOpen interest
10Market DataGET /contract/public/leverage-bracketREADLeverage tiers / risk limits
11AccountGET /contract/private/assets-detailREADFutures account balance
12AccountGET /contract/private/trade-fee-rateREADTrade fee rate
13AccountGET /contract/private/positionREADCurrent positions
14AccountGET /contract/private/position-v2READPositions (extended info)
15AccountGET /contract/private/position-riskREADPosition risk / liquidation
16AccountGET /contract/private/get-position-modeREADCurrent position mode
17AccountGET /contract/private/transaction-historyREADPnL / funding / fees history
18TradingPOST /contract/private/submit-orderWRITEPlace order
19TradingPOST /contract/private/cancel-orderWRITECancel order
20TradingPOST /contract/private/cancel-ordersWRITEBatch cancel
21TradingPOST /contract/private/modify-limit-orderWRITEAmend limit order
22TradingPOST /contract/private/cancel-all-afterWRITETimed cancel all
23TradingPOST /contract/private/submit-leverageWRITESet leverage
24TradingPOST /contract/private/set-position-modeWRITESet hedge/one-way mode
25TradingPOST /account/v1/transfer-contractWRITESpot-Futures transfer
26TradingPOST /contract/private/account/v1/transferWRITEFund ↔ Futures account transfer
27TradingPOST /contract/private/close-all-positionWRITEClose all positions (one-click market close)
28Plan OrderPOST /contract/private/submit-plan-orderWRITEConditional/trigger order
29Plan OrderPOST /contract/private/cancel-plan-orderWRITECancel plan order
30Plan OrderPOST /contract/private/modify-plan-orderWRITEAmend plan order
31TP/SLPOST /contract/private/submit-tp-sl-orderWRITESet take-profit/stop-loss
32TP/SLPOST /contract/private/modify-tp-sl-orderWRITEModify TP/SL
33TP/SLPOST /contract/private/modify-preset-plan-orderWRITEModify preset TP/SL on order
34TrailingPOST /contract/private/submit-trail-orderWRITETrailing stop order
35TrailingPOST /contract/private/cancel-trail-orderWRITECancel trailing
36Order QueryGET /contract/private/orderREADOrder by ID
37Order QueryGET /contract/private/order-historyREADHistorical orders
38Order QueryGET /contract/private/get-open-ordersREADAll open orders
39Order QueryGET /contract/private/current-plan-orderREADActive plan orders
40Order QueryGET /contract/private/tradesREADTrade / fill history
41Order QueryPOST /account/v1/transfer-contract-listREADTransfer records
42Sub-AccountPOST /account/contract/sub-account/main/v1/sub-to-mainWRITESub → Main transfer (main account)
43Sub-AccountPOST /account/contract/sub-account/main/v1/main-to-subWRITEMain → Sub transfer (main account)
44Sub-AccountPOST /account/contract/sub-account/sub/v1/sub-to-mainWRITESub → Main transfer (sub account)
45Sub-AccountGET /account/contract/sub-account/main/v1/walletREADSub-account futures balance
46Sub-AccountGET /account/contract/sub-account/main/v1/transfer-listREADSub-account transfer history
47Sub-AccountGET /account/contract/sub-account/v1/transfer-historyREADAccount transfer history
48AffiliateGET /contract/private/affiliate/rebate-listREADRebate overview
49AffiliateGET /contract/private/affiliate/trade-listREADAffiliate trade records
50AffiliateGET /contract/private/affiliate/rebate-userREADSingle user rebate data
51AffiliateGET /contract/private/affiliate/rebate-apiREADSingle API user rebate data
52AffiliateGET /contract/private/affiliate/invite-checkREADCheck if invited user
53AffiliateGET /contract/private/affiliate/rebate-inviteUserREADInvited customer list
54AffiliateGET /contract/private/affiliate/deposit-withdrawal-listREADInvited user deposit / withdrawal records
55AffiliateGET /contract/private/affiliate/aff-customer-infoREADInvited user contract account assets and equity
56Collateral / RepaymentGET /contract/private/cross_collateral/interest_logREADCross-collateral interest accrual logs
57Collateral / RepaymentGET /contract/private/auto_repaymentREADAuto repayment records
58SimulatedPOST /contract/private/claimWRITEDemo account top-up (demo only)
59SystemGET /system/timeREADGet server time (milliseconds)
60SystemGET /system/serviceREADGet system service status / maintenance

WebSocket coverage: Public real-time channels and private push channels are documented in references/websocket.md, including futures book ticker, funding-rate push, depth speed suffixes, private order position_mode, and private position position_mode.


Skill Routing

User IntentCorrect Skill
Futures/contract trading, leverage, TP/SL, plan orders, trailing stops, sub-account transfers, one-click close-all-position, fund account transfers (fund ↔ futures only), affiliate/rebate/deposit-withdrawal/invited-user asset queries, simulated tradingbitmart-exchange-futures (this skill)
Futures real-time ticker, book ticker, trades, depth, funding-rate push, private order/position pushbitmart-exchange-futures (this skill, WebSocket reference)
Spot buy/sell, order management, spot balance, fee ratesbitmart-exchange-spot

Authentication

Credential Check (Before Any Private API Call)

Before calling any authenticated endpoint, verify credentials are available:

  1. Check for environment variables:
    • BITMART_API_KEY — API key
    • BITMART_API_SECRET — Secret key
    • BITMART_API_MEMO — Memo string
  2. Or check for config file: ~/.bitmart/config.toml
    toml
    [default]
    api_key = "your-api-key"
    api_secret = "your-secret-key"
    memo = "your-memo"
  3. If missing: STOP. Guide user to set up credentials. Do NOT proceed with any authenticated call.

Key display rules: When displaying credentials back to the user, show only the first 5 and last 4 characters (e.g., bmk12...9xyz). NEVER display full secret or memo values.

Auth Levels

LevelWhenHeaders Required
NONEPublic market data and system status (endpoints 1-10, 59-60)None
KEYEDRead-only private data — balances, positions, orders, affiliate, collateral / repayment logs (endpoints 11-17, 36-40, 45-57)X-BM-KEY
SIGNEDWrite operations — trading, leverage, transfers, sub-account transfers, demo claim (endpoints 18-35, 41-44, 58)X-BM-KEY + X-BM-SIGN + X-BM-TIMESTAMP

Signature Generation

timestamp = current UTC time in milliseconds
message   = "{timestamp}#{memo}#{request_body_json}"
signature = HMAC-SHA256(secret_key, message) → hex string
  • For POST requests: request_body_json is the JSON body string.
  • For GET requests: request_body_json is an empty string "".

Required Headers (SIGNED)

HeaderValue
Content-Typeapplication/json
X-BM-KEYAPI key
X-BM-SIGNHex-encoded HMAC-SHA256 signature
X-BM-TIMESTAMPCurrent UTC timestamp in milliseconds
User-Agentbitmart-skills/futures/v2026.7.14 — SDK source identifier for analytics

API Base

  • Base URL: https://api-cloud-v2.bitmart.com
  • Symbol Format: BTCUSDT (no separator — unlike spot which uses BTC_USDT)

Key Differences from Spot

AspectSpotFutures
Base URLapi-cloud.bitmart.comapi-cloud-v2.bitmart.com
Symbol FormatBTC_USDT (underscore)BTCUSDT (no separator)
Order Side"buy" / "sell" (string)1 / 2 / 3 / 4 (integer)
LeverageN/AConfigurable per symbol
Position ModeN/Ahedge_mode / one_way_mode
Margin ModeN/Across / isolated

IMPORTANT: Always use the futures base URL (api-cloud-v2) for contract endpoints. Using the spot base URL will fail.

Standard Response Format

Success:

json
{
  "code": 1000,
  "message": "OK",
  "trace": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": { ... }
}

Error:

json
{
  "code": 40035,
  "message": "Order not exist",
  "trace": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": null
}

Important: For standard Futures endpoints, String(code) == "1000" means success and any other code is an error. Two collateral / repayment endpoints (GET /contract/private/cross_collateral/interest_log and GET /contract/private/auto_repayment) use the alternate response shape {"errno":"OK","message":"Success","success":true,...} and may omit code; treat success == true as success for those endpoints. GET /contract/private/affiliate/aff-customer-info may return "code":"1000" as a string, so do not require a numeric-only comparison.

GET requests: Parameters go in the query string. POST requests: Parameters go in the JSON body.


Order Side Reference

ValueHedge ModeOne-Way Mode
1Open Long (buy_open_long)Buy
2Close Short (buy_close_short)Buy (Reduce Only)
3Close Long (sell_close_long)Sell (Reduce Only)
4Open Short (sell_open_short)Sell

Hedge mode mapping:

  • To open long: side = 1
  • To close long: side = 3
  • To open short: side = 4
  • To close short: side = 2

One-way mode: Use side 1 (buy) or 4 (sell). The system infers whether to open or close.

Order Mode Reference

ValueNameDescription
1GTCGood Till Cancel — order stays open until filled or canceled
2FOKFill or Kill — must fill entirely or cancel immediately
3IOCImmediate or Cancel — fill what's available, cancel the rest
4Maker OnlyPost Only — rejected if it would immediately match

Rate Limits

EndpointRateTarget
Public Market Data (most)12/2secIP
Open Interest2/2secIP
Assets Detail12/2secKEY
Trade Fee Rate2/2secKEY
Position / Position V26/2secKEY
Position Risk24/2secKEY
Get Position Mode2/2secKEY
Transaction History6/2secKEY
Order Detail50/2secKEY
Order History / Trades6/2secKEY
Open Orders / Plan Orders50/2secKEY
Submit Order24/2secKEY
Cancel Order40/2secKEY
Cancel Orders (batch)2/2secKEY
Modify Order24/2secUID
Plan / TP-SL / Trail Orders24/2secUID
Cancel Plan Order40/2secUID
Cancel All After4/2secUID
Set Leverage24/2secKEY
Set Position Mode2/2secKEY
Transfer1/2secKEY
Transfer List1/2secKEY
Fund Account Transfer (/contract/private/account/v1/transfer)12/2secKEY
Close All Position1/1secUID
Sub-Account Transfers (42-44)8/2secKEY
Sub-Account Wallet (45)12/2secKEY
Sub-Account History (46-47)8/2secKEY
Affiliate Endpoints (48-53)24/2secKEY
Affiliate Deposit / Withdrawal and Account Info (54-55)24/2secKEY
Cross-Collateral Interest / Auto Repayment (56-57)2/2secUID
GET /system/time10/secIP
GET /system/service10/secIP

Rate limit response headers:

  • X-BM-RateLimit-Remaining — Number of requests already used in the current window
  • X-BM-RateLimit-Limit — Maximum allowed requests in the current window
  • X-BM-RateLimit-Reset — Current time window length (seconds)

Warning: If X-BM-RateLimit-Remaining >= X-BM-RateLimit-Limit, stop calling immediately and wait for reset to avoid sending one extra over-limit request.

If rate limited (HTTP 429), wait for the reset period before retrying.


Quickstart

Example 1: Get BTC contract details (no auth)

bash
curl -s -H "User-Agent: bitmart-skills/futures/v2026.7.14" 'https://api-cloud-v2.bitmart.com/contract/public/details?symbol=BTCUSDT'

Example 2: Get futures positions (KEYED)

bash
curl -s -H "X-BM-KEY: $BITMART_API_KEY" \
  -H "User-Agent: bitmart-skills/futures/v2026.7.14" \
  'https://api-cloud-v2.bitmart.com/contract/private/position?symbol=BTCUSDT'

Example 3: Open long BTC position (SIGNED)

bash
TIMESTAMP=$(date +%s000)
BODY='{"symbol":"BTCUSDT","side":1,"type":"market","size":1,"leverage":"10","open_type":"cross"}'
SIGN=$(echo -n "${TIMESTAMP}#${BITMART_API_MEMO}#${BODY}" | openssl dgst -sha256 -hmac "$BITMART_API_SECRET" | awk '{print $NF}')
curl -s -X POST 'https://api-cloud-v2.bitmart.com/contract/private/submit-order' \
  -H "User-Agent: bitmart-skills/futures/v2026.7.14" \
  -H "Content-Type: application/json" \
  -H "X-BM-KEY: $BITMART_API_KEY" \
  -H "X-BM-SIGN: $SIGN" \
  -H "X-BM-TIMESTAMP: $TIMESTAMP" \
  -d "$BODY"

Operation Flow

Step 0: Credential Check

Verify BITMART_API_KEY, BITMART_API_SECRET, and BITMART_API_MEMO are available via environment variables or ~/.bitmart/config.toml. If missing, STOP and guide the user to set up credentials.

Step 1: Identify User Intent

Parse user request and map to a READ or WRITE operation:

  • READ operations: market data, positions, balance, order queries, funding rates
  • WRITE operations: open/close position, set leverage, place plan order, set TP/SL, trailing stop, transfer, close all positions, fund account transfer
  • STREAM operations: real-time futures ticker/book ticker/trades/depth/funding rate, private order push, private position push

Step 1.5: Pre-Trade Position Check (MANDATORY for open/leverage operations)

Before executing ANY of: open position (POST /contract/private/submit-order with side 1 or 4), set leverage (POST /contract/private/submit-leverage), or change margin mode:

  1. Call GET /contract/private/position-v2?symbol=<SYMBOL> to check for existing positions and current margin mode (open_type)
  2. Evaluate the entire data[] array returned by position-v2 — do not assume there is only one row
  3. Parse each row's current_amount as a number before comparing it. The API returns string values such as "0".
  4. If any row's parsed current_amount is non-zero (existing position found):
    • You MUST inherit the relevant non-zero position row's leverage value — do NOT send a different leverage in the order
    • You MUST inherit the relevant non-zero position row's open_type (margin mode: cross or isolated) — do NOT send a different margin mode
    • If the user explicitly requested different leverage or margin mode: STOP and warn:

      "You have an existing [X]x [cross/isolated] [LONG/SHORT] position of [size] contracts. Changing leverage or margin mode while a position is open is commonly rejected by the API (for example, code 40012/40040). Please close the existing position first if you want to change these settings."

    • Do not attempt to change position_mode while any non-zero position row exists
    • Wait for user decision before proceeding
  5. If every row's parsed current_amount is 0: proceed with user-specified leverage and margin mode
  6. If the request becomes mode-sensitive (for example, deciding whether to switch between hedge_mode and one_way_mode, or explaining current mode-dependent behavior), call GET /contract/private/get-position-mode before making that decision. Do not treat get-position-mode as a hard prerequisite for every plain open-position flow.

Step 1.55: Pre-Mode-Switch Clean-State Check (MANDATORY when changing position mode)

position_mode is an account-wide setting. Before calling POST /contract/private/set-position-mode:

  1. Ensure Step 1.5 found no existing position (every row's parsed current_amount is 0)
  2. Call GET /contract/private/get-open-orders and verify there are no open orders on the account
  3. If any open orders or other occupied state remain: STOP and ask the user to clear them before retrying the mode switch
  4. If set-position-mode returns 40059, treat that as "account is not in a clean state for mode switching" and stop

Step 1.6: TP/SL Order Parameter Rules (MANDATORY when setting TP/SL on a position)

When the user asks to set take-profit or stop-loss on an existing futures position, use POST /contract/private/submit-tp-sl-order.

CRITICAL — Do NOT confuse these two mechanisms:

  • preset_take_profit_price / preset_stop_loss_price: optional fields on submit-order to attach TP/SL at position-open time
  • submit-tp-sl-order: standalone endpoint to set TP/SL on an already-open position — uses trigger_price + executive_price, NOT take_profit_price/stop_loss_price

Required parameters:

ParameterTypeValueNotes
symbolStringe.g. BTCUSDT
typeString"take_profit" or "stop_loss"NEVER "market" or "limit"
sideInt3 (close long) or 2 (close short)Must match position direction
trigger_priceStringActivation priceLong TP: > entry; Long SL: < entry
executive_priceString"0" for market fill; or a limit price
price_typeInt1 last price / 2 mark priceDefault: 1
plan_categoryInt1 TP/SL order / 2 Position TP/SL order (default)For existing-position TP/SL, use 2. Omitting the field currently defaults to 2, but sending 2 explicitly is clearer.

Before submitting or modifying TP/SL, call GET /contract/public/details?symbol=<SYMBOL> and truncate both trigger_price and executive_price to the symbol's price_precision tick size. The API rejects over-precise TP/SL prices with errors such as 40053.

Always submit TP and SL as two separate API calls. One call for take-profit, one for stop-loss.

Long BTC TP example: {"symbol":"BTCUSDT","type":"take_profit","side":3,"trigger_price":"72000","executive_price":"0","price_type":1,"plan_category":2} Long BTC SL example: {"symbol":"BTCUSDT","type":"stop_loss","side":3,"trigger_price":"64000","executive_price":"0","price_type":1,"plan_category":2}

Timestamp Display Rules

API responses contain Unix timestamps in different units. When displaying any timestamp to the user, always convert to human-readable local time.

FieldUnitConversion
create_time, update_time (order responses)Milliseconds÷ 1000 → Unix seconds → local time
server_time (system time)Milliseconds÷ 1000 → Unix seconds → local time
timestamp (K-line candle open time)SecondsDirect → Unix seconds → local time
open_timestamp, funding_time (contract details)Milliseconds÷ 1000 → Unix seconds → local time

Query parameter timestamps for futures endpoints (start_time, end_time) are endpoint-specific:

  • Seconds: /contract/public/kline, /contract/public/markprice-kline, /contract/private/order-history, /contract/private/trades, cross-collateral / auto-repayment query filters, and affiliate rebate endpoints (/contract/private/affiliate/...)
  • Milliseconds: /contract/private/transaction-history

Do NOT assume all futures start_time / end_time are seconds — always follow the target endpoint definition.

Display format: YYYY-MM-DD HH:MM:SS in the user's local timezone. Example: timestamp 1709971200000 (ms) → 2024-03-09 16:00:00 (UTC+8).

Common mistakes to avoid:

  • Do NOT treat millisecond timestamps as seconds (produces dates in year 55000+)
  • Do NOT display raw numeric timestamps — always convert to readable format
  • Do NOT assume UTC — convert to the user's local timezone

Step 2: Execute

  • READ: Call the API endpoint, parse response, format data for user display.

  • STREAM: Use references/websocket.md. Subscribe to the matching WebSocket channel; for private channels, access/login first with the WebSocket signature payload timestamp#memo#bitmart.WebSocket.

  • WRITE: Follow sub-steps below, then ask for "CONFIRM":

    2a. submit-order conditional param selection:

    ScenarioSendDo NOT send
    Open position, type=limit (side=1 or 4)symbol, side, type:"limit", price, size, leverage, open_type—
    Open position, type=market (side=1 or 4)symbol, side, type:"market", size, leverage, open_typeprice (ignored, causes confusion)
    Close position, type=limit (side=2 or 3)symbol, side, type:"limit", price, sizeleverage, open_type (not needed for close)
    Close position, type=market (side=2 or 3)symbol, side, type:"market", sizeprice, leverage, open_type

    Additional constraints:

    • leverage / open_type for open orders: if an existing position is found (Step 1.5), use the relevant non-zero position row's values — do NOT send different ones.
    • mode=4 (Maker Only): only valid with type=limit. Never combine with type=market.
    • preset_take_profit_price / preset_stop_loss_price: only valid for opening orders (side=1 or 4). For TP/SL on an already-open position, use submit-tp-sl-order (see Step 1.6).
    • size is always an integer (number of contracts). Check the minimum contract size via GET /contract/public/details.
    • Futures price precision: truncate every order price field to the contract's price_precision tick size from GET /contract/public/details, including limit price, plan trigger_price, TP/SL trigger_price / executive_price, and trailing-stop activation_price.

    2b. Confirm and execute: Present a summary (symbol, side, type, price if limit, size, leverage, open_type) and ask for explicit "CONFIRM" before executing.

    Close All Positions (POST /contract/private/close-all-position) — HIGH-RISK, mandatory flow:

    This endpoint market-closes positions immediately. NEVER call it directly on user request. Follow all 5 steps in order:

    1. Call GET /contract/private/position-v2 and list every position that will be closed: symbol, side, size, unrealized PnL. Use position-v2 for this check. Its position_side field is "long", "short", or "both" (the latter can appear in one-way position mode — inferred, not stated verbatim in the official docs) — but this endpoint's position_side parameter only accepts "long", "short", or omitted. NEVER pass "both". If the user uses copy trading, also check account="copy_trading" — see references/close-all-position.md for the scope caveat.
    2. Determine scope from user intent and set params accordingly:
      • symbol (optional): if set, only that symbol is closed; if empty, ALL symbols are closed
      • position_side (optional, hedge mode): long / short; if empty, both directions are closed
      • contractType (required): 1 = USDT-FUTURES, 2 = COIN-FUTURES (bare JSON number, not a quoted string — a string is rejected with 40011 Invalid parameter)
    3. Show the user the exact list of positions about to be market-closed and warn: "This will market-close the positions listed above immediately at current market price. Slippage may occur."
    4. Require explicit CONFIRM before executing. Rate limit is 1 req/1sec per UID — never retry automatically.
    5. After execution, call GET /contract/private/position-v2 again and confirm the targeted positions are gone; report the result. If any listed position remains after the re-check, do NOT re-call close-all-position automatically (rate limit 1 req/1sec) — report which positions failed to close and ask the user how to proceed (e.g. retry once after explicit confirmation, or close the remaining positions individually via submit-order).

    Fund account transfer (POST /contract/private/account/v1/transfer):

    • Required params: currency, amount (string decimal), type.
    • type enum: "fund_to_contract" (fund → futures) or "contract_to_fund" (futures → fund). (Note: do NOT use the spot endpoint's transfer-direction values here — only fund_to_contract / contract_to_fund are valid for this endpoint; the official docs' request sample for this endpoint is wrong.)
    • Uses the futures Base URL (https://api-cloud-v2.bitmart.com) despite managing the fund account.
    • Distinct from POST /account/v1/transfer-contract (#25): #25 moves spot ↔ futures; this endpoint moves fund ↔ futures.
    • Present summary (currency, amount, direction) and require explicit CONFIRM.
    • Verify after execution via GET /contract/private/assets-detail.

Step 3: Verify (WRITE only)

  • After opening a position: Call GET /contract/private/position-v2 to confirm position was opened. Report entry price, size, leverage, liquidation price, margin used.
  • After closing a position: Call GET /contract/private/position-v2 to confirm position was closed or reduced. Report realized PnL.
  • After placing an order: Call GET /contract/private/order to confirm order status.
  • After canceling an order: Call GET /contract/private/get-open-orders to verify the order is no longer open.
  • Report the verified result to the user.

See references/open-position.md, references/close-position.md, references/close-all-position.md, references/plan-order.md, and references/tp-sl.md for detailed step-by-step workflows.


References

  • API Reference — All 60 endpoints with full parameters, examples, and response fields
  • WebSocket Reference — Real-time Futures WebSocket channels, login signing, subscription formats, and changelog-only fields
  • Open Position — Step-by-step open position workflow
  • Close Position — Step-by-step close position workflow
  • Close All Positions — Step-by-step HIGH-RISK bulk market-close workflow
  • Plan Orders — Conditional/trigger order workflow
  • TP/SL — Take-profit/stop-loss workflow

Cross-Skill Workflows

Workflow 1: Transfer Funds → Open Position → Monitor

  1. bitmart-exchange-futures → POST /account/v1/transfer-contract — Transfer USDT from spot to futures
  2. bitmart-exchange-futures → POST /contract/private/submit-leverage — Set leverage
  3. bitmart-exchange-futures → POST /contract/private/submit-order — Open position (after user CONFIRM)
  4. bitmart-exchange-futures → GET /contract/private/position-v2 — Monitor position

Workflow 2: Check Spot Balance → Transfer → Open Futures

  1. bitmart-exchange-spot → GET /account/v1/wallet — Check spot balance
  2. bitmart-exchange-futures → POST /account/v1/transfer-contract — Transfer to futures
  3. bitmart-exchange-futures → POST /contract/private/submit-order — Open position

Error Handling

CodeDescriptionAction
1000SuccessProcess response normally
30002X-BM-KEY not foundCheck that API key is set correctly
30005X-BM-SIGN is wrongVerify signature generation (timestamp, memo, body format)
30006X-BM-TIMESTAMP is wrongEnsure X-BM-TIMESTAMP is present and is a Unix timestamp in milliseconds
30007Timestamp/recvWindow validation failedSync system clock (NTP), send X-BM-TIMESTAMP as Unix milliseconds, and ensure (serverTime - timestamp) <= recvWindow; recvWindow must be Long in (0,60000], default 5000 (max 60000). For signed contract flows that expose recvWindow, rely on recvWindow as the effective request-validity window.
30010IP forbiddenCheck API key IP whitelist settings
30013Rate limit exceededWait for rate limit window to reset, then retry
40035Order not existVerify the order ID is correct and belongs to this account
40044Invalid order sizeCheck min/max limits via GET /contract/public/details
40027Insufficient balanceCheck futures balance; may need to transfer from spot
42000Insufficient balance (margin)Reduce order size or add margin
40021Position does not existVerify position is still open before trying to close
40040Invalid leverage / mode constraintCheck leverage bracket and current position state; if position exists, keep current leverage + open_type
40012Parameter/state conflictCommonly appears when leverage/mode conflicts with current position/order state; query GET /contract/private/position-v2 and inherit existing leverage + open_type
429HTTP rate limitBack off exponentially, check X-BM-RateLimit-Reset header
418IP bannedStop all requests immediately; wait before retrying
403Cloudflare WAF blockCheck IP reputation (VPN/cloud IPs are commonly challenged); wait 30-60 seconds and retry; do not auto-retry more than 3 times
503Cloudflare challenge / origin unavailableSame as 403; if response body contains "Cloudflare" or "cf-", it is a Cloudflare interception, not a BitMart error; check network environment

Cloudflare Handling

BitMart API is behind Cloudflare CDN. If you receive HTTP 403/503 and the response body contains "Cloudflare", "cf-", or an HTML challenge page (instead of JSON):

  1. This is a Cloudflare interception, not a BitMart API error — do not parse as JSON
  2. Check if too many requests were sent in a short window (Cloudflare WAF has its own rules independent of API rate limits)
  3. Wait 30-60 seconds before retrying
  4. If running from a cloud server or VPN, the IP may have low reputation — try from a different network
  5. Do not auto-retry more than 3 times — inform the user if the issue persists

Cloudflare 1010: Non-curl HTTP clients with default bot-like User-Agent strings (e.g., Python-urllib, Go-http-client) may receive HTTP 403 / error 1010. Always send the User-Agent: bitmart-skills/futures/v2026.7.14 header from your HTTP library — do not rely on the library default.


Security Notes

  • Never display full API keys or secrets. Show first 5 + last 4 characters only (e.g., bmk12...9xyz).
  • All WRITE operations require explicit user confirmation before execution. Present a clear summary of the action and wait for "CONFIRM".
  • Recommend IP whitelist on API keys for additional security.
  • Recommend minimum permissions: Read-Only + Futures-Trade only (no Withdraw permission).
  • Leverage warning: Higher leverage amplifies both gains and losses. Always inform the user of the liquidation price before opening leveraged positions.
  • All trading outputs include disclaimer: "Not financial advice. You are solely responsible for your investment decisions. Futures trading carries significant risk of loss."

Reference: Order Types

TypeDescription
limitExecute at specified price or better
marketExecute immediately at best available price

Reference: Order Sides

ValueHedge ModeOne-Way Mode
1Open LongBuy
2Close ShortBuy (Reduce Only)
3Close LongSell (Reduce Only)
4Open ShortSell

Reference: Order Modes

ValueNameDescription
1GTCGood Till Cancel
2FOKFill or Kill
3IOCImmediate or Cancel
4Maker OnlyPost Only — rejected if it would immediately match

Reference: Order States

StateCodeDescription
Approving1Order being validated
Pending2Order accepted, awaiting fill
Closed4Order completed (filled or canceled)

Reference: Open Types (Margin Mode)

ValueDescription
crossCross margin — all available balance used as margin
isolatedIsolated margin — only allocated margin is at risk

Reference: Position Modes

ValueDescription
hedge_modeCan hold simultaneous long and short positions
one_way_modeCan hold only one direction at a time

Reference: Plan Categories

ValueDescription
1TP/SL order — applies to a specific order quantity
2Position TP/SL — applies to the entire position (default)

Reference: Price Types

ValueDescription
1Last price (default) — triggers based on last trade price
2Fair price (mark price) — triggers based on mark price

Reference: Price Way (Plan Orders)

ValueDescription
1Bullish — trigger when price rises above trigger_price
2Bearish — trigger when price drops below trigger_price

Reference: Transfer Types

ValueDescription
spot_to_contractSpot wallet to futures wallet
contract_to_spotFutures wallet to spot wallet

Reference: Flow Types (Transaction History)

ValueDescription
0All types
1Transfer
2Realized PNL
3Funding Fee
4Commission
6Liquidation

Reference: STP Modes (Self-Trade Prevention)

ValueDescription
1Cancel Maker (default)
2Cancel Taker
3Cancel Both

Reference: K-Line Steps

Step (minutes)Description
11-minute candles
33-minute candles
55-minute candles
1515-minute candles
3030-minute candles
601-hour candles
1202-hour candles
2404-hour candles
3606-hour candles
72012-hour candles
14401-day candles
43203-day candles
100801-week candles

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Bitmart Exchange Futures」では何ができますか?

BitMartの先物・契約取引や先物WebSocketストリームについてユーザーが質問するときに使用します。ポジションの新規作成・決済、レバレッジ設定、計画注文(条件付き注文)の発注、利確・損切り、トレーリング注文、先物ポジションの確認、先物口座の管理、ワンクリックでの全ポジション決済、資金口座と先物口座間の振替、サブアカウント間の振替、アフィリエイトやリベートに関する問い合わせ、シミュレーション取引、先物ティッカー・板ティッカー・取引・板の深さ・資金調達率・非公開注文・非公開ポジションのリアルタイム配信が対象です。現物取引には使用しないでください(bitmart-exchange-spotを使用)。

TypingMindでBitmart Exchange Futuresを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Bitmart Exchange Futuresはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにBitmart Exchange Futuresをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/bitmartexchange/bitmart-skills/tree/master/skills/bitmart-exchange-futuresを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Bitmart Exchange Futuresを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Bitmart Exchange Futuresで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもBitmart Exchange Futuresを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Bitmart Exchange Futures」は無料ですか?

bitmartexchangeがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇