derivatives-trading-portfolio-margin-pro

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Binance Derivatives-trading-portfolio-margin-pro Skill

Binance 衍生品交易组合保证金专业版 Skill

Derivatives-trading-portfolio-margin-pro 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密钥。结果以JSON格式返回。

Quick Reference

快速参考

EndpointDescriptionRequiredOptionalAuthentication
/sapi/v1/portfolio/bnb-transfer
(POST)
BNB transfer(USER_DATA)amount, transferSiderecvWindowYes
/sapi/v1/portfolio/repay-futures-switch
(POST)
Change Auto-repay-futures Status(TRADE)autoRepayrecvWindowYes
/sapi/v1/portfolio/repay-futures-switch
(GET)
Get Auto-repay-futures Status(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/repay
(POST)
Portfolio Margin Pro Bankruptcy Loan RepayNonefrom, recvWindowYes
/sapi/v1/portfolio/auto-collection
(POST)
Fund Auto-collection(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/asset-collection
(POST)
Fund Collection by Asset(USER_DATA)assetrecvWindowYes
/sapi/v2/portfolio/account
(GET)
Get Portfolio Margin Pro SPAN Account Info(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/account
(GET)
Get Portfolio Margin Pro Account Info(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/balance
(GET)
Get Portfolio Margin Pro Account Balance(USER_DATA)Noneasset, recvWindowYes
/sapi/v1/portfolio/delta-mode
(GET)
Get Delta Mode Status(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/delta-mode
(POST)
Switch Delta Mode(TRADE)deltaEnabledrecvWindowYes
/sapi/v1/portfolio/earn-asset-balance
(GET)
Get Transferable Earn Asset Balance for Portfolio Margin (USER_DATA)asset, transferTyperecvWindowYes
/sapi/v1/portfolio/pmLoan
(GET)
Query Portfolio Margin Pro Bankruptcy Loan Amount(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/interest-history
(GET)
Query Portfolio Margin Pro Negative Balance Interest History(USER_DATA)Noneasset, startTime, endTime, size, recvWindowYes
/sapi/v1/portfolio/pmloan-history
(GET)
Query Portfolio Margin Pro Bankruptcy Loan Repay History(USER_DATA)NonestartTime, endTime, current, size, recvWindowYes
/sapi/v1/portfolio/repay-futures-negative-balance
(POST)
Repay futures Negative Balance(USER_DATA)Nonefrom, recvWindowYes
/sapi/v1/portfolio/earn-asset-transfer
(POST)
Transfer LDUSDT/RWUSD for Portfolio Margin(TRADE)asset, transferType, amountrecvWindowYes
/sapi/v1/portfolio/collateralRate
(GET)
Portfolio Margin Collateral Rate(MARKET_DATA)NoneNoneNo
/sapi/v1/portfolio/margin-asset-leverage
(GET)
Get Portfolio Margin Asset Leverage(USER_DATA)NoneNoneYes
/sapi/v2/portfolio/collateralRate
(GET)
Portfolio Margin Pro Tiered Collateral Rate(USER_DATA)NonerecvWindowYes
/sapi/v1/portfolio/asset-index-price
(GET)
Query Portfolio Margin Asset Index Price (MARKET_DATA)NoneassetNo

端点描述必填参数可选参数认证要求
/sapi/v1/portfolio/bnb-transfer
(POST)
BNB划转(USER_DATA)amount, transferSiderecvWindow
/sapi/v1/portfolio/repay-futures-switch
(POST)
修改自动偿还期货负债状态(TRADE)autoRepayrecvWindow
/sapi/v1/portfolio/repay-futures-switch
(GET)
查询自动偿还期货负债状态(USER_DATA)recvWindow
/sapi/v1/portfolio/repay
(POST)
组合保证金专业版破产贷款偿还from, recvWindow
/sapi/v1/portfolio/auto-collection
(POST)
资金自动归集(USER_DATA)recvWindow
/sapi/v1/portfolio/asset-collection
(POST)
按资产归集资金(USER_DATA)assetrecvWindow
/sapi/v2/portfolio/account
(GET)
查询组合保证金专业版SPAN账户信息(USER_DATA)recvWindow
/sapi/v1/portfolio/account
(GET)
查询组合保证金专业版账户信息(USER_DATA)recvWindow
/sapi/v1/portfolio/balance
(GET)
查询组合保证金专业版账户余额(USER_DATA)asset, recvWindow
/sapi/v1/portfolio/delta-mode
(GET)
查询Delta模式状态(USER_DATA)recvWindow
/sapi/v1/portfolio/delta-mode
(POST)
切换Delta模式(TRADE)deltaEnabledrecvWindow
/sapi/v1/portfolio/earn-asset-balance
(GET)
查询组合保证金可划转的Earn资产余额(USER_DATA)asset, transferTyperecvWindow
/sapi/v1/portfolio/pmLoan
(GET)
查询组合保证金专业版破产贷款金额(USER_DATA)recvWindow
/sapi/v1/portfolio/interest-history
(GET)
查询组合保证金专业版负余额利息历史(USER_DATA)asset, startTime, endTime, size, recvWindow
/sapi/v1/portfolio/pmloan-history
(GET)
查询组合保证金专业版破产贷款偿还历史(USER_DATA)startTime, endTime, current, size, recvWindow
/sapi/v1/portfolio/repay-futures-negative-balance
(POST)
偿还期货负余额(USER_DATA)from, recvWindow
/sapi/v1/portfolio/earn-asset-transfer
(POST)
为组合保证金划转LDUSDT/RWUSD(TRADE)asset, transferType, amountrecvWindow
/sapi/v1/portfolio/collateralRate
(GET)
组合保证金抵押率(MARKET_DATA)
/sapi/v1/portfolio/margin-asset-leverage
(GET)
查询组合保证金资产杠杆(USER_DATA)
/sapi/v2/portfolio/collateralRate
(GET)
组合保证金专业版分级抵押率(USER_DATA)recvWindow
/sapi/v1/portfolio/asset-index-price
(GET)
查询组合保证金资产指数价格(MARKET_DATA)asset

Parameters

参数说明

Common Parameters

通用参数

  • amount: (e.g., 1.0)
  • transferSide: "TO_UM","FROM_UM"
  • recvWindow: (e.g., 5000)
  • autoRepay: Default:
    true
    ;
    false
    for turn off the auto-repay futures negative balance function (e.g., true)
  • from: SPOT or MARGIN,default SPOT (e.g., SPOT)
  • asset:
    LDUSDT
    and
    RWUSD
  • asset:
  • transferType:
    EARN_TO_FUTURE
    /
    FUTURE_TO_EARN
  • startTime: (e.g., 1623319461670)
  • endTime: (e.g., 1641782889000)
  • size: Default:10 Max:100 (e.g., 10)
  • current: Currently querying page. Start from 1. Default:1 (e.g., 1)
  • deltaEnabled:
    true
    to enable Delta mode;
    false
    to disable Delta mode
  • amount: 金额(例如:1.0)
  • transferSide: 划转方向,可选值为"TO_UM"、"FROM_UM"
  • recvWindow: 接收窗口(例如:5000)
  • autoRepay: 默认值为
    true
    ;设置为
    false
    可关闭自动偿还期货负余额功能(例如:true)
  • from: 资金来源,可选值为SPOT或MARGIN,默认值为SPOT(例如:SPOT)
  • asset: 资产类型,可选值为
    LDUSDT
    RWUSD
  • transferType: 划转类型,可选值为
    EARN_TO_FUTURE
    /
    FUTURE_TO_EARN
  • startTime: 起始时间戳(例如:1623319461670)
  • endTime: 结束时间戳(例如:1641782889000)
  • size: 每页条数,默认值为10,最大值为100(例如:10)
  • current: 当前查询页码,从1开始,默认值为1(例如:1)
  • deltaEnabled: 是否启用Delta模式,
    true
    为启用,
    false
    为禁用

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密钥

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密钥文件的存储位置。
切勿将API密钥和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密钥: 显示前5位+后4位字符:
    su1Qc...8akf
  • Secret密钥: 始终进行掩码处理,仅显示最后5位:
    ***...aws1
询问凭证时的示例回复: 账户:main API密钥:su1Qc...8akf Secret密钥:***...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密钥: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. 使用secretKey通过HMAC SHA256、RSA或Ed25519算法对查询字符串进行签名(具体算法取决于账户配置)。
  4. 将签名追加至查询字符串。
  5. 在请求头中包含
    X-MBX-APIKEY
若无需签名,则跳过步骤3-5。

User Agent Header

User-Agent请求头

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