derivatives-trading-coin-futures

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Binance Derivatives-trading-coin-futures Skill

Binance 币本位期货衍生品交易Skill

Derivatives-trading-coin-futures request on Binance using authenticated API endpoints. Requires API key and secret key for certain endpoints. Return the result in JSON format.
使用经过身份验证的API端点在Binance上发起币本位期货衍生品交易请求,部分端点需提供API key和secret key,返回结果为JSON格式。

Quick Reference

快速参考

EndpointDescriptionRequiredOptionalAuthentication
/dapi/v1/account
(GET)
Account Information (USER_DATA)NonerecvWindowYes
/dapi/v1/balance
(GET)
Futures Account Balance (USER_DATA)NonerecvWindowYes
/dapi/v1/positionSide/dual
(GET)
Get Current Position Mode(USER_DATA)NonerecvWindowYes
/dapi/v1/positionSide/dual
(POST)
Change Position Mode(TRADE)dualSidePositionrecvWindowYes
/dapi/v1/order/asyn
(GET)
Get Download Id For Futures Order History (USER_DATA)startTime, endTimerecvWindowYes
/dapi/v1/trade/asyn
(GET)
Get Download Id For Futures Trade History (USER_DATA)startTime, endTimerecvWindowYes
/dapi/v1/income/asyn
(GET)
Get Download Id For Futures Transaction History(USER_DATA)startTime, endTimerecvWindowYes
/dapi/v1/order/asyn/id
(GET)
Get Futures Order History Download Link by Id (USER_DATA)downloadIdrecvWindowYes
/dapi/v1/trade/asyn/id
(GET)
Get Futures Trade Download Link by Id(USER_DATA)downloadIdrecvWindowYes
/dapi/v1/income/asyn/id
(GET)
Get Futures Transaction History Download Link by Id (USER_DATA)downloadIdrecvWindowYes
/dapi/v1/income
(GET)
Get Income History(USER_DATA)Nonesymbol, incomeType, startTime, endTime, page, limit, recvWindowYes
/dapi/v1/leverageBracket
(GET)
Notional Bracket for Pair(USER_DATA)Nonepair, recvWindowYes
/dapi/v2/leverageBracket
(GET)
Notional Bracket for Symbol(USER_DATA)Nonesymbol, recvWindowYes
/dapi/v1/commissionRate
(GET)
User Commission Rate (USER_DATA)symbolrecvWindowYes
/dapi/v1/ticker/24hr
(GET)
24hr Ticker Price Change StatisticsNonesymbol, pairNo
/futures/data/basis
(GET)
Basispair, contractType, periodlimit, startTime, endTimeNo
/dapi/v1/time
(GET)
Check Server timeNoneNoneNo
/dapi/v1/aggTrades
(GET)
Compressed/Aggregate Trades ListsymbolfromId, startTime, endTime, limitNo
/dapi/v1/continuousKlines
(GET)
Continuous Contract Kline/Candlestick Datapair, contractType, intervalstartTime, endTime, limitNo
/dapi/v1/exchangeInfo
(GET)
Exchange InformationNoneNoneNo
/dapi/v1/fundingInfo
(GET)
Get Funding Rate InfoNoneNoneNo
/dapi/v1/fundingRate
(GET)
Get Funding Rate History of Perpetual FuturessymbolstartTime, endTime, limitNo
/dapi/v1/constituents
(GET)
Query Index Price ConstituentssymbolNoneNo
/dapi/v1/indexPriceKlines
(GET)
Index Price Kline/Candlestick Datapair, intervalstartTime, endTime, limitNo
/dapi/v1/premiumIndex
(GET)
Index Price and Mark PriceNonesymbol, pairNo
/dapi/v1/klines
(GET)
Kline/Candlestick Datasymbol, intervalstartTime, endTime, limitNo
/futures/data/globalLongShortAccountRatio
(GET)
Long/Short Ratiopair, periodlimit, startTime, endTimeNo
/dapi/v1/markPriceKlines
(GET)
Mark Price Kline/Candlestick Datasymbol, intervalstartTime, endTime, limitNo
/dapi/v1/historicalTrades
(GET)
Old Trades Lookup(MARKET_DATA)symbollimit, fromIdNo
/futures/data/openInterestHist
(GET)
Open Interest Statisticspair, contractType, periodlimit, startTime, endTimeNo
/dapi/v1/openInterest
(GET)
Open InterestsymbolNoneNo
/dapi/v1/depth
(GET)
Order BooksymbollimitNo
/dapi/v1/premiumIndexKlines
(GET)
Premium index Kline Datasymbol, intervalstartTime, endTime, limitNo
/dapi/v1/trades
(GET)
Recent Trades ListsymbollimitNo
/dapi/v1/ticker/bookTicker
(GET)
Symbol Order Book TickerNonesymbol, pairNo
/dapi/v1/ticker/price
(GET)
Symbol Price TickerNonesymbol, pairNo
/futures/data/takerBuySellVol
(GET)
Taker Buy/Sell Volumepair, contractType, periodlimit, startTime, endTimeNo
/dapi/v1/ping
(GET)
Test ConnectivityNoneNoneNo
/futures/data/topLongShortAccountRatio
(GET)
Top Trader Long/Short Ratio (Accounts)symbol, periodlimit, startTime, endTimeNo
/futures/data/topLongShortPositionRatio
(GET)
Top Trader Long/Short Ratio (Positions)pair, periodlimit, startTime, endTimeNo
/dapi/v1/pmAccountInfo
(GET)
Classic Portfolio Margin Account Information (USER_DATA)assetrecvWindowYes
/dapi/v1/userTrades
(GET)
Account Trade List (USER_DATA)Nonesymbol, pair, orderId, startTime, endTime, fromId, limit, recvWindowYes
/dapi/v1/allOrders
(GET)
All Orders (USER_DATA)Nonesymbol, pair, orderId, startTime, endTime, limit, recvWindowYes
/dapi/v1/countdownCancelAll
(POST)
Auto-Cancel All Open Orders (TRADE)symbol, countdownTimerecvWindowYes
/dapi/v1/allOpenOrders
(DELETE)
Cancel All Open Orders(TRADE)symbolrecvWindowYes
/dapi/v1/batchOrders
(DELETE)
Cancel Multiple Orders(TRADE)symbolorderIdList, origClientOrderIdList, recvWindowYes
/dapi/v1/batchOrders
(PUT)
Modify Multiple Orders(TRADE)batchOrdersrecvWindowYes
/dapi/v1/batchOrders
(POST)
Place Multiple Orders(TRADE)batchOrdersrecvWindowYes
/dapi/v1/order
(DELETE)
Cancel Order (TRADE)symbolorderId, origClientOrderId, recvWindowYes
/dapi/v1/order
(PUT)
Modify Order (TRADE)symbol, sideorderId, origClientOrderId, quantity, price, priceMatch, recvWindowYes
/dapi/v1/order
(POST)
New Order (TRADE)symbol, side, typepositionSide, timeInForce, quantity, reduceOnly, price, newClientOrderId, stopPrice, closePosition, activationPrice, callbackRate, workingType, priceProtect, newOrderRespType, priceMatch, selfTradePreventionMode, recvWindowYes
/dapi/v1/order
(GET)
Query Order (USER_DATA)symbolorderId, origClientOrderId, recvWindowYes
/dapi/v1/leverage
(POST)
Change Initial Leverage (TRADE)symbol, leveragerecvWindowYes
/dapi/v1/marginType
(POST)
Change Margin Type (TRADE)symbol, marginTyperecvWindowYes
/dapi/v1/openOrders
(GET)
Current All Open Orders (USER_DATA)Nonesymbol, pair, recvWindowYes
/dapi/v1/orderAmendment
(GET)
Get Order Modify History (USER_DATA)symbolorderId, origClientOrderId, startTime, endTime, limit, recvWindowYes
/dapi/v1/positionMargin/history
(GET)
Get Position Margin Change History(TRADE)symboltype, startTime, endTime, limit, recvWindowYes
/dapi/v1/positionMargin
(POST)
Modify Isolated Position Margin(TRADE)symbol, amount, typepositionSide, recvWindowYes
/dapi/v1/adlQuantile
(GET)
Position ADL Quantile Estimation(USER_DATA)Nonesymbol, recvWindowYes
/dapi/v1/positionRisk
(GET)
Position Information(USER_DATA)NonemarginAsset, pair, recvWindowYes
/dapi/v1/openOrder
(GET)
Query Current Open Order(USER_DATA)symbolorderId, origClientOrderId, recvWindowYes
/dapi/v1/forceOrders
(GET)
User's Force Orders(USER_DATA)Nonesymbol, autoCloseType, startTime, endTime, limit, recvWindowYes
/dapi/v1/listenKey
(DELETE)
Close User Data Stream(USER_STREAM)NoneNoneNo
/dapi/v1/listenKey
(PUT)
Keepalive User Data Stream (USER_STREAM)NoneNoneNo
/dapi/v1/listenKey
(POST)
Start User Data Stream (USER_STREAM)NoneNoneNo

