API margin endpoints

Methods

cancelAllOpenMarginOrder(symbol, optionsopt)

Margin Account Cancel all Open Orders on a Symbol (TRADE)

DELETE /sapi/v1/margin/openOrders

https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-all-open-orders-on-a-symbol-trade

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE, default "FALSE"

recvWindownumber<optional>

The value cannot be greater than 60000

cancelMarginOCOOrder(symbol, optionsopt)

Margin Account Cancel OCO (TRADE)

DELETE /sapi/v1/margin/orderList

  • Either orderListId or listClientOrderId must be provided
  • Canceling an individual leg will cancel the entire OCO

https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-oco-trade

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

For isolated margin or not, "TRUE", "FALSE", default "FALSE"

orderListIdnumber<optional>
listClientOrderIdstring<optional>
newClientOrderIdstring<optional>

Used to uniquely identify this cancel. Automatically generated by default.

recvWindownumber<optional>

The value cannot be greater than 60000

cancelMarginOrder(symbol, optionsopt)

Margin Account Cancel Order (TRADE)

DELETE /sapi/v1/margin/order

https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE

orderIdnumber<optional>
origClientOrderIdstring<optional>
newClientOrderIdstring<optional>

Used to uniquely identify this cancel. Automatically generated by default.

recvWindownumber<optional>

The value cannot be greater than 60000

disableIsolatedMarginAccount(symbol, optionsopt)

Disable Isolated Margin Account (TRADE)

DELETE /sapi/v1/margin/isolated/account

https://binance-docs.github.io/apidocs/spot/en/#disable-isolated-margin-account-trade

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

No more than 60000

enableIsolatedMarginAccount(symbol, optionsopt)

Enable Isolated Margin Account (TRADE)

POST /sapi/v1/margin/isolated/account

https://binance-docs.github.io/apidocs/spot/en/#enable-isolated-margin-account-trade

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

No more than 60000

getMarginOCOOrder(optionsopt)

Query Margin Account's OCO (USER_DATA)

GET /sapi/v1/margin/orderList

Either orderListId or origClientOrderId must be provided

https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-oco-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

For isolated margin or not, "TRUE", "FALSE", default "FALSE"

symbolstring<optional>

Mandatory for isolated margin, not supported for cross margin

orderListIdnumber<optional>
origClientOrderIdstring<optional>
recvWindownumber<optional>

The value cannot be greater than 60000

getMarginOCOOrders(optionsopt)

Query Marign Account's all OCO (USER_DATA)

GET /sapi/v1/margin/allOrderList

Retrieves all OCO for a specific margin account based on provided optional parameters.

https://binance-docs.github.io/apidocs/spot/en/#query-marign-account-39-s-all-oco-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

For isolated margin or not, "TRUE", "FALSE", default "FALSE"

symbolstring<optional>

Mandatory for isolated margin, not supported for cross margin

fromIdnumber<optional>

If provided, neither startTime nor endTime can be sent

startTimenumber<optional>
endTimenumber<optional>
limitnumber<optional>

Default Value: 500; Max Value: 1000

recvWindownumber<optional>

The value cannot be greater than 60000

getMarginOpenOCOOrders(optionsopt)

Query Margin Account's Open OCO (USER_DATA)

GET /sapi/v1/margin/openOrderList

https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-oco-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

For isolated margin or not, "TRUE", "FALSE", default "FALSE"

symbolstring<optional>

Mandatory for isolated margin, not supported for cross margin

recvWindownumber<optional>

The value cannot be greater than 60000

isolatedMarginAccountInfo(optionsopt)

Query Isolated Margin Account Info (USER_DATA)

GET /sapi/v1/margin/isolated/account

https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
symbolsstring<optional>

Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT"

recvWindownumber<optional>

No more than 60000

isolatedMarginAccountLimit(optionsopt)

Query Enabled Isolated Margin Account Limit (USER_DATA)

GET /sapi/v1/margin/isolated/accountLimit

https://binance-docs.github.io/apidocs/spot/en/#query-enabled-isolated-margin-account-limit-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

No more than 60000

isolatedMarginAllSymbols(optionsopt)

Get All Isolated Margin Symbol(USER_DATA)

GET /sapi/v1/margin/isolated/allPairs

https://binance-docs.github.io/apidocs/spot/en/#get-all-isolated-margin-symbol-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

No more than 60000

isolatedMarginFee(optionsopt)

Query Isolated Margin Fee Data (USER_DATA)

GET /sapi/v1/margin/isolatedMarginData

