Preguntas frecuentes
Actualmente este artículo no es compatible en su idioma. Se recomienda el traductor automático para el inglés.
Inicio
Centro de soporte
Preguntas frecuentes
Cripto-derivados
Contratos de Futuros
Margen de cartera Pro
How to Use the Binance Portfolio Margin Pro Program APIs

How to Use the Binance Portfolio Margin Pro Program APIs

2022-04-18 06:15
Last updated: 5 Sep 2024
Disclaimer: In compliance with MiCA requirements, unauthorized stablecoins are subject to certain restrictions for EEA users. For more information, please click here.
The Binance Portfolio Margin Pro Program is available via the Binance Futures API connectivity suite and is open to users who have enabled the Binance Futures API trading interface. The existing trading API endpoints on the Cross Margin, USDⓈ-M Futures, and COIN-M Futures markets remain available under the Binance Portfolio Margin Pro Program and are consistent with the regular account trading practices.
Please note that the Portfolio Margin Pro API endpoints are compatible with Binance Portfolio Margin Pro, and will not be available for Portfolio Margin (unless under exceptional circumstances). Please refer to this article for a comprehensive distinction between Portfolio Margin Pro and Portfolio Margin.
For a full list of endpoints available for Portfolio Margin, please refer to Binance Portfolio Margin API.

Binance Portfolio Margin Pro Program API details

In addition to the Binance standard API endpoints, additional dedicated endpoints are added under the Binance Portfolio Margin Pro Program, providing the following outputs:
1. uniMMR, Portfolio Margin Pro Account Status
2. Bankruptcy Loan Record (GET) and Repayment (POST)
3. Collateral Rate per symbol
4. Additional Portfolio Margin Pro Program API Exceptions
5. Portfolio Margin Pro Account Information (USER_DATA)
6. Portfolio Margin Pro Interest History (USER_DATA)
7. Portfolio Margin Pro Interest Rate (USER_DATA)
8. Portfolio Margin Pro Tiered Collateral Rate
9. Error codes

1. uniMMR and Portfolio Margin Pro Account Status

The requests below will return the corresponding outputs:
Field
Description
uniMMR
Unified Margin Maintenance margin ratio
accountEquity
Unified margin account equity, in USD
actualEquity
Unified margin account actual equity (without collateral rate) in USD
accountMaintMargin
Unified Margin Maintenance Margin, the required margin for open position and loan, in USD
accountStatus
Unified Margin Account current status: "NORMAL", "MARGIN_CALL", "SUPPLY_MARGIN", "REDUCE_ONLY", "ACTIVE_LIQUIDATION", "FORCE_LIQUIDATION", "BANKRUPTED"
API Parameters:
Name
Type
Mandatory
recvWindow
LONG
NO
timestamp
LONG
YES
API Responses:
Response Type
Response Content
Normal Response
{
"uniMMR": "1.87987800",
"accountEquity": "122607.35137903",
"actualEquity": "142607.35137903",
"accountMaintMargin": "23.72469206",
"accountStatus": "NORMAL"
}
When the account hasn’t enabled the Portfolio Margin Pro Program
{
"code":-21001,
"msg": "invalid request: request ID is not a Portfolio Margin Account"
}

2. Portfolio Margin Pro Bankruptcy Loan

  • Portfolio Margin Pro Bankruptcy Loan Record
The requests below will return the corresponding outputs:
Field
Description
asset
Loan asset by default (USDT)
amount
Portfolio Margin Pro bankruptcy loan amount in USDT
API Parameters:
NameTypeMandatory
recvWindowLONGNO
timestampLONGYES
API Responses:
Response Type
Response Content
Normal Response
{
"asset": "USDT",
"amount": "579.45",
}
The user doesn’t have any Portfolio Margin Bankruptcy Loan
{
"error code": -21004,
"msg":"No outstanding pmLoan"
}
  • Portfolio Margin Pro Bankruptcy Loan Repayment
API Parameters:
NameTypeMandatory
recvWindowLONGNO
timestampLONGYES
API Responses:
Response Type
Response Content
Normal Response
{
"tranId": 58203331886213504
}
The user’s Spot Wallet doesn’t have enough USDT to repay the Portfolio Margin Pro Bankruptcy Loan{
"error code": -21005,
"msg":"No enough USDT to repay pmLoan"
}
The user’s Portfolio Margin Pro Bankruptcy Loan repayment is in process{
"error code": -21006,
"msg":"Had pmLoan repayment in process"

}
The user failed to repay the Portfolio Margin Pro Bankruptcy Loan since liquidation was in process{
"error code": -21007,
"msg":"Post fail since liquidation is in process"

}