端点描述必填参数可选参数是否需要身份验证
/dapi/v1/account
(GET)
账户信息(USER_DATA)recvWindow
/dapi/v1/balance
(GET)
期货账户余额(USER_DATA)recvWindow
/dapi/v1/positionSide/dual
(GET)
获取当前持仓模式(USER_DATA)recvWindow
/dapi/v1/positionSide/dual
(POST)
修改持仓模式(TRADE)dualSidePositionrecvWindow
/dapi/v1/order/asyn
(GET)
获取期货订单历史下载ID(USER_DATA)startTime, endTimerecvWindow
/dapi/v1/trade/asyn
(GET)
获取期货交易历史下载ID(USER_DATA)startTime, endTimerecvWindow
/dapi/v1/income/asyn
(GET)
获取期货交易流水历史下载ID(USER_DATA)startTime, endTimerecvWindow
/dapi/v1/order/asyn/id
(GET)
通过ID获取期货订单历史下载链接(USER_DATA)downloadIdrecvWindow
/dapi/v1/trade/asyn/id
(GET)
通过ID获取期货交易历史下载链接(USER_DATA)downloadIdrecvWindow
/dapi/v1/income/asyn/id
(GET)
通过ID获取期货交易流水历史下载链接(USER_DATA)downloadIdrecvWindow
/dapi/v1/income
(GET)
获取收益历史(USER_DATA)symbol, incomeType, startTime, endTime, page, limit, recvWindow
/dapi/v1/leverageBracket
(GET)
交易对名义金额档位(USER_DATA)pair, recvWindow
/dapi/v2/leverageBracket
(GET)
交易品种名义金额档位(USER_DATA)symbol, recvWindow
/dapi/v1/commissionRate
(GET)
用户手续费率(USER_DATA)symbolrecvWindow
/dapi/v1/ticker/24hr
(GET)
24小时价格变动统计symbol, pair
/futures/data/basis
(GET)
基差pair, contractType, periodlimit, startTime, endTime
/dapi/v1/time
(GET)
检查服务器时间
/dapi/v1/aggTrades
(GET)
压缩/聚合交易列表symbolfromId, startTime, endTime, limit
/dapi/v1/continuousKlines
(GET)
连续合约K线/蜡烛图数据pair, contractType, intervalstartTime, endTime, limit
/dapi/v1/exchangeInfo
(GET)
交易所信息
/dapi/v1/fundingInfo
(GET)
获取资金费率信息
/dapi/v1/fundingRate
(GET)
获取永续期货资金费率历史symbolstartTime, endTime, limit
/dapi/v1/constituents
(GET)
查询指数价格成分symbol
/dapi/v1/indexPriceKlines
(GET)
指数价格K线/蜡烛图数据pair, intervalstartTime, endTime, limit
/dapi/v1/premiumIndex
(GET)
指数价格与标记价格symbol, pair
/dapi/v1/klines
(GET)
K线/蜡烛图数据symbol, intervalstartTime, endTime, limit
/futures/data/globalLongShortAccountRatio
(GET)
多空账户比率pair, periodlimit, startTime, endTime
/dapi/v1/markPriceKlines
(GET)
标记价格K线/蜡烛图数据symbol, intervalstartTime, endTime, limit
/dapi/v1/historicalTrades
(GET)
历史交易查询(MARKET_DATA)symbollimit, fromId
/futures/data/openInterestHist
(GET)
持仓量统计pair, contractType, periodlimit, startTime, endTime
/dapi/v1/openInterest
(GET)
持仓量symbol
/dapi/v1/depth
(GET)
订单簿symbollimit
/dapi/v1/premiumIndexKlines
(GET)
溢价指数K线数据symbol, intervalstartTime, endTime, limit
/dapi/v1/trades
(GET)
近期交易列表symbollimit
/dapi/v1/ticker/bookTicker
(GET)
品种订单簿行情symbol, pair
/dapi/v1/ticker/price
(GET)
品种价格行情symbol, pair
/futures/data/takerBuySellVol
(GET)
Taker买卖量pair, contractType, periodlimit, startTime, endTime
/dapi/v1/ping
(GET)
测试连通性
/futures/data/topLongShortAccountRatio
(GET)
顶级交易者多空账户比率symbol, periodlimit, startTime, endTime
/futures/data/topLongShortPositionRatio
(GET)
顶级交易者多空持仓比率pair, periodlimit, startTime, endTime
/dapi/v1/pmAccountInfo
(GET)
经典组合保证金账户信息(USER_DATA)assetrecvWindow
/dapi/v1/userTrades
(GET)
账户交易列表(USER_DATA)symbol, pair, orderId, startTime, endTime, fromId, limit, recvWindow
/dapi/v1/allOrders
(GET)
所有订单(USER_DATA)symbol, pair, orderId, startTime, endTime, limit, recvWindow
/dapi/v1/countdownCancelAll
(POST)
自动取消所有挂单(TRADE)symbol, countdownTimerecvWindow
/dapi/v1/allOpenOrders
(DELETE)
取消所有挂单(TRADE)symbolrecvWindow
/dapi/v1/batchOrders
(DELETE)
批量取消订单(TRADE)symbolorderIdList, origClientOrderIdList, recvWindow
/dapi/v1/batchOrders
(PUT)
批量修改订单(TRADE)batchOrdersrecvWindow
/dapi/v1/batchOrders
(POST)
批量下单(TRADE)batchOrdersrecvWindow
/dapi/v1/order
(DELETE)
取消订单(TRADE)symbolorderId, origClientOrderId, recvWindow
/dapi/v1/order
(PUT)
修改订单(TRADE)symbol, sideorderId, origClientOrderId, quantity, price, priceMatch, recvWindow
/dapi/v1/order
(POST)
下单(TRADE)symbol, side, typepositionSide, timeInForce, quantity, reduceOnly, price, newClientOrderId, stopPrice, closePosition, activationPrice, callbackRate, workingType, priceProtect, newOrderRespType, priceMatch, selfTradePreventionMode, recvWindow
/dapi/v1/order
(GET)
查询订单(USER_DATA)symbolorderId, origClientOrderId, recvWindow
/dapi/v1/leverage
(POST)
修改初始杠杆(TRADE)symbol, leveragerecvWindow
/dapi/v1/marginType
(POST)
修改保证金模式(TRADE)symbol, marginTyperecvWindow
/dapi/v1/openOrders
(GET)
当前所有挂单(USER_DATA)symbol, pair, recvWindow
/dapi/v1/orderAmendment
(GET)
获取订单修改历史(USER_DATA)symbolorderId, origClientOrderId, startTime, endTime, limit, recvWindow
/dapi/v1/positionMargin/history
(GET)
获取持仓保证金变更历史(TRADE)symboltype, startTime, endTime, limit, recvWindow
/dapi/v1/positionMargin
(POST)
修改逐仓持仓保证金(TRADE)symbol, amount, typepositionSide, recvWindow
/dapi/v1/adlQuantile
(GET)
持仓ADL分位数估算(USER_DATA)symbol, recvWindow
/dapi/v1/positionRisk
(GET)
持仓信息(USER_DATA)marginAsset, pair, recvWindow
/dapi/v1/openOrder
(GET)
查询当前挂单(USER_DATA)symbolorderId, origClientOrderId, recvWindow
/dapi/v1/forceOrders
(GET)
用户强平订单(USER_DATA)symbol, autoCloseType, startTime, endTime, limit, recvWindow
/dapi/v1/listenKey
(DELETE)
关闭用户数据流(USER_STREAM)
/dapi/v1/listenKey
(PUT)
保持用户数据流活跃(USER_STREAM)
/dapi/v1/listenKey
(POST)
启动用户数据流(USER_STREAM)

