convert

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Binance Convert Skill

Binance Convert Skill

Convert 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密钥和Secret Key,返回JSON格式的结果。

Quick Reference

快速参考

EndpointDescriptionRequiredOptionalAuthentication
/sapi/v1/convert/exchangeInfo
(GET)
List All Convert PairsNonefromAsset, toAssetNo
/sapi/v1/convert/assetInfo
(GET)
Query order quantity precision per asset(USER_DATA)NonerecvWindowYes
/sapi/v1/convert/acceptQuote
(POST)
Accept Quote (TRADE)quoteIdrecvWindowYes
/sapi/v1/convert/limit/cancelOrder
(POST)
Cancel limit order (USER_DATA)orderIdrecvWindowYes
/sapi/v1/convert/tradeFlow
(GET)
Get Convert Trade History(USER_DATA)startTime, endTimelimit, recvWindowYes
/sapi/v1/convert/orderStatus
(GET)
Order status(USER_DATA)NoneorderId, quoteIdYes
/sapi/v1/convert/limit/placeOrder
(POST)
Place limit order (USER_DATA)baseAsset, quoteAsset, limitPrice, side, expiredTypebaseAmount, quoteAmount, walletType, recvWindowYes
/sapi/v1/convert/limit/queryOpenOrders
(GET)
Query limit open orders (USER_DATA)NonerecvWindowYes
/sapi/v1/convert/getQuote
(POST)
Send Quote Request(USER_DATA)fromAsset, toAssetfromAmount, toAmount, walletType, validTime, recvWindowYes

端点描述必填参数可选参数认证要求
/sapi/v1/convert/exchangeInfo
(GET)
列出所有兑换交易对fromAsset, toAsset
/sapi/v1/convert/assetInfo
(GET)
查询每种资产的订单数量精度(USER_DATA)recvWindow
/sapi/v1/convert/acceptQuote
(POST)
接受报价(TRADE)quoteIdrecvWindow
/sapi/v1/convert/limit/cancelOrder
(POST)
取消限价订单(USER_DATA)orderIdrecvWindow
/sapi/v1/convert/tradeFlow
(GET)
获取兑换交易历史(USER_DATA)startTime, endTimelimit, recvWindow
/sapi/v1/convert/orderStatus
(GET)
订单状态查询(USER_DATA)orderId, quoteId
/sapi/v1/convert/limit/placeOrder
(POST)
下达限价订单(USER_DATA)baseAsset, quoteAsset, limitPrice, side, expiredTypebaseAmount, quoteAmount, walletType, recvWindow
/sapi/v1/convert/limit/queryOpenOrders
(GET)
查询当前开放的限价订单(USER_DATA)recvWindow
/sapi/v1/convert/getQuote
(POST)
发起报价请求(USER_DATA)fromAsset, toAssetfromAmount, toAmount, walletType, validTime, recvWindow

Parameters

参数说明

Common Parameters