Get isolated margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee

https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
vipLevelnumber<optional>

User's current specific margin data will be returned if vipLevel is omitted

symbolstring<optional>
recvWindownumber<optional>

No more than 60000

isolatedMarginSymbol(symbol, optionsopt)

Query Isolated Margin Symbol (USER_DATA)

GET /sapi/v1/margin/isolated/pair

https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-symbol-user_data

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

No more than 60000

isolatedMarginTier(symbol, optionsopt)

Query Isolated Margin Tier Data (USER_DATA)

GET /sapi/v1/margin/isolatedMarginTier

Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data

https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
tierstring<optional>

All margin tier data will be returned if tier is omitted

recvWindownumber<optional>

No more than 60000

isolatedMarginTransfer(asset, symbol, transFrom, transTo, amount, optionsopt)

Isolated Margin Account Transfer (MARGIN)

POST /sapi/v1/margin/isolated/transfer

https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin

Parameters:
NameTypeAttributesDescription
assetstring

asset, such as BTC

symbolstring
transFromstring

"SPOT", "ISOLATED_MARGIN"

transTostring

"SPOT", "ISOLATED_MARGIN"

amountnumber
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

No more than 60000

isolatedMarginTransferHistory(symbol, optionsopt)

Get Isolated Margin Transfer History (USER_DATA)

GET /sapi/v1/margin/isolated/transfer

https://binance-docs.github.io/apidocs/spot/en/#get-isolated-margin-transfer-history-user_data

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
assetstring<optional>
transFromstring<optional>

"SPOT", "ISOLATED_MARGIN"

transTostring<optional>

"SPOT", "ISOLATED_MARGIN"

startTimenumber<optional>
endTimenumber<optional>
currentnumber<optional>

Current page, default 1

sizenumber<optional>

Default 10, max 100

recvWindownumber<optional>

No more than 60000

marginAccount(optionsopt)

Query Cross Margin Account Details (USER_DATA)

GET /sapi/v1/margin/account

https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-account-details-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

The value cannot be greater than 60000

marginAllAssets()

Get All Margin Assets (MARKET_DATA)

GET /sapi/v1/margin/allAssets

https://binance-docs.github.io/apidocs/spot/en/#get-all-margin-assets-market_data

marginAllOrders(symbol, optionsopt)

Query Margin Account's All Order (USER_DATA)

GET /sapi/v1/margin/allOrders

https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE, default "FALSE"

orderIdnumber<optional>
startTimenumber<optional>
endTimenumber<optional>
limitnumber<optional>

Default 500; max 500.

recvWindownumber<optional>

The value cannot be greater than 60000

marginAllPairs()

Get All Cross Margin Pairs (MARKET_DATA)

GET /sapi/v1/margin/allPairs

https://binance-docs.github.io/apidocs/spot/en/#get-all-cross-margin-pairs-market_data

marginAsset(asset)

Query Margin Asset (MARKET_DATA)

GET /sapi/v1/margin/asset

https://binance-docs.github.io/apidocs/spot/en/#query-margin-asset-market_data

Parameters:
NameTypeDescription
assetstring

marginBorrow(asset, amount, optionsopt)

Margin Account Borrow (MARGIN)

POST /sapi/v1/margin/load

Apply for a loan.
https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin

Parameters:
NameTypeAttributesDescription
assetstring
amountnumber
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE

symbolstring<optional>

isolated symbol

recvWindownumber<optional>

The value cannot be greater than 60000

marginDustLog(optionsopt)

Margin Dustlog (USER_DATA)

GET /sapi/v1/margin/dribblet

Query the historical information of user's margin account small-value asset conversion BNB.

https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
startTimenumber<optional>
endTimenumber<optional>
recvWindownumber<optional>

No more than 60000

marginFee(optionsopt)

Query Cross Margin Fee Data (USER_DATA)

GET /sapi/v1/margin/crossMarginData

Get cross margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee

https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-fee-data-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
vipLevelnumber<optional>

User's current specific margin data will be returned if vipLevel is omitted

coinstring<optional>
recvWindownumber<optional>

No more than 60000

marginForceLiquidationRecord(optionsopt)

Get Force Liquidation Record (USER_DATA)

GET /sapi/v1/margin/forceLiquidationRec

https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
startTimenumber<optional>
endTimenumber<optional>
isolatedSymbolstring<optional>
currentnumber<optional>

Currently querying page. Start from 1. Default:1

sizenumber<optional>

Default:10 Max:100

recvWindownumber<optional>