Parameters

参数

Common Parameters

通用参数

  • recvWindow: (e.g., 5000)
  • startTime: Timestamp in ms (e.g., 1623319461670)
  • endTime: Timestamp in ms (e.g., 1641782889000)
  • downloadId: get by download id api (e.g., 1)
  • symbol:
  • incomeType: "TRANSFER","WELCOME_BONUS", "FUNDING_FEE", "REALIZED_PNL", "COMMISSION", "INSURANCE_CLEAR", and "DELIVERED_SETTELMENT"
  • startTime: (e.g., 1623319461670)
  • endTime: (e.g., 1641782889000)
  • page:
  • limit: Default 100; max 1000 (e.g., 100)
  • pair:
  • symbol:
  • pair: BTCUSD
  • fromId: ID to get aggregate trades from INCLUSIVE. (e.g., 1)
  • asset:
  • orderId: (e.g., 1)
  • orderId: (e.g., 1)
  • countdownTime: countdown time, 1000 for 1 second. 0 to cancel the timer
  • orderIdList: max length 10 e.g. [1234567,2345678]
  • origClientOrderIdList: max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma.
  • origClientOrderId: (e.g., 1)
  • leverage: target initial leverage: int from 1 to 125
  • dualSidePosition: "true": Hedge Mode; "false": One-way Mode
  • type: 1: Add position margin,2: Reduce position margin
  • amount: (e.g., 1.0)
  • batchOrders: order list. Max 5 orders
  • quantity: quantity measured by contract number, Cannot be sent with
    closePosition
    =
    true
    (e.g., 1.0)
  • price: (e.g., 1.0)
  • reduceOnly: "true" or "false". default "false". Cannot be sent in Hedge Mode; cannot be sent with
    closePosition
    =
    true
    (Close-All)
  • newClientOrderId: A unique id among open orders. Automatically generated if not sent. Can only be string following the rule:
    ^[\.A-Z\:/a-z0-9_-]{1,36}$
    (e.g., 1)
  • stopPrice: Used with
    STOP/STOP_MARKET
    or
    TAKE_PROFIT/TAKE_PROFIT_MARKET
    orders. (e.g., 1.0)
  • closePosition:
    true
    ,
    false
    ;Close-All,used with
    STOP_MARKET
    or
    TAKE_PROFIT_MARKET
    .
  • activationPrice: Used with
    TRAILING_STOP_MARKET
    orders, default as the latest price(supporting different
    workingType
    ) (e.g., 1.0)
  • callbackRate: Used with
    TRAILING_STOP_MARKET
    orders, min 0.1, max 10 where 1 for 1% (e.g., 1.0)
  • priceProtect: "TRUE" or "FALSE", default "FALSE". Used with
    STOP/STOP_MARKET
    or
    TAKE_PROFIT/TAKE_PROFIT_MARKET
    orders.
  • batchOrders: order list. Max 5 orders
  • marginAsset:
  • recvWindow: (例如:5000)
  • startTime: 毫秒级时间戳(例如:1623319461670)
  • endTime: 毫秒级时间戳(例如:1641782889000)
  • downloadId: 通过下载ID接口获取(例如:1)
  • symbol:
  • incomeType: 可选值包括"TRANSFER"、"WELCOME_BONUS"、"FUNDING_FEE"、"REALIZED_PNL"、"COMMISSION"、"INSURANCE_CLEAR"和"DELIVERED_SETTELMENT"
  • page:
  • limit: 默认100,最大值1000(例如:100)
  • pair:
  • fromId: 获取聚合交易的起始ID(包含该ID,例如:1)
  • asset:
  • orderId: (例如:1)
  • countdownTime: 倒计时时间,1000代表1秒,设为0可取消计时器
  • orderIdList: 最大长度10,示例:[1234567,2345678]
  • origClientOrderIdList: 最大长度10,示例:["my_id_1","my_id_2"],需转义双引号,逗号后无空格
  • origClientOrderId: (例如:1)
  • leverage: 目标初始杠杆,取值范围1-125的整数
  • dualSidePosition: "true"表示对冲模式,"false"表示单向模式
  • type: 1表示增加持仓保证金,2表示减少持仓保证金
  • amount: (例如:1.0)
  • batchOrders: 订单列表,最多5个订单
  • quantity: 合约数量,当
    closePosition
    =
    true
    时不可传入该参数(例如:1.0)
  • price: (例如:1.0)
  • reduceOnly: "true"或"false",默认"false",对冲模式下不可传入;当
    closePosition
    =
    true
    (全平)时不可传入
  • newClientOrderId: 挂单中的唯一标识,若未传入则自动生成,格式需符合规则:
    ^[\.A-Z\:/a-z0-9_-]{1,36}$
    (例如:1)
  • stopPrice: 用于
    STOP/STOP_MARKET
    TAKE_PROFIT/TAKE_PROFIT_MARKET
    订单(例如:1.0)
  • closePosition:
    true
    false
    ,用于
    STOP_MARKET
    TAKE_PROFIT_MARKET
    订单的全平功能
  • activationPrice: 用于
    TRAILING_STOP_MARKET
    订单,默认值为最新价格(支持不同
    workingType
    ,例如:1.0)
  • callbackRate: 用于
    TRAILING_STOP_MARKET
    订单,最小值0.1,最大值10,1代表1%(例如:1.0)
  • priceProtect: "TRUE"或"FALSE",默认"FALSE",用于
    STOP/STOP_MARKET
    TAKE_PROFIT/TAKE_PROFIT_MARKET
    订单
  • marginAsset:

