Binance.PortfolioMargin (binance v2.0.1)

The Binance Portfolio Margin Program is a cross-asset margin program supporting consolidated margin balance across trading products with over 200+ effective crypto collaterals. It is designed for professional traders, market makers, and institutional users looking to actively trade & hedge cross-asset and optimize risk-management in a consolidated setup.

Summary

Functions

Get Classic Portfolio Margin Account Info (USER_DATA)

Query Portfolio Margin Asset Index Price (MARKET_DATA)

Classic Portfolio Margin Collateral Rate (MARKET_DATA)

Query Classic Portfolio Margin Negative Balance Interest History(USER_DATA)

Query Classic Portfolio Margin Bankruptcy Loan Amount (USER_DATA)

Get Auto-repay-futures Status (USER_DATA)

Fund Collection by Asset (TRADE)

Fund Auto-collection (TRADE)

Classic Portfolio Margin Bankruptcy Loan Repay

Repay futures Negative Balance (USER_DATA)

Change Auto-repay-futures Status (TRADE)

Functions

Link to this function

get_portfolio_account(opts \\ [])

@spec get_portfolio_account(recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Get Classic Portfolio Margin Account Info (USER_DATA)

Weight(IP): 1

Details:

  • METHOD: get
  • URL: /sapi/v1/portfolio/account

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

get_portfolio_asset_index_price(opts \\ [])

@spec get_portfolio_asset_index_price([{:asset, any()}]) ::
  {:ok, any()} | {:error, any()}

Query Portfolio Margin Asset Index Price (MARKET_DATA)

Query Portfolio Margin Asset Index Price

Weight(IP): 1 if send asset or 50 if not send asset

Details:

  • METHOD: get
  • URL: /sapi/v1/portfolio/asset-index-price

Mandatory params:

Optional params:

  • asset -
Link to this function

get_portfolio_collateral_rate(opts \\ [])

@spec get_portfolio_collateral_rate([]) :: {:ok, any()} | {:error, any()}

Classic Portfolio Margin Collateral Rate (MARKET_DATA)

Portfolio Margin Collateral Rate.

Weight(IP): 50

Details:

  • METHOD: get
  • URL: /sapi/v1/portfolio/collateralRate

Mandatory params:

Optional params:

Link to this function

get_portfolio_interest_history(opts \\ [])

@spec get_portfolio_interest_history(
  recvWindow: any(),
  size: any(),
  endTime: any(),
  startTime: any(),
  asset: any(),
  timestamp: any()
) :: {:ok, any()} | {:error, any()}

Query Classic Portfolio Margin Negative Balance Interest History(USER_DATA)

Query interest history of negative balance for portfolio margin.

Weight(IP): 50

Details:

  • METHOD: get
  • URL: /sapi/v1/portfolio/interest-history

Mandatory params:

Optional params:

  • timestamp - timestamp
  • asset -
  • startTime -
  • endTime -
  • size - Default:10 Max:100
  • recvWindow - The value cannot be greater than 60000
Link to this function

get_portfolio_pm_loan(opts \\ [])

@spec get_portfolio_pm_loan(recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Query Classic Portfolio Margin Bankruptcy Loan Amount (USER_DATA)

Query Portfolio Margin Bankruptcy Loan Amount.

Weight(UID): 500

Details:

  • METHOD: get
  • URL: /sapi/v1/portfolio/pmLoan

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

get_portfolio_repay_futures_switch(opts \\ [])

@spec get_portfolio_repay_futures_switch(recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Get Auto-repay-futures Status (USER_DATA)

Query Auto-repay-futures Status

Weight(IP): 30

Details:

  • METHOD: get
  • URL: /sapi/v1/portfolio/repay-futures-switch

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_portfolio_asset_collection(opts \\ [])

@spec post_portfolio_asset_collection(
  recvWindow: any(),
  asset: any(),
  timestamp: any()
) ::
  {:ok, any()} | {:error, any()}

Fund Collection by Asset (TRADE)

Transfers specific asset from Futures Account to Margin account

The BNB transfer is not be supported

Weight(IP): 60

Details:

  • METHOD: post
  • URL: /sapi/v1/portfolio/asset-collection

Mandatory params:

Optional params:

  • timestamp - timestamp
  • asset -
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_portfolio_auto_collection(opts \\ [])

@spec post_portfolio_auto_collection(recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Fund Auto-collection (TRADE)

Transfers all assets from Futures Account to Margin account

The BNB would not be collected from UM-PM account to the Portfolio Margin account.

You can only use this function 500 times per hour in a rolling manner.

Weight(IP): 1500

Details:

  • METHOD: post
  • URL: /sapi/v1/portfolio/auto-collection

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_portfolio_bnb_transfer(amount, transferSide, opts \\ [])

@spec post_portfolio_bnb_transfer(any(), any(), recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

BNB transfer (TRADE)

BNB transfer can be between Margin Account and USDM Account

You can only use this function 2 times per 10 minutes in a rolling manner

Weight(IP): 1500

Details:

  • METHOD: post
  • URL: /sapi/v1/portfolio/bnb-transfer

Mandatory params:

  • amount -
  • transferSide - TO_UM,FROM_UM

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_portfolio_repay(opts \\ [])

@spec post_portfolio_repay(recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Classic Portfolio Margin Bankruptcy Loan Repay

Repay Portfolio Margin Bankruptcy Loan.

Weight(UID): 3000

Details:

  • METHOD: post
  • URL: /sapi/v1/portfolio/repay

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_portfolio_repay_futures_negative_balance(opts \\ [])

@spec post_portfolio_repay_futures_negative_balance(
  recvWindow: any(),
  timestamp: any()
) ::
  {:ok, any()} | {:error, any()}

Repay futures Negative Balance (USER_DATA)

Repay futures Negative Balance

Weight(IP): 1500

Details:

  • METHOD: post
  • URL: /sapi/v1/portfolio/repay-futures-negative-balance

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_portfolio_repay_futures_switch(autoRepay, opts \\ [])

@spec post_portfolio_repay_futures_switch(any(), recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Change Auto-repay-futures Status (TRADE)

Change Auto-repay-futures Status

Weight(IP): 1500

Details:

  • METHOD: post
  • URL: /sapi/v1/portfolio/repay-futures-switch

Mandatory params:

  • autoRepay - Default: true; false for turn off the auto-repay futures negative balance function

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000