The value cannot be greater than 60000

marginInterestHistory(optionsopt)

Get Interest History (USER_DATA)

GET /sapi/v1/margin/interestHistory

https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
assetstring<optional>
isolatedSymbolstring<optional>
startTimenumber<optional>
endTimenumber<optional>
currentnumber<optional>

Currently querying page. Start from 1. Default:1

sizenumber<optional>

Default:10 Max:100

archivedboolean<optional>

Default: false. Set to true for archived data from 6 months ago

recvWindownumber<optional>

The value cannot be greater than 60000

marginInterestRateHistory(asset, optionsopt)

Query Margin Interest Rate History (USER_DATA)

GET /sapi/v1/margin/interestRateHistory

https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data

Parameters:
NameTypeAttributesDescription
assetstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
vipLevelnumber<optional>

Default: user's vip level

startTimenumber<optional>

Default: 7 days ago

endTimenumber<optional>

Default: present. Maximum range: 1 months.

recvWindownumber<optional>

The value cannot be greater than 60000

marginLoanRecord(asset, optionsopt)

Query Loan Record (USER_DATA)

GET /sapi/v1/margin/loan

https://binance-docs.github.io/apidocs/spot/en/#query-loan-record-user_data

Parameters:
NameTypeAttributesDescription
assetstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isolatedSymbolstring<optional>
txIdnumber<optional>

the tranId in POST /sapi/v1/margin/loan

startTimenumber<optional>
endTimenumber<optional>
currentnumber<optional>

Currently querying page. Start from 1. Default:1

sizenumber<optional>

Default:10 Max:100

archivedboolean<optional>

Default: false. Set to true for archived data from 6 months ago

recvWindownumber<optional>

The value cannot be greater than 60000

marginMaxBorrowable(asset, optionsopt)

Query Max Borrow (USER_DATA)

GET /sapi/v1/margin/maxBorrowable

https://binance-docs.github.io/apidocs/spot/en/#query-max-borrow-user_data

Parameters:
NameTypeAttributesDescription
assetstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isolatedSymbolstring<optional>
recvWindownumber<optional>

The value cannot be greater than 60000

marginMaxTransferable(asset, optionsopt)

Query Max Transfer-Out Amount (USER_DATA)

GET /sapi/v1/margin/maxTransferable

https://binance-docs.github.io/apidocs/spot/en/#query-max-transfer-out-amount-user_data

Parameters:
NameTypeAttributesDescription
assetstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isolatedSymbolstring<optional>
recvWindownumber<optional>

The value cannot be greater than 60000

marginMyTrades(symbol, optionsopt)

Query Margin Account's Trade List (USER_DATA)

GET /sapi/v1/margin/myTrades

https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

Default 500; max 500.

startTimenumber<optional>
endTimenumber<optional>
fromIdnumber<optional>

TradeId to fetch from. Default gets most recent trades.

limitnumber<optional>

Default 500; max 1000.

recvWindownumber<optional>

The value cannot be greater than 60000

marginOCOOrder(symbol, side, quantity, price, stopPrice, optionsopt)

Marign Account New OCO (TRADE)

POST /sapi/v1/margin/order/oco

  • Price Restrictions:
    SELL: Limit Price > Last Price > Stop Price
    BUY: Limit Price < Last Price < Stop Price
  • Quantity Restrictions:
    Both legs must have the same quantity
    ICEBERG quantities however do not have to be the same.
  • Order Rate Limit:
    OCO counts as 2 orders against the order rate limit.

https://binance-docs.github.io/apidocs/spot/en/#marign-account-new-oco-trade

Parameters:
NameTypeAttributesDescription
symbolstring
sidestring
quantitynumber
pricenumber
stopPricenumber
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

For isolated margin or not, "TRUE", "FALSE", default "FALSE"

listClientOrderIdstring<optional>
limitClientOrderIdstring<optional>

A unique Id for the limit order

limitIcebergQtynumber<optional>
stopClientOrderIdstring<optional>

A unique Id for the stop loss/stop loss limit leg.

stopLimitPricenumber<optional>

If provided, stopLimitTimeInForce is required.

stopIcebergQtynumber<optional>
stopLimitTimeInForcestring<optional>

GTC/ FOK/ IOC

newOrderRespTypestring<optional>
sideEffectTypestring<optional>

NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.

recvWindownumber<optional>

The value cannot be greater than 60000

marginOpenOrders(optionsopt)

Query Margin Account's Open Order (USER_DATA)

GET /sapi/v1/margin/openOrders