Enums

枚举值

  • contractType: PERPETUAL | CURRENT_QUARTER | NEXT_QUARTER | CURRENT_QUARTER_DELIVERING | NEXT_QUARTER_DELIVERING | PERPETUAL_DELIVERING
  • period: 5m | 15m | 30m | 1h | 2h | 4h | 6h | 12h | 1d
  • interval: 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M
  • marginType: ISOLATED | CROSSED
  • positionSide: BOTH | LONG | SHORT
  • type: LIMIT | MARKET | STOP | STOP_MARKET | TAKE_PROFIT | TAKE_PROFIT_MARKET | TRAILING_STOP_MARKET
  • side: BUY | SELL
  • priceMatch: NONE | OPPONENT | OPPONENT_5 | OPPONENT_10 | OPPONENT_20 | QUEUE | QUEUE_5 | QUEUE_10 | QUEUE_20
  • timeInForce: GTC | IOC | FOK | GTX
  • workingType: MARK_PRICE | CONTRACT_PRICE
  • newOrderRespType: ACK | RESULT
  • selfTradePreventionMode: NONE | EXPIRE_TAKER | EXPIRE_BOTH | EXPIRE_MAKER
  • autoCloseType: LIQUIDATION | ADL
  • contractType: PERPETUAL | CURRENT_QUARTER | NEXT_QUARTER | CURRENT_QUARTER_DELIVERING | NEXT_QUARTER_DELIVERING | PERPETUAL_DELIVERING
  • period: 5m | 15m | 30m | 1h | 2h | 4h | 6h | 12h | 1d
  • interval: 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M
  • marginType: ISOLATED | CROSSED
  • positionSide: BOTH | LONG | SHORT
  • type: LIMIT | MARKET | STOP | STOP_MARKET | TAKE_PROFIT | TAKE_PROFIT_MARKET | TRAILING_STOP_MARKET
  • side: BUY | SELL
  • priceMatch: NONE | OPPONENT | OPPONENT_5 | OPPONENT_10 | OPPONENT_20 | QUEUE | QUEUE_5 | QUEUE_10 | QUEUE_20
  • timeInForce: GTC | IOC | FOK | GTX
  • workingType: MARK_PRICE | CONTRACT_PRICE
  • newOrderRespType: ACK | RESULT
  • selfTradePreventionMode: NONE | EXPIRE_TAKER | EXPIRE_BOTH | EXPIRE_MAKER
  • autoCloseType: LIQUIDATION | ADL