3. Portfolio Margin Collateral Rate (MARKET_DATA)

* The endpoint will not adapt to the Portfolio Margin Pro users after Sep 11, 2024
The requests below will return the corresponding outputs:
Field
Description
asset
Collateral asset type
collateralRate
Corresponding collateral rate
API Responses:
Response Type
Response Content
Normal Response
{
"asset": "USDT",
"collateralRate": "1.0000",
}

4. Additional Portfolio Margin Pro Program API Exceptions

Client Status
Response Content
If the user transfers assets from the Margin Wallet to the Futures Wallet
/sapi/v1/asset/transfer:
{
"error code": -21002,
"msg":"Portfolio Margin Account doesn't support transfer from margin to futures”

}
If the margin assets failed to retrieve in time
/sapi/v1/margin/maxTransferable
/sapi/v1/asset/transfer
/sapi/v1/margin/transfer
/sapi/v1/future/transfer
{
"error code": -21003,
"msg":"fail to retrieve margin assets”

}
If the margin assets are not updated by the system in time
/sapi/v1/margin/maxBorrowable/sapi/v1/margin/loan
/sapi/v1/margin/order with MARGIN_BUY
{
"error code": -21003,
"msg":"fail to retrieve margin assets”

}

5. Portfolio Margin Pro Current Account Information

The requests below will return the corresponding outputs:
Field
Description
maxWithdrawAmountUSD
The maximum amount that can be transferred out of the Portfolio Margin Pro Account in USD (as per the estimated conversion value)*
maxWithdrawAmount
The maximum amount that can be transferred out of the Portfolio Margin Pro Account*
*i.e., Transfer to the user’s Spot Wallet
API Parameters:
NameTypeMandatory
assetSTRINGYES
recvWindowLONGNO
API Responses:
Response Type
Response Content
Normal Response
{
"maxWithdrawAmountUSD": "25347.92083245", // Portfolio Margin maximum virtual amount for transfer out in USD
"asset": "BTC", // asset name
"maxWithdrawAmount": "1.33663654", // maximum amount for transfer out
}

6. Portfolio Margin Pro Interest History (USER_DATA)

API Parameters:
NameTypeMandatory
assetSTRINGNO
startTimeLONGNO
endTimeLONGNO
sizeLONGDefault:10 Max:100
recvWindowLONGNO
timestampLONGYES
API Responses:
Response Type
Response Content
Normal Response
[
{
"asset": "USDT",
"interest": "0.00000604",
"principal": "0.04902887",
"interestRate": "0.00012329",
"type": "UM_NEGATIVE_BALANCE",
"interestAccruedTime": 1678924800000
}
]

7. Portfolio Margin Pro Interest Rate (USER_DATA)

API Parameters:
NameTypeMandatory
assetSTRINGNO
recvWindow LONGNO
timestampLONGYES
API Responses:
Response Type
Response Content
Normal Response
[
{
"asset": "USDT",
"dailyInterest": "0.00012329", //daily interest rate
"yearlyInterest": "0.045" //annual interest rate
}
]
}

8. Portfolio Margin Pro Tiered Collateral Rate (MARKET_DATA)

* The endpoint will take effect for Portfolio Margin Pro users on Sep 11, 2024
GET /sapi/v2/portfolio/collateralRate
API Parameters:
Name
Type
Mandatory
recvWindow
LONG
NO
timestamp
LONG
YES
API Responses:
Response Type
Response Content
Normal Response
{
"asset": "USDT",
"collateralInfo": [
{
"tierFloor": "0",
"tierCap": "30000000",
"collateralRate": "1"
},
{
"tierFloor": "30000000",
"tierCap": "99999999999",
"collateralRate": "0.95"
}
],
"asset":"BNB",
"collateralInfo": [
{
"tierFloor": "0",
"tierCap": "2000000",
"collateralRate": "1"
},
{
"tierFloor": "2000000",
"tierCap": "4000000",
"collateralRate": "0.95"
},
{
"tierFloor": "4000000",
"tierCap": "99999999999",
"collateralRate": "0.90"
}
]
}

9. Error Codes

If you encounter the error code "-21003" from the API endpoint or the error message "NET_ASSET_MUST_LTE_RATIO" from the GUI, please try to transfer a tiny amount of any asset to your Cross Margin Wallet, and the error will be fixed after the transfer.