https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
symbolstring<optional>
isIsolatedstring<optional>

TRUE or FALSE, default "FALSE"

recvWindownumber<optional>

The value cannot be greater than 60000

marginOrder(symbol, optionsopt)

Query Margin Account's Order (USER_DATA)

GET /sapi/v1/margin/order

https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data

Parameters:
NameTypeAttributesDescription
symbolstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE, default "FALSE"

orderIdnumber<optional>
origClientOrderIdstring<optional>
recvWindownumber<optional>

The value cannot be greater than 60000

marginOrderCount(optionsopt)

Query Current Margin Order Count Usage (TRADE)

GET /sapi/v1/margin/rateLimit/order

Displays the user's current margin order count usage for all intervals.

https://binance-docs.github.io/apidocs/spot/en/#query-current-margin-order-count-usage-trade

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

for isolated margin or not, "TRUE", "FALSE",default "FALSE"

symbolstring<optional>

isolated symbol, mandatory for isolated margin

recvWindownumber<optional>

No more than 60000

marginPair(symbol)

Query Cross Margin Pair (MARKET_DATA)

GET /sapi/v1/margin/pair

https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-pair-market_data

Parameters:
NameTypeDescription
symbolstring

marginPairIndex(symbol)

Query Margin PriceIndex (MARKET_DATA)

GET /sapi/v1/margin/priceIndex

https://binance-docs.github.io/apidocs/spot/en/#query-margin-priceindex-market_data

Parameters:
NameTypeDescription
symbolstring

marginRepay(asset, amount, optionsopt)

Margin Account Repay(MARGIN)

POST /sapi/v1/margin/repay

Repay loan for margin account.
https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin

Parameters:
NameTypeAttributesDescription
assetstring
amountstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE

symbolstring<optional>
recvWindownumber<optional>

The value cannot be greater than 60000

marginRepayRecord(asset, optionsopt)

Query Repay Record (USER_DATA)

GET /sapi/v1/margin/repay

https://binance-docs.github.io/apidocs/spot/en/#query-repay-record-user_data

Parameters:
NameTypeAttributesDescription
assetstring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isolatedSymbolstring<optional>
txIdnumber<optional>

return of /sapi/v1/margin/repay

startTimenumber<optional>
endTimenumber<optional>
currentnumber<optional>

Currently querying page. Start from 1. Default:1

sizenumber<optional>

Default:10 Max:100

archivedboolean<optional>

Default: false. Set to true for archived data from 6 months ago

recvWindownumber<optional>

The value cannot be greater than 60000

marginTransfer(asset, amount, type, optionsopt)

Cross Margin Account Transfer (MARGIN)

POST /sapi/v1/margin/transfer

https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin

Parameters:
NameTypeAttributesDescription
assetstring
amountnumber
typenumber

1: transfer from main account to margin account
2: transfer from margin account to main account

optionsobject<optional>
Properties
NameTypeAttributesDescription
recvWindownumber<optional>

The value cannot be greater than 60000

marginTransferHistory(optionsopt)

Get Cross Margin Transfer History (USER_DATA)

GET /sapi/v1/margin/transfer

https://binance-docs.github.io/apidocs/spot/en/#get-cross-margin-transfer-history-user_data

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Properties
NameTypeAttributesDescription
assetstring<optional>
typestring<optional>

ROLL_IN, ROLL_OUT

startTimenumber<optional>
endTimenumber<optional>
currentnumber<optional>

Currently querying page. Start from 1. Default:1

sizenumber<optional>

Default:10 Max:100

archivedboolean<optional>

Default: false. Set to true for archived data from 6 months ago

recvWindownumber<optional>

The value cannot be greater than 60000

newMarginOrder(symbol, side, type, optionsopt)

Margin Account New Order (TRADE)

POST /sapi/v1/margin/order

https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-order-trade

Parameters:
NameTypeAttributesDescription
symbolstring
sidestring

BUY or SELL

typestring
optionsobject<optional>
Properties
NameTypeAttributesDescription
isIsolatedstring<optional>

TRUE or FALSE

quantitynumber<optional>
quoteOrderQtynumber<optional>
pricenumber<optional>
stopPricenumber<optional>

Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.

newClientOrderIdstring<optional>

A unique id among open orders. Automatically generated if not sent.

icebergQtynumber<optional>

Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.

newOrderRespTypestring<optional>

Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.

sideEffectTypestring<optional>

NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.

timeInForcestring<optional>

GTC, IOC, FOK

recvWindownumber<optional>

The value cannot be greater than 60000