Authentication

身份验证

For endpoints that require authentication, you will need to provide Binance API credentials. Required credentials:
  • apiKey: Your Binance API key (for header)
  • secretKey: Your Binance API secret (for signing)
Base URLs:
对于需要身份验证的端点,你需要提供Binance API凭证。 所需凭证:
  • apiKey: 你的Binance API密钥(用于请求头)
  • secretKey: 你的Binance密钥(用于签名)
基础URL:

Security

安全规范

Share Credentials

凭证共享

Users can provide Binance API credentials by sending a file where the content is in the following format:
bash
abc123...xyz
secret123...key
用户可通过文件提供Binance API凭证,文件内容格式如下:
bash
abc123...xyz
secret123...key

Never Disclose API Key and Secret

切勿泄露API密钥

Never disclose the location of the API key and secret file.
Never send the API key and secret to any website other than Mainnet and Testnet.
切勿泄露API密钥和密钥文件的存储位置。 切勿向主网和测试网以外的任何网站发送API密钥和密钥。

Never Display Full Secrets

切勿显示完整密钥

When showing credentials to users:
  • API Key: Show first 5 + last 4 characters:
    su1Qc...8akf
  • Secret Key: Always mask, show only last 5:
    ***...aws1
Example response when asked for credentials: Account: main API Key: su1Qc...8akf Secret: ***...aws1 Environment: Mainnet
向用户展示凭证时:
  • API Key: 仅显示前5位和后4位字符,例如:
    su1Qc...8akf
  • Secret Key: 始终隐藏,仅显示最后5位字符,例如:
    ***...aws1
