margin-trading
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBinance Margin-trading Skill
币安保证金交易Skill
Margin-trading request on Binance using authenticated API endpoints. Requires API key and secret key for certain endpoints. Return the result in JSON format.
通过经过身份验证的API端点发起币安保证金交易请求,部分端点需要提供API key和secret key,返回结果为JSON格式。
Quick Reference
快速参考
| Endpoint | Description | Required | Optional | Authentication |
|---|---|---|---|---|
| Adjust cross margin max leverage (USER_DATA) | maxLeverage | None | Yes |
| Disable Isolated Margin Account (TRADE) | symbol | recvWindow | Yes |
| Enable Isolated Margin Account (TRADE) | symbol | recvWindow | Yes |
| Query Isolated Margin Account Info (USER_DATA) | None | symbols, recvWindow | Yes |
| Get BNB Burn Status (USER_DATA) | None | recvWindow | Yes |
| Get Summary of Margin account (USER_DATA) | None | recvWindow | Yes |
| Query Cross Isolated Margin Capital Flow (USER_DATA) | None | asset, symbol, type, startTime, endTime, fromId, limit, recvWindow | Yes |
| Query Cross Margin Account Details (USER_DATA) | None | recvWindow | Yes |
| Query Cross Margin Fee Data (USER_DATA) | None | vipLevel, coin, recvWindow | Yes |
| Query Enabled Isolated Margin Account Limit (USER_DATA) | None | recvWindow | Yes |
| Query Isolated Margin Fee Data (USER_DATA) | None | vipLevel, symbol, recvWindow | Yes |
| Get Interest History (USER_DATA) | None | asset, isolatedSymbol, startTime, endTime, current, size, recvWindow | Yes |
| Get future hourly interest rate (USER_DATA) | assets, isIsolated | None | Yes |
| Margin account borrow/repay(MARGIN) | asset, isIsolated, symbol, amount, type | recvWindow | Yes |
| Query borrow/repay records in Margin account(USER_DATA) | type | asset, isolatedSymbol, txId, startTime, endTime, current, size, recvWindow | Yes |
| Query Margin Interest Rate History (USER_DATA) | asset | vipLevel, startTime, endTime, recvWindow | Yes |
| Query Max Borrow (USER_DATA) | asset | isolatedSymbol, recvWindow | Yes |
| Cross margin collateral ratio (MARKET_DATA) | None | None | No |
| Get All Cross Margin Pairs (MARKET_DATA) | None | symbol | No |
| Get All Isolated Margin Symbol(MARKET_DATA) | None | symbol, recvWindow | No |
| Get All Margin Assets (MARKET_DATA) | None | asset | No |
| Get Delist Schedule (MARKET_DATA) | None | recvWindow | No |
| Get Limit Price Pairs(MARKET_DATA) | None | None | No |
| Get list Schedule (MARKET_DATA) | None | recvWindow | No |
| Get Margin Asset Risk-Based Liquidation Ratio (MARKET_DATA) | None | None | No |
| Get Margin Restricted Assets (MARKET_DATA) | None | None | No |
| Query Isolated Margin Tier Data (USER_DATA) | symbol | tier, recvWindow | Yes |
| Query Liability Coin Leverage Bracket in Cross Margin Pro Mode(MARKET_DATA) | None | None | No |
| Query Margin PriceIndex (MARKET_DATA) | symbol | None | No |
| Query Margin Available Inventory(USER_DATA) | type | None | Yes |
| Close User Data Stream (USER_STREAM) | None | None | No |
| Keepalive User Data Stream (USER_STREAM) | listenKey | None | No |
| Start User Data Stream (USER_STREAM) | None | None | No |
| Create Special Key(Low-Latency Trading)(TRADE) | apiName | symbol, ip, publicKey, permissionMode, recvWindow | Yes |
| Delete Special Key(Low-Latency Trading)(TRADE) | None | apiName, symbol, recvWindow | Yes |
| Query Special key(Low Latency Trading)(TRADE) | None | symbol, recvWindow | Yes |
| Edit ip for Special Key(Low-Latency Trading)(TRADE) | ip | symbol, recvWindow | Yes |
| Get Force Liquidation Record (USER_DATA) | None | startTime, endTime, isolatedSymbol, current, size, recvWindow | Yes |
| Get Small Liability Exchange Coin List (USER_DATA) | None | recvWindow | Yes |
| Small Liability Exchange (MARGIN) | assetNames | recvWindow | Yes |
| Get Small Liability Exchange History (USER_DATA) | current, size | startTime, endTime, recvWindow | Yes |
| Margin Account Cancel all Open Orders on a Symbol (TRADE) | symbol | isIsolated, recvWindow | Yes |
| Query Margin Account's Open Orders (USER_DATA) | None | symbol, isIsolated, recvWindow | Yes |
| Margin Account Cancel OCO (TRADE) | symbol | isIsolated, orderListId, listClientOrderId, newClientOrderId, recvWindow | Yes |
| Query Margin Account's OCO (USER_DATA) | None | isIsolated, symbol, orderListId, origClientOrderId, recvWindow | Yes |
| Margin Account Cancel Order (TRADE) | symbol | isIsolated, orderId, origClientOrderId, newClientOrderId, recvWindow | Yes |
| Margin Account New Order (TRADE) | symbol, side, type | isIsolated, quantity, quoteOrderQty, price, stopPrice, newClientOrderId, icebergQty, newOrderRespType, sideEffectType, timeInForce, selfTradePreventionMode, autoRepayAtCancel, recvWindow | Yes |
| Query Margin Account's Order (USER_DATA) | symbol | isIsolated, orderId, origClientOrderId, recvWindow | Yes |
| Margin Account New OCO (TRADE) | symbol, side, quantity, price, stopPrice | isIsolated, listClientOrderId, limitClientOrderId, limitIcebergQty, stopClientOrderId, stopLimitPrice, stopIcebergQty, stopLimitTimeInForce, newOrderRespType, sideEffectType, selfTradePreventionMode, autoRepayAtCancel, recvWindow | Yes |
| Margin Account New OTO (TRADE) | symbol, workingType, workingSide, workingPrice, workingQuantity, workingIcebergQty, pendingType, pendingSide, pendingQuantity | isIsolated, listClientOrderId, newOrderRespType, sideEffectType, selfTradePreventionMode, autoRepayAtCancel, workingClientOrderId, workingTimeInForce, pendingClientOrderId, pendingPrice, pendingStopPrice, pendingTrailingDelta, pendingIcebergQty, pendingTimeInForce | Yes |
| Margin Account New OTOCO (TRADE) | symbol, workingType, workingSide, workingPrice, workingQuantity, pendingSide, pendingQuantity, pendingAboveType | isIsolated, sideEffectType, autoRepayAtCancel, listClientOrderId, newOrderRespType, selfTradePreventionMode, workingClientOrderId, workingIcebergQty, workingTimeInForce, pendingAboveClientOrderId, pendingAbovePrice, pendingAboveStopPrice, pendingAboveTrailingDelta, pendingAboveIcebergQty, pendingAboveTimeInForce, pendingBelowType, pendingBelowClientOrderId, pendingBelowPrice, pendingBelowStopPrice, pendingBelowTrailingDelta, pendingBelowIcebergQty, pendingBelowTimeInForce | Yes |
| Margin Manual Liquidation(MARGIN) | type | symbol, recvWindow | Yes |
| Query Current Margin Order Count Usage (TRADE) | None | isIsolated, symbol, recvWindow | Yes |
| Query Margin Account's all OCO (USER_DATA) | None | isIsolated, symbol, fromId, startTime, endTime, limit, recvWindow | Yes |
| Query Margin Account's All Orders (USER_DATA) | symbol | isIsolated, orderId, startTime, endTime, limit, recvWindow | Yes |
| Query Margin Account's Open OCO (USER_DATA) | None | isIsolated, symbol, recvWindow | Yes |
| Query Margin Account's Trade List (USER_DATA) | symbol | isIsolated, orderId, startTime, endTime, fromId, limit, recvWindow | Yes |
| Query Prevented Matches(USER_DATA) | symbol | preventedMatchId, orderId, fromPreventedMatchId, recvWindow, isIsolated | Yes |
| Query Special key List(Low Latency Trading)(TRADE) | None | symbol, recvWindow | Yes |
| Get Cross Margin Transfer History (USER_DATA) | None | asset, type, startTime, endTime, current, size, isolatedSymbol, recvWindow | Yes |
| Query Max Transfer-Out Amount (USER_DATA) | asset | isolatedSymbol, recvWindow | Yes |
| Endpoint | 描述 | 必填 | 选填 | 是否需要鉴权 |
|---|---|---|---|---|
| 调整全仓保证金最高杠杆(USER_DATA) | maxLeverage | 无 | 是 |
| 禁用逐仓保证金账户(TRADE) | symbol | recvWindow | 是 |
| 启用逐仓保证金账户(TRADE) | symbol | recvWindow | 是 |
| 查询逐仓保证金账户信息(USER_DATA) | 无 | symbols, recvWindow | 是 |
| 获取BNB销毁状态(USER_DATA) | 无 | recvWindow | 是 |
| 获取保证金账户汇总信息(USER_DATA) | 无 | recvWindow | 是 |
| 查询全仓/逐仓保证金资金流水(USER_DATA) | 无 | asset, symbol, type, startTime, endTime, fromId, limit, recvWindow | 是 |
| 查询全仓保证金账户详情(USER_DATA) | 无 | recvWindow | 是 |
| 查询全仓保证金费率数据(USER_DATA) | 无 | vipLevel, coin, recvWindow | 是 |
| 查询已启用的逐仓保证金账户数量上限(USER_DATA) | 无 | recvWindow | 是 |
| 查询逐仓保证金费率数据(USER_DATA) | 无 | vipLevel, symbol, recvWindow | 是 |
| 获取利息历史(USER_DATA) | 无 | asset, isolatedSymbol, startTime, endTime, current, size, recvWindow | 是 |
| 获取未来每小时利率(USER_DATA) | assets, isIsolated | 无 | 是 |
| 保证金账户借款/还款(MARGIN) | asset, isIsolated, symbol, amount, type | recvWindow | 是 |
| 查询保证金账户借款/还款记录(USER_DATA) | type | asset, isolatedSymbol, txId, startTime, endTime, current, size, recvWindow | 是 |
| 查询保证金利率历史(USER_DATA) | asset | vipLevel, startTime, endTime, recvWindow | 是 |
| 查询最大可借额度(USER_DATA) | asset | isolatedSymbol, recvWindow | 是 |
| 全仓保证金抵押率(MARKET_DATA) | 无 | 无 | 否 |
| 获取所有全仓保证金交易对(MARKET_DATA) | 无 | symbol | 否 |
| 获取所有逐仓保证金交易对(MARKET_DATA) | 无 | symbol, recvWindow | 否 |
| 获取所有保证金支持资产(MARKET_DATA) | 无 | asset | 否 |
| 获取下线计划(MARKET_DATA) | 无 | recvWindow | 否 |
| 获取限价交易对列表(MARKET_DATA) | 无 | 无 | 否 |
| 获取上线计划(MARKET_DATA) | 无 | recvWindow | 否 |
| 获取保证金资产风险导向强平比例(MARKET_DATA) | 无 | 无 | 否 |
| 获取保证金受限资产列表(MARKET_DATA) | 无 | 无 | 否 |
| 查询逐仓保证金层级数据(USER_DATA) | symbol | tier, recvWindow | 是 |
| 查询全仓保证金专业模式负债币种杠杆档位(MARKET_DATA) | 无 | 无 | 否 |
| 查询保证金价格指数(MARKET_DATA) | symbol | 无 | 否 |
| 查询保证金可用库存(USER_DATA) | type | 无 | 是 |
| 关闭用户数据流(USER_STREAM) | 无 | 无 | 否 |
| 延长用户数据流有效期(USER_STREAM) | listenKey | 无 | 否 |
| 启动用户数据流(USER_STREAM) | 无 | 无 | 否 |
| 创建特殊密钥(低延迟交易)(TRADE) | apiName | symbol, ip, publicKey, permissionMode, recvWindow | 是 |
| 删除特殊密钥(低延迟交易)(TRADE) | 无 | apiName, symbol, recvWindow | 是 |
| 查询特殊密钥(低延迟交易)(TRADE) | 无 | symbol, recvWindow | 是 |
| 编辑特殊密钥的IP白名单(低延迟交易)(TRADE) | ip | symbol, recvWindow | 是 |
| 获取强制平仓记录(USER_DATA) | 无 | startTime, endTime, isolatedSymbol, current, size, recvWindow | 是 |
| 获取小额负债兑换币种列表(USER_DATA) | 无 | recvWindow | 是 |
| 小额负债兑换(MARGIN) | assetNames | recvWindow | 是 |
| 获取小额负债兑换历史(USER_DATA) | current, size | startTime, endTime, recvWindow | 是 |
| 撤销保证金账户指定交易对的所有挂单(TRADE) | symbol | isIsolated, recvWindow | 是 |
| 查询保证金账户的挂单列表(USER_DATA) | 无 | symbol, isIsolated, recvWindow | 是 |
| 撤销保证金账户的OCO订单(TRADE) | symbol | isIsolated, orderListId, listClientOrderId, newClientOrderId, recvWindow | 是 |
| 查询保证金账户的OCO订单(USER_DATA) | 无 | isIsolated, symbol, orderListId, origClientOrderId, recvWindow | 是 |
| 撤销保证金账户订单(TRADE) | symbol | isIsolated, orderId, origClientOrderId, newClientOrderId, recvWindow | 是 |
| 保证金账户新建订单(TRADE) | symbol, side, type | isIsolated, quantity, quoteOrderQty, price, stopPrice, newClientOrderId, icebergQty, newOrderRespType, sideEffectType, timeInForce, selfTradePreventionMode, autoRepayAtCancel, recvWindow | 是 |
| 查询保证金账户订单(USER_DATA) | symbol | isIsolated, orderId, origClientOrderId, recvWindow | 是 |
| 保证金账户新建OCO订单(TRADE) | symbol, side, quantity, price, stopPrice | isIsolated, listClientOrderId, limitClientOrderId, limitIcebergQty, stopClientOrderId, stopLimitPrice, stopIcebergQty, stopLimitTimeInForce, newOrderRespType, sideEffectType, selfTradePreventionMode, autoRepayAtCancel, recvWindow | 是 |
| 保证金账户新建OTO订单(TRADE) | symbol, workingType, workingSide, workingPrice, workingQuantity, workingIcebergQty, pendingType, pendingSide, pendingQuantity | isIsolated, listClientOrderId, newOrderRespType, sideEffectType, selfTradePreventionMode, autoRepayAtCancel, workingClientOrderId, workingTimeInForce, pendingClientOrderId, pendingPrice, pendingStopPrice, pendingTrailingDelta, pendingIcebergQty, pendingTimeInForce | 是 |
| 保证金账户新建OTOCO订单(TRADE) | symbol, workingType, workingSide, workingPrice, workingQuantity, pendingSide, pendingQuantity, pendingAboveType | isIsolated, sideEffectType, autoRepayAtCancel, listClientOrderId, newOrderRespType, selfTradePreventionMode, workingClientOrderId, workingIcebergQty, workingTimeInForce, pendingAboveClientOrderId, pendingAbovePrice, pendingAboveStopPrice, pendingAboveTrailingDelta, pendingAboveIcebergQty, pendingAboveTimeInForce, pendingBelowType, pendingBelowClientOrderId, pendingBelowPrice, pendingBelowStopPrice, pendingBelowTrailingDelta, pendingBelowIcebergQty, pendingBelowTimeInForce | 是 |
| 保证金手动平仓(MARGIN) | type | symbol, recvWindow | 是 |
| 查询当前保证金订单频次限制使用情况(TRADE) | 无 | isIsolated, symbol, recvWindow | 是 |
| 查询保证金账户所有OCO订单(USER_DATA) | 无 | isIsolated, symbol, fromId, startTime, endTime, limit, recvWindow | 是 |
| 查询保证金账户所有订单(USER_DATA) | symbol | isIsolated, orderId, startTime, endTime, limit, recvWindow | 是 |
| 查询保证金账户未成交的OCO订单(USER_DATA) | 无 | isIsolated, symbol, recvWindow | 是 |
| 查询保证金账户成交记录(USER_DATA) | symbol | isIsolated, orderId, startTime, endTime, fromId, limit, recvWindow | 是 |
| 查询被阻止的成交记录(USER_DATA) | symbol | preventedMatchId, orderId, fromPreventedMatchId, recvWindow, isIsolated | 是 |
| 查询特殊密钥列表(低延迟交易)(TRADE) | 无 | symbol, recvWindow | 是 |
| 获取全仓保证金转账历史(USER_DATA) | 无 | asset, type, startTime, endTime, current, size, isolatedSymbol, recvWindow | 是 |
| 查询最大可转出金额(USER_DATA) | asset | isolatedSymbol, recvWindow | 是 |
Parameters
参数说明
Common Parameters
通用参数
- maxLeverage: Can only adjust 3 , 5 or 10,Example: maxLeverage = 5 or 3 for Cross Margin Classic; maxLeverage=10 for Cross Margin Pro 10x leverage or 20x if compliance allows.
- symbol:
- recvWindow: No more than 60000 (e.g., 5000)
- asset:
- symbol: isolated margin pair
- type: Transfer Type: ROLL_IN, ROLL_OUT
- startTime: Only supports querying data from the past 90 days. (e.g., 1623319461670)
- endTime: (e.g., 1641782889000)
- fromId: If is set, data with
fromIdgreater thanidwill be returned. Otherwise, the latest data will be returned. (e.g., 1)fromId - limit: Limit on the number of data records returned per request. Default: 500; Maximum: 1000. (e.g., 500)
- vipLevel: User's current specific margin data will be returned if vipLevel is omitted (e.g., 1)
- coin:
- symbols: Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT"
- isolatedSymbol: isolated symbol
- current: Currently querying page. Start from 1. Default:1 (e.g., 1)
- size: Default:10 Max:100 (e.g., 10)
- assets: List of assets, separated by commas, up to 20
- isIsolated: for isolated margin or not, "TRUE", "FALSE"
- asset:
- isIsolated: for Isolated Margin,
TRUEfor Cross Margin, DefaultFALSE(e.g., FALSE)FALSE - amount:
- type: ,
MARGINISOLATED - txId: in
tranId(e.g., 1)POST /sapi/v1/margin/loan - tier: All margin tier data will be returned if tier is omitted
- listenKey:
- apiName:
- ip: Can be added in batches, separated by commas. Max 30 for an API key
- publicKey: 1. If publicKey is inputted it will create an RSA or Ed25519 key. 2. Need to be encoded to URL-encoded format
- permissionMode: This parameter is only for the Ed25519 API key, and does not effact for other encryption methods. The value can be TRADE (TRADE for all permissions) or READ (READ for USER_DATA, FIX_API_READ_ONLY). The default value is TRADE. (e.g., value)
- apiName:
- ip: Can be added in batches, separated by commas. Max 30 for an API key
- current: Currently querying page. Start from 1. Default:1 (e.g., 1)
- size: Default:10, Max:100 (e.g., 10)
- isIsolated: For isolated margin or not, "TRUE", "FALSE", default "FALSE"
- orderListId: Either or
orderListIdmust be provided (e.g., 1)listClientOrderId - listClientOrderId: Either or
orderListIdmust be provided (e.g., 1)listClientOrderId - newClientOrderId: Used to uniquely identify this cancel. Automatically generated by default (e.g., 1)
- orderId: (e.g., 1)
- origClientOrderId: (e.g., 1)
- quantity: (e.g., 1.0)
- limitClientOrderId: A unique Id for the limit order (e.g., 1)
- price: (e.g., 1.0)
- limitIcebergQty: (e.g., 1.0)
- stopClientOrderId: A unique Id for the stop loss/stop loss limit leg (e.g., 1)
- stopPrice: (e.g., 1.0)
- stopLimitPrice: If provided, is required. (e.g., 1.0)
stopLimitTimeInForce - stopIcebergQty: (e.g., 1.0)
- stopLimitTimeInForce: Valid values are /
GTC/FOKIOC - sideEffectType: NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; default NO_SIDE_EFFECT. More info in FAQ (e.g., NO_SIDE_EFFECT)
- selfTradePreventionMode: The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE (e.g., NONE)
- autoRepayAtCancel: Only when MARGIN_BUY or AUTO_BORROW_REPAY order takes effect, true means that the debt generated by the order needs to be repay after the order is cancelled. The default is true (e.g., true)
- workingType: Supported values: ,
LIMITLIMIT_MAKER - workingSide: BUY, SELL
- workingClientOrderId: Arbitrary unique ID among open orders for the working order. Automatically generated if not sent. (e.g., 1)
- workingPrice: (e.g., 1.0)
- workingQuantity: (e.g., 1.0)
- workingIcebergQty: This can only be used if is
workingTimeInForce. (e.g., 1.0)GTC - workingTimeInForce: GTC,IOC,FOK
- pendingType: Supported values: Order Types Note that orders using
MARKETare not supported. (e.g., Order Types)quoteOrderQty - pendingSide: BUY, SELL
- pendingClientOrderId: Arbitrary unique ID among open orders for the pending order. Automatically generated if not sent. (e.g., 1)
- pendingPrice: (e.g., 1.0)
- pendingStopPrice: (e.g., 1.0)
- pendingTrailingDelta: (e.g., 1.0)
- pendingQuantity: (e.g., 1.0)
- pendingIcebergQty: This can only be used if is
pendingTimeInForce. (e.g., 1.0)GTC - pendingTimeInForce: GTC,IOC,FOK
- workingIcebergQty: This can only be used if is
workingTimeInForce. (e.g., 1.0)GTC - pendingAboveType: Supported values: ,
LIMIT_MAKER, andSTOP_LOSSSTOP_LOSS_LIMIT - pendingAboveClientOrderId: Arbitrary unique ID among open orders for the pending above order. Automatically generated if not sent. (e.g., 1)
- pendingAbovePrice: (e.g., 1.0)
- pendingAboveStopPrice: (e.g., 1.0)
- pendingAboveTrailingDelta: (e.g., 1.0)
- pendingAboveIcebergQty: This can only be used if is
pendingAboveTimeInForce. (e.g., 1.0)GTC - pendingAboveTimeInForce:
- pendingBelowType: Supported values: ,
LIMIT_MAKER, andSTOP_LOSSSTOP_LOSS_LIMIT - pendingBelowClientOrderId: Arbitrary unique ID among open orders for the pending below order. Automatically generated if not sent. (e.g., 1)
- pendingBelowPrice: (e.g., 1.0)
- pendingBelowStopPrice: (e.g., 1.0)
- pendingBelowTrailingDelta: (e.g., 1.0)
- pendingBelowIcebergQty: This can only be used if is
pendingBelowTimeInForce. (e.g., 1.0)GTC - pendingBelowTimeInForce:
- quantity: (e.g., 1.0)
- quoteOrderQty: (e.g., 1.0)
- price: (e.g., 1.0)
- stopPrice: Used with ,
STOP_LOSS,STOP_LOSS_LIMIT, andTAKE_PROFITorders. (e.g., 1.0)TAKE_PROFIT_LIMIT - icebergQty: Used with ,
LIMIT, andSTOP_LOSS_LIMITto create an iceberg order. (e.g., 1.0)TAKE_PROFIT_LIMIT - preventedMatchId: (e.g., 1)
- fromPreventedMatchId: (e.g., 1)
- assetNames: The assets list of small liability exchange, Example: assetNames = BTC,ETH
- maxLeverage: 仅可调整为3、5或10,示例:全仓保证金经典模式maxLeverage = 5或3;全仓保证金专业模式maxLeverage=10表示10倍杠杆,合规允许的情况下可设置为20倍。
- symbol:
- recvWindow: 不可超过60000(例如:5000)
- asset:
- symbol: 逐仓保证金交易对
- type: 转账类型:ROLL_IN(转入), ROLL_OUT(转出)
- startTime: 仅支持查询最近90天内的数据(例如:1623319461670)
- endTime: (例如:1641782889000)
- fromId: 如果设置了,将返回
fromId大于id的数据,否则返回最新数据(例如:1)fromId - limit: 单次请求返回的数据条数限制,默认值:500;最大值:1000(例如:500)
- vipLevel: 如果省略vipLevel,将返回用户当前对应的保证金数据(例如:1)
- coin:
- symbols: 最多可传入5个交易对,用英文逗号分隔,例如:"BTCUSDT,BNBUSDT,ADAUSDT"
- isolatedSymbol: 逐仓交易对
- current: 当前查询页码,从1开始,默认值:1(例如:1)
- size: 默认值:10,最大值:100(例如:10)
- assets: 资产列表,用英文逗号分隔,最多20个
- isIsolated: 是否为逐仓保证金,可选值:"TRUE", "FALSE"
- asset:
- isIsolated: 表示逐仓保证金,
TRUE表示全仓保证金,默认值:FALSE(例如:FALSE)FALSE - amount:
- type: (全仓),
MARGIN(逐仓)ISOLATED - txId: 接口返回的
POST /sapi/v1/margin/loan(例如:1)tranId - tier: 如果省略tier,将返回所有保证金层级数据
- listenKey:
- apiName:
- ip: 可批量添加,用英文逗号分隔,单个API密钥最多支持30个IP
- publicKey: 1. 如果传入publicKey,将创建RSA或Ed25519密钥;2. 需要转换为URL编码格式
- permissionMode: 该参数仅适用于Ed25519类型的API密钥,对其他加密方式无效,可选值为TRADE(拥有所有交易权限)或READ(仅拥有USER_DATA、FIX_API_READ_ONLY权限),默认值为TRADE(例如:value)
- apiName:
- ip: 可批量添加,用英文逗号分隔,单个API密钥最多支持30个IP
- current: 当前查询页码,从1开始,默认值:1(例如:1)
- size: 默认值:10,最大值:100(例如:10)
- isIsolated: 是否为逐仓保证金,可选值:"TRUE", "FALSE",默认值:"FALSE"
- orderListId: 和
orderListId必须提供其中一个(例如:1)listClientOrderId - listClientOrderId: 和
orderListId必须提供其中一个(例如:1)listClientOrderId - newClientOrderId: 用于唯一标识本次撤销操作,默认自动生成(例如:1)
- orderId: (例如:1)
- origClientOrderId: (例如:1)
- quantity: (例如:1.0)
- limitClientOrderId: 限价单的唯一ID(例如:1)
- price: (例如:1.0)
- limitIcebergQty: (例如:1.0)
- stopClientOrderId: 止损/止损限价单的唯一ID(例如:1)
- stopPrice: (例如:1.0)
- stopLimitPrice: 如果传入该参数,则必须同时传入(例如:1.0)
stopLimitTimeInForce - stopIcebergQty: (例如:1.0)
- stopLimitTimeInForce: 有效值为/
GTC/FOKIOC - sideEffectType: NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; 默认值:NO_SIDE_EFFECT,更多信息请参考常见问题(例如:NO_SIDE_EFFECT)
- selfTradePreventionMode: 允许的枚举值取决于交易对的配置,支持的可选值为EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE(例如:NONE)
- autoRepayAtCancel: 仅当订单为MARGIN_BUY或AUTO_BORROW_REPAY类型时生效,true表示订单取消后需要偿还该订单产生的负债,默认值为true(例如:true)
- workingType: 支持的可选值:,
LIMITLIMIT_MAKER - workingSide: BUY(买), SELL(卖)
- workingClientOrderId: 条件单的唯一ID,在所有挂单中需唯一,未传入则自动生成(例如:1)
- workingPrice: (例如:1.0)
- workingQuantity: (例如:1.0)
- workingIcebergQty: 仅当为
workingTimeInForce时可使用(例如:1.0)GTC - workingTimeInForce: GTC,IOC,FOK
- pendingType: 支持的可选值:订单类型,注意不支持使用的
quoteOrderQty订单(例如:Order Types)MARKET - pendingSide: BUY(买), SELL(卖)
- pendingClientOrderId: 挂单的唯一ID,在所有挂单中需唯一,未传入则自动生成(例如:1)
- pendingPrice: (例如:1.0)
- pendingStopPrice: (例如:1.0)
- pendingTrailingDelta: (例如:1.0)
- pendingQuantity: (例如:1.0)
- pendingIcebergQty: 仅当为
pendingTimeInForce时可使用(例如:1.0)GTC - pendingTimeInForce: GTC,IOC,FOK
- workingIcebergQty: 仅当为
workingTimeInForce时可使用(例如:1.0)GTC - pendingAboveType: 支持的可选值:,
LIMIT_MAKER, 和STOP_LOSSSTOP_LOSS_LIMIT - pendingAboveClientOrderId: 上方条件挂单的唯一ID,在所有挂单中需唯一,未传入则自动生成(例如:1)
- pendingAbovePrice: (例如:1.0)
- pendingAboveStopPrice: (例如:1.0)
- pendingAboveTrailingDelta: (例如:1.0)
- pendingAboveIcebergQty: 仅当为
pendingAboveTimeInForce时可使用(例如:1.0)GTC - pendingAboveTimeInForce:
- pendingBelowType: 支持的可选值:,
LIMIT_MAKER, 和STOP_LOSSSTOP_LOSS_LIMIT - pendingBelowClientOrderId: 下方条件挂单的唯一ID,在所有挂单中需唯一,未传入则自动生成(例如:1)
- pendingBelowPrice: (例如:1.0)
- pendingBelowStopPrice: (例如:1.0)
- pendingBelowTrailingDelta: (例如:1.0)
- pendingBelowIcebergQty: 仅当为
pendingBelowTimeInForce时可使用(例如:1.0)GTC - pendingBelowTimeInForce:
- quantity: (例如:1.0)
- quoteOrderQty: (例如:1.0)
- price: (例如:1.0)
- stopPrice: 用于、
STOP_LOSS、STOP_LOSS_LIMIT和TAKE_PROFIT类型的订单(例如:1.0)TAKE_PROFIT_LIMIT - icebergQty: 用于、
LIMIT和STOP_LOSS_LIMIT类型的订单,创建冰山订单(例如:1.0)TAKE_PROFIT_LIMIT - preventedMatchId: (例如:1)
- fromPreventedMatchId: (例如:1)
- assetNames: 小额负债兑换的资产列表,示例:assetNames = BTC,ETH
Enums
枚举值
- side: BUY | SELL
- newOrderRespType: ACK | RESULT | FULL
- timeInForce: GTC | IOC | FOK
- side: BUY | SELL
- newOrderRespType: ACK | RESULT | FULL
- timeInForce: GTC | IOC | FOK
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:
- Mainnet: https://api.binance.com
需要鉴权的端点,你需要提供币安API凭证。
所需凭证:
- apiKey: 你的币安API密钥(放在请求头中)
- secretKey: 你的币安API私钥(用于签名)
基础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用户可通过发送包含以下格式内容的文件来提供币安API凭证:
bash
abc123...xyz
secret123...keyNever Disclose API Key and Secret
切勿泄露API Key和Secret
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 Key和Secret文件的存储位置。
切勿将API Key和Secret发送到主网和测试网以外的任何网站。
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
向用户展示凭证时:
- 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)
- futures-keys (Mainnet)
展示账号列表时,仅展示名称和环境,绝对不展示密钥:
币安账户:
- main(主网)
- 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
币安账户
main
main
- API Key: your_mainnet_api_key
- Secret: your_mainnet_secret
- API Key: your_mainnet_api_key
- Secret: your_mainnet_secret
TOOLS.md Structure
TOOLS.md 结构
bash
undefinedbash
undefinedBinance Accounts
币安账户
main
main
- API Key: abc123...xyz
- Secret: secret123...key
- Description: Primary trading account
- API Key: abc123...xyz
- Secret: secret123...key
- Description: 主要交易账户
futures-keys
futures-keys
- API Key: futures789...def
- Secret: futuressecret...uvw
- Description: Futures trading account
undefined- API Key: futures789...def
- Secret: futuressecret...uvw
- Description: 合约交易账户
undefinedAgent Behavior
Agent行为规则
- Credentials requested: Mask secrets (show last 5 chars only)
- Listing accounts: Show names and environment, never keys
- Account selection: Ask if ambiguous, default to main
- When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed
- New credentials: Prompt for name, environment, signing mode
- 凭证查询:对密钥进行脱敏(仅展示最后5位)
- 账户列表展示:仅展示名称和环境,绝不展示密钥
- 账户选择:如果存在歧义请询问用户,默认使用main账户
- 主网交易操作:提前向用户确认,要求用户输入"CONFIRM"后再继续
- 新增凭证:提示用户输入账户名称、环境、签名模式
Adding New Accounts
添加新账户
When user provides new credentials:
- Ask for account name
- Store in with masked display confirmation
TOOLS.md
用户提供新凭证时:
- 询问账户名称
- 存储到文件中,返回脱敏后的确认信息
TOOLS.md
Signing Requests
请求签名
For trading endpoints that require a signature:
- Build query string with all parameters, including the timestamp (Unix ms).
- Percent-encode the parameters using UTF-8 according to RFC 3986.
- Sign query string with secretKey using HMAC SHA256, RSA, or Ed25519 (depending on the account configuration).
- Append signature to query string.
- Include header.
X-MBX-APIKEY
Otherwise, do not perform steps 3–5.
需要签名的交易端点:
- 构建包含所有参数的查询字符串,包括时间戳(Unix毫秒级)
- 根据RFC 3986规范对参数进行UTF-8百分比编码
- 根据账户配置,使用HMAC SHA256、RSA或Ed25519算法和secretKey对查询字符串进行签名
- 将签名追加到查询字符串中
- 添加请求头
X-MBX-APIKEY
不需要签名的端点无需执行3-5步。
New Client Order ID
客户端订单ID规则
For endpoints that include the parameter, the value must always start with . If the parameter is not provided, followed by 18 random alphanumeric characters will be generated automatically. If a value is provided, it will be prefixed with
newClientOrderIdagent-agent-agent-Example:
agent-1a2b3c4d5e6f7g8h9i包含参数的端点,该参数值必须始终以开头。如果用户未传入该参数,将自动生成加18位随机字母数字组合的ID;如果用户传入了值,将自动添加前缀。
newClientOrderIdagent-agent-agent-示例:
agent-1a2b3c4d5e6f7g8h9iUser Agent Header
User-Agent请求头
Include header with the following string:
User-Agentbinance-margin-trading/1.0.0 (Skill)See for implementation details.
references/authentication.md请求需携带头,值为:
User-Agentbinance-margin-trading/1.0.0 (Skill)实现详情请参考
references/authentication.md