通用参数

  • fromAsset: User spends coin
  • toAsset: User receives coin
  • recvWindow: The value cannot be greater than 60000 (e.g., 5000)
  • quoteId: (e.g., 1)
  • orderId: The orderId from
    placeOrder
    api (e.g., 1)
  • startTime: (e.g., 1623319461670)
  • endTime: (e.g., 1641782889000)
  • limit: Default 100, Max 1000 (e.g., 100)
  • orderId: Either orderId or quoteId is required (e.g., 1)
  • quoteId: Either orderId or quoteId is required (e.g., 1)
  • baseAsset: base asset (use the response
    fromIsBase
    from
    GET /sapi/v1/convert/exchangeInfo
    api to check which one is baseAsset )
  • quoteAsset: quote asset
  • limitPrice: Symbol limit price (from baseAsset to quoteAsset) (e.g., 1.0)
  • baseAmount: Base asset amount. (One of
    baseAmount
    or
    quoteAmount
    is required) (e.g., 1.0)
  • quoteAmount: Quote asset amount. (One of
    baseAmount
    or
    quoteAmount
    is required) (e.g., 1.0)
  • side:
    BUY
    or
    SELL
    (e.g., BUY)
  • walletType: It is to choose which wallet of assets. The wallet selection is
    SPOT
    ,
    FUNDING
    and
    EARN
    . Combination of wallet is supported i.e.
    SPOT_FUNDING
    ,
    FUNDING_EARN
    ,
    SPOT_FUNDING_EARN
    or
    SPOT_EARN
    Default is
    SPOT
    .
  • expiredType: 1_D, 3_D, 7_D, 30_D (D means day)
  • fromAsset:
  • toAsset:
  • fromAmount: When specified, it is the amount you will be debited after the conversion (e.g., 1.0)
  • toAmount: When specified, it is the amount you will be credited after the conversion (e.g., 1.0)
  • validTime: 10s, 30s, 1m, default 10s (e.g., 10s)
  • fromAsset:用户支出的币种
  • toAsset:用户收到的币种
  • recvWindow:取值不能超过60000(例如:5000)
  • quoteId:(例如:1)
  • orderId:来自
    placeOrder
    接口的订单ID(例如:1)
  • startTime:(例如:1623319461670)
  • endTime:(例如:1641782889000)
  • limit:默认100,最大值1000(例如:100)
  • orderId:必须提供orderId或quoteId其中之一(例如:1)
  • quoteId:必须提供orderId或quoteId其中之一(例如:1)
  • baseAsset:基础资产(使用
    GET /sapi/v1/convert/exchangeInfo
    接口返回的
    fromIsBase
    字段判断哪个是基础资产)
  • quoteAsset:计价资产
  • limitPrice:交易对限价(从baseAsset到quoteAsset)(例如:1.0)
  • baseAmount:基础资产数量(必须提供
    baseAmount
    quoteAmount
    其中之一)(例如:1.0)
  • quoteAmount:计价资产数量(必须提供
    baseAmount
    quoteAmount
    其中之一)(例如:1.0)
  • side
    BUY
    SELL
    (例如:BUY)
  • walletType:选择资产所在的钱包,可选值为
    SPOT
    FUNDING
    EARN
    ,支持组合选择,如
    SPOT_FUNDING
    FUNDING_EARN
    SPOT_FUNDING_EARN
    SPOT_EARN
    ,默认值为
    SPOT
  • expiredType:1_D、3_D、7_D、30_D(D代表天)
  • fromAsset
  • toAsset
  • fromAmount:指定后,代表兑换后将被扣除的金额(例如:1.0)
  • toAmount:指定后,代表兑换后将被计入的金额(例如:1.0)
  • validTime:10s、30s、1m,默认10s(例如:10s)

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 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
用户可以通过发送文件提供Binance API凭证,文件内容格式如下:
bash
abc123...xyz
secret123...key

Never Disclose API Key and Secret

切勿泄露API密钥和Secret Key

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密钥和Secret Key文件的存储位置。
切勿将API密钥和Secret Key发送至主网和测试网以外的任何网站。

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密钥:显示前5位+后4位:
    su1Qc...8akf
  • Secret Key:始终隐藏,仅显示最后5位:
    ***...aws1
询问凭证时的示例响应: 账户:main API密钥:su1Qc...8akf Secret Key:***...aws1

Listing Accounts

账户列表展示

When listing accounts, show names and environment only — never keys: Binance Accounts:
  • main (Mainnet)
  • futures-keys (Mainnet)
展示账户列表时,仅显示名称和环境——绝不显示密钥: Binance账户:
  • 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

Binance账户

main

main

  • API Key: your_mainnet_api_key
  • Secret: your_mainnet_secret
  • API密钥:your_mainnet_api_key
  • Secret Key:your_mainnet_secret

TOOLS.md Structure

TOOLS.md文件结构

bash
undefined
bash
undefined

Binance Accounts

Binance Accounts

main

main

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

futures-keys

futures-keys

  • API Key: futures789...def
  • Secret: futuressecret...uvw
  • Description: Futures trading account
undefined
  • API Key: futures789...def
  • Secret: futuressecret...uvw
  • 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
  • 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. 根据账户配置,使用HMAC SHA256、RSA或Ed25519算法,用secretKey对查询字符串进行签名。
  4. 将签名附加到查询字符串中。
  5. 包含
    X-MBX-APIKEY
    请求头。
否则,跳过步骤3-5。

User Agent Header

User-Agent请求头

Include
User-Agent
header with the following string:
binance-convert/1.0.0 (Skill)
See
references/authentication.md
for implementation details.
请求头中需包含
User-Agent
,内容为:
binance-convert/1.0.0 (Skill)
请参考
references/authentication.md
获取实现细节。