询问凭证时的示例回复: 账户:main API Key: su1Qc...8akf Secret: ***...aws1 环境:主网

Listing Accounts

账户列表展示

When listing accounts, show names and environment only — never keys: Binance Accounts:
  • main (Mainnet/Testnet)
  • testnet-dev (Testnet)
  • futures-keys (Mainnet)
展示账户列表时,仅显示账户名称和环境,绝不显示密钥: Binance账户列表:
  • main(主网/测试网)
  • testnet-dev(测试网)
  • futures-keys(主网)

Transactions in Mainnet

主网交易

When performing transactions in mainnet, always confirm with the user before proceeding by asking them to write "CONFIRM" to proceed.

在主网执行交易时,必须先请用户输入"CONFIRM"进行确认,再继续操作。

Binance Accounts

Binance账户示例

main

main

  • API Key: your_mainnet_api_key
  • Secret: your_mainnet_secret
  • Testnet: false
  • API Key: your_mainnet_api_key
  • Secret: your_mainnet_secret
  • Testnet: false

testnet-dev

testnet-dev

  • API Key: your_testnet_api_key
  • Secret: your_testnet_secret
  • Testnet: true
  • API Key: your_testnet_api_key
  • Secret: your_testnet_secret
  • Testnet: true

TOOLS.md Structure

