Logo de Bitmart Exchange Futures

Bitmart Exchange Futures

Organização
bitmartexchange
bitmart-exchange-futures

Use quando o usuário perguntar sobre negociação de futuros ou contratos na BitMart ou sobre fluxos WebSocket de Futures, incluindo abertura e fechamento de posições, definição de alavancagem, envio de ordens plan (condicionais), take-profit/stop-loss, ordens trailing, consulta de posições em futuros, gerenciamento da conta de futuros, fechamento de todas as posições com um clique, transferências entre contas fund/futures, transferências entre subcontas, dúvidas sobre afiliados/rebates, negociação simulada ou transmissão em tempo real de ticker de futuros/book ticker/negociações/profundidade/taxa de funding/atualizações de ordens privadas e posições privadas. NÃO use para negociação à vista (use bitmart-exchange-spot).

Visão geral

Publicado porbitmartexchange
Repositóriobitmart-skills
Nome da habilidadebitmart-exchange-futures
Estrelas
33
Forks
0
Arquivos incluídos
7
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Arquivos incluídos: 7

    Scripts, templates e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente para leitura e nunca são executados.

  • Código aberto

    Publicada por bitmartexchange no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Bitmart Exchange Futures no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/bitmartexchange/bitmart-skills/tree/master/skills/bitmart-exchange-futures
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Bitmart Exchange Futures em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Bitmart Exchange Futures automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Bitmart Exchange Futures não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

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

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Bitmart Exchange Futures faz?

Use quando o usuário perguntar sobre negociação de futuros ou contratos na BitMart ou sobre fluxos WebSocket de Futures, incluindo abertura e fechamento de posições, definição de alavancagem, envio de ordens plan (condicionais), take-profit/stop-loss, ordens trailing, consulta de posições em futuros, gerenciamento da conta de futuros, fechamento de todas as posições com um clique, transferências entre contas fund/futures, transferências entre subcontas, dúvidas sobre afiliados/rebates, negociação simulada ou transmissão em tempo real de ticker de futuros/book ticker/negociações/profundidade...

Por que usar Bitmart Exchange Futures no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Bitmart Exchange Futures é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Bitmart Exchange Futures no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/bitmartexchange/bitmart-skills/tree/master/skills/bitmart-exchange-futures. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Bitmart Exchange Futures?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Bitmart Exchange Futures?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Bitmart Exchange Futures com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Bitmart Exchange Futures é gratuita?

A habilidade é publicada no GitHub por bitmartexchange. Consulte os termos de licenciamento no repositório. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