TOOLS.md文件结构

bash
undefined
bash
undefined

Binance Accounts

Binance Accounts

main

main

  • API Key: abc123...xyz
  • Secret: secret123...key
  • Testnet: false
  • Description: Primary trading account
  • API Key: abc123...xyz
  • Secret: secret123...key
  • Testnet: false
  • Description: Primary trading account

testnet-dev

testnet-dev

  • API Key: test456...abc
  • Secret: testsecret...xyz
  • Testnet: true
  • Description: Development/testing
  • API Key: test456...abc
  • Secret: testsecret...xyz
  • Testnet: true
  • Description: Development/testing

futures-keys

futures-keys

  • API Key: futures789...def
  • Secret: futuressecret...uvw
  • Testnet: false
  • Description: Futures trading account
undefined
  • API Key: futures789...def
  • Secret: futuressecret...uvw
  • Testnet: false
  • Description: Futures trading account
undefined

Agent Behavior

Agent行为规范

  1. Credentials requested: Mask secrets (show last 5 chars only)
  2. Listing accounts: Show names and environment, never keys
  3. Account selection: Ask if ambiguous, default to main
  4. When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed
  5. New credentials: Prompt for name, environment, signing mode
  1. 请求凭证时:隐藏密钥(仅显示最后5位字符)
  2. 展示账户列表时:仅显示名称和环境,绝不显示密钥
  3. 账户选择:若存在歧义则询问用户,默认选择main账户
  4. 在主网执行交易时:必须先请用户输入"CONFIRM"确认后再继续
  5. 添加新凭证时:提示用户输入账户名称、环境和签名模式

Adding New Accounts

添加新账户

When user provides new credentials:
  • Ask for account name
  • Ask: Mainnet, Testnet
  • Store in
    TOOLS.md
    with masked display confirmation
当用户提供新凭证时:
  • 询问账户名称
  • 询问:主网还是测试网
  • 将凭证存储到
    TOOLS.md
    中,并向用户展示隐藏后的凭证以确认

Signing Requests

请求签名

For trading endpoints that require a signature:
  1. Build query string with all parameters, including the timestamp (Unix ms).
  2. Percent-encode the parameters using UTF-8 according to RFC 3986.
  3. Sign query string with secretKey using HMAC SHA256, RSA, or Ed25519 (depending on the account configuration).
  4. Append signature to query string.
  5. Include
    X-MBX-APIKEY
    header.
Otherwise, do not perform steps 3–5.
对于需要签名的交易端点:
  1. 构建包含所有参数的查询字符串,包括时间戳(毫秒级Unix时间)
  2. 根据RFC 3986标准,使用UTF-8对参数进行百分号编码
  3. 使用secretKey通过HMAC SHA256、RSA或Ed25519算法对查询字符串签名(取决于账户配置)
  4. 将签名追加到查询字符串中
  5. 在请求头中包含
    X-MBX-APIKEY
若无需签名,则跳过步骤3-5。

New Client Order ID

新客户端订单ID规则

For endpoints that include the
newClientOrderId
parameter, the value must always start with
agent-
. If the parameter is not provided,
agent-
followed by 18 random alphanumeric characters will be generated automatically. If a value is provided, it will be prefixed with
agent-
Example:
agent-1a2b3c4d5e6f7g8h9i
对于包含
newClientOrderId
参数的端点,参数值必须以
agent-
开头。若用户未提供该参数,则自动生成
agent-
后接18位随机字母数字字符的ID;若用户提供了值,则在其值前添加
agent-
前缀。
示例:
agent-1a2b3c4d5e6f7g8h9i

User Agent Header

用户代理请求头

Include
User-Agent
header with the following string:
binance-derivatives-trading-coin-futures/1.0.0 (Skill)
See
references/authentication.md
for implementation details.
请求头中需包含
User-Agent
,值为:
binance-derivatives-trading-coin-futures/1.0.0 (Skill)
实现细节请参考
references/authentication.md