BinanceMargin: Margin Trading Operations
BinanceMargin: Margin Trading Operations
Details
Provides methods for margin borrowing, repaying, order management, and account queries on Binance. Inherits from BinanceBase.
Purpose and Scope
Borrowing / Repaying: Borrow and repay assets on cross or isolated margin.
Order Management: Place, cancel, and query margin orders.
Account Info: Query margin account details, max borrowable/transferable amounts.
History: Retrieve interest history, force liquidation records, and trade history.
Isolated Margin: Query isolated margin accounts and initiate isolated transfers.
Usage
All methods require authentication (valid API key and secret).
These are SAPI (/sapi/) endpoints.
Endpoints Covered
| Method | Endpoint | HTTP |
| add_borrow | POST /sapi/v1/margin/borrow-repay (type=BORROW) | POST |
| add_repay | POST /sapi/v1/margin/borrow-repay (type=REPAY) | POST |
| add_order | POST /sapi/v1/margin/order | POST |
| cancel_order | DELETE /sapi/v1/margin/order | DELETE |
| cancel_all_orders | DELETE /sapi/v1/margin/openOrders | DELETE |
| get_order | GET /sapi/v1/margin/order | GET |
| get_open_orders | GET /sapi/v1/margin/openOrders | GET |
| get_all_orders | GET /sapi/v1/margin/allOrders | GET |
| get_account | GET /sapi/v1/margin/account | GET |
| get_max_borrowable | GET /sapi/v1/margin/maxBorrowable | GET |
| get_max_transferable | GET /sapi/v1/margin/maxTransferable | GET |
| get_interest_history | GET /sapi/v1/margin/interestHistory | GET |
| get_force_liquidation_history | GET /sapi/v1/margin/forceLiquidationRec | GET |
| get_trades | GET /sapi/v1/margin/myTrades | GET |
| get_isolated_account | GET /sapi/v1/margin/isolated/account | GET |
| add_isolated_transfer | POST /sapi/v1/margin/isolated/transfer | POST |
Order Types
"LIMIT": requiresprice,quantity,timeInForce."MARKET": requires eitherquantityorquoteOrderQty."STOP_LOSS","STOP_LOSS_LIMIT","TAKE_PROFIT","TAKE_PROFIT_LIMIT": conditional."LIMIT_MAKER": like LIMIT but rejected if it would immediately match.
Side Effect Types
"NO_SIDE_EFFECT": Normal trade order."MARGIN_BUY": Margin trade order with auto-borrow."AUTO_REPAY": Margin trade order with auto-repay.
Super class
binance::BinanceBase -> BinanceMargin
Methods
Inherited methods
Method add_borrow()
Borrow on Margin
Initiates a margin loan for the specified asset and amount.
Uses the consolidated borrow-repay endpoint with type = "BORROW".
Usage
BinanceMargin$add_borrow(
asset,
amount,
isIsolated = "FALSE",
symbol = NULL,
recvWindow = NULL
)Arguments
assetCharacter; asset to borrow (e.g.,
"USDT").amountNumeric; amount to borrow.
isIsolatedCharacter;
"TRUE"or"FALSE"for isolated margin. Default"FALSE".symbolCharacter or NULL; required when
isIsolated = "TRUE".recvWindowInteger or NULL; max 60000.
Method add_repay()
Repay Margin Loan
Repays a margin loan for the specified asset and amount.
Uses the consolidated borrow-repay endpoint with type = "REPAY".
Usage
BinanceMargin$add_repay(
asset,
amount,
isIsolated = "FALSE",
symbol = NULL,
recvWindow = NULL
)Arguments
assetCharacter; asset to repay (e.g.,
"USDT").amountNumeric; amount to repay.
isIsolatedCharacter;
"TRUE"or"FALSE"for isolated margin. Default"FALSE".symbolCharacter or NULL; required when
isIsolated = "TRUE".recvWindowInteger or NULL; max 60000.
Method add_order()
Place a Margin Order
Places a new margin order on Binance.
JSON Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"transactTime": 1507725176595,
"price": "50000.00000000",
"origQty": "0.00010000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"isIsolated": false
}Usage
BinanceMargin$add_order(
symbol,
side,
type,
quantity = NULL,
quoteOrderQty = NULL,
price = NULL,
stopPrice = NULL,
timeInForce = NULL,
newClientOrderId = NULL,
newOrderRespType = NULL,
sideEffectType = NULL,
isIsolated = NULL,
recvWindow = NULL
)Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").sideCharacter;
"BUY"or"SELL".typeCharacter; order type:
"LIMIT","MARKET","STOP_LOSS","STOP_LOSS_LIMIT","TAKE_PROFIT","TAKE_PROFIT_LIMIT","LIMIT_MAKER".quantityNumeric or NULL; base asset quantity.
quoteOrderQtyNumeric or NULL; quote asset quantity (market orders only).
priceNumeric or NULL; price for limit orders.
stopPriceNumeric or NULL; trigger price for stop orders.
timeInForceCharacter or NULL;
"GTC","IOC","FOK".newClientOrderIdCharacter or NULL; unique client order ID.
newOrderRespTypeCharacter or NULL;
"ACK","RESULT", or"FULL".sideEffectTypeCharacter or NULL;
"NO_SIDE_EFFECT","MARGIN_BUY","AUTO_REPAY".isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row and columns including:
symbol(character): Trading pair.order_id(integer): Unique order identifier.client_order_id(character): Client-assigned order ID.transact_time(POSIXct): Transaction time.price(character): Order price.orig_qty(character): Original requested quantity.executed_qty(character): Quantity filled so far.status(character): Order status.type(character): Order type.side(character):"BUY"or"SELL".is_isolated(logical): Whether this is an isolated margin order.
Method cancel_order()
Cancel a Margin Order
Cancels an active margin order by order ID or client order ID.
JSON Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"origClientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"clientOrderId": "cancelMyOrder1",
"transactTime": 1507725176595,
"price": "50000.00000000",
"origQty": "0.00010000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"isIsolated": false
}Usage
BinanceMargin$cancel_order(
symbol,
orderId = NULL,
origClientOrderId = NULL,
isIsolated = NULL,
recvWindow = NULL
)Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").orderIdInteger or NULL; the order ID to cancel.
origClientOrderIdCharacter or NULL; the client order ID to cancel.
isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row and columns including:
symbol(character): Trading pair.order_id(integer): Unique order identifier.orig_client_order_id(character): Original client order ID.status(character): Order status (typically"CANCELED").transact_time(POSIXct): Cancellation time.is_isolated(logical): Whether this is an isolated margin order.
Method cancel_all_orders()
Cancel All Open Margin Orders on a Symbol
Cancels all active margin orders on a trading pair.
JSON Response
[
{
"symbol": "BTCUSDT",
"orderId": 28,
"origClientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"clientOrderId": "cancelMyOrder1",
"transactTime": 1507725176595,
"price": "50000.00000000",
"origQty": "0.00010000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"isIsolated": false
}
]Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table (or promise<data.table> if async = TRUE).
When orders are cancelled, one row per order with columns:
symbol(character): Trading pair.order_id(integer): Unique order identifier.orig_client_order_id(character): Original client order ID.status(character): Order status (typically"CANCELED").transact_time(POSIXct): Cancellation time.is_isolated(logical): Whether this is an isolated margin order.
When no open orders exist, a single confirmation row with columns:
symbol(character): The requested trading pair.status(character):"cancelled".
Method get_order()
Query a Margin Order
Retrieves details for a specific margin order by order ID or client order ID.
JSON Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"price": "50000.00000000",
"origQty": "0.00010000",
"executedQty": "0.00010000",
"cummulativeQuoteQty": "5.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.00000000",
"icebergQty": "0.00000000",
"time": 1507725176595,
"updateTime": 1507725176595,
"isIsolated": false
}Usage
BinanceMargin$get_order(
symbol,
orderId = NULL,
origClientOrderId = NULL,
isIsolated = NULL,
recvWindow = NULL
)Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").orderIdInteger or NULL; the order ID.
origClientOrderIdCharacter or NULL; the client order ID.
isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row and columns including:
symbol(character): Trading pair.order_id(integer): Unique order identifier.client_order_id(character): Client-assigned order ID.price(character): Order price.orig_qty(character): Original requested quantity.executed_qty(character): Quantity filled so far.status(character): Order status.type(character): Order type.side(character):"BUY"or"SELL".time(POSIXct): Order creation time.update_time(POSIXct): Last update time.is_isolated(logical): Whether this is an isolated margin order.
Method get_open_orders()
Get Open Margin Orders
Retrieves all currently open margin orders, optionally filtered by symbol.
JSON Response
[
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"price": "50000.00000000",
"origQty": "0.00010000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.00000000",
"icebergQty": "0.00000000",
"time": 1507725176595,
"updateTime": 1507725176595,
"isIsolated": false
}
]Arguments
symbolCharacter or NULL; trading pair (e.g.,
"BTCUSDT").isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per open order and the following columns:
symbol(character): Trading pair.order_id(integer): Unique order identifier.client_order_id(character): Client-assigned order ID.price(character): Order price.orig_qty(character): Original requested quantity.executed_qty(character): Quantity filled so far.status(character): Order status.type(character): Order type.side(character):"BUY"or"SELL".time(POSIXct): Order creation time.update_time(POSIXct): Last update time.is_isolated(logical): Whether this is an isolated margin order.
Method get_all_orders()
Get All Margin Orders
Retrieves all margin orders for a symbol (open, cancelled, filled).
JSON Response
[
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"price": "50000.00000000",
"origQty": "0.00010000",
"executedQty": "0.00010000",
"cummulativeQuoteQty": "5.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.00000000",
"icebergQty": "0.00000000",
"time": 1507725176595,
"updateTime": 1507725176595,
"isIsolated": false
},
{
"symbol": "BTCUSDT",
"orderId": 29,
"clientOrderId": "x]]Xk3RFN1g2MjEDKWNq8t",
"price": "0.00000000",
"origQty": "0.00020000",
"executedQty": "0.00020000",
"cummulativeQuoteQty": "10.48000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "MARKET",
"side": "SELL",
"stopPrice": "0.00000000",
"icebergQty": "0.00000000",
"time": 1507725276595,
"updateTime": 1507725276595,
"isIsolated": false
}
]Usage
BinanceMargin$get_all_orders(
symbol,
orderId = NULL,
startTime = NULL,
endTime = NULL,
limit = NULL,
isIsolated = NULL,
recvWindow = NULL
)Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").orderIdInteger or NULL; pagination cursor.
startTimeInteger or NULL; start timestamp in milliseconds.
endTimeInteger or NULL; end timestamp in milliseconds.
limitInteger or NULL; max results (default 500, max 500).
isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per order and the following columns:
symbol(character): Trading pair.order_id(integer): Unique order identifier.client_order_id(character): Client-assigned order ID.price(character): Order price.orig_qty(character): Original requested quantity.executed_qty(character): Quantity filled so far.status(character): Order status.type(character): Order type.side(character):"BUY"or"SELL".time(POSIXct): Order creation time.update_time(POSIXct): Last update time.is_isolated(logical): Whether this is an isolated margin order.
Method get_account()
Get Margin Account Information
Retrieves cross margin account details including balances and margin level.
JSON Response
{
"borrowEnabled": true,
"marginLevel": "11.64405625",
"totalAssetOfBtc": "6.82728457",
"totalLiabilityOfBtc": "0.58633215",
"totalNetAssetOfBtc": "6.24095242",
"tradeEnabled": true,
"transferEnabled": true,
"accountType": "MARGIN",
"userAssets": [
{
"asset": "BTC",
"borrowed": "0.00000000",
"free": "0.00499500",
"interest": "0.00000000",
"locked": "0.00000000",
"netAsset": "0.00499500"
},
{
"asset": "USDT",
"borrowed": "200.00000000",
"free": "1500.50000000",
"interest": "0.01055556",
"locked": "0.00000000",
"netAsset": "1300.48944444"
}
]
}Returns
data.table with one row and columns including:
borrow_enabled(logical): Whether borrowing is enabled.margin_level(character): Current margin level.total_asset_of_btc(character): Total asset value in BTC.total_liability_of_btc(character): Total liability in BTC.total_net_asset_of_btc(character): Net asset value in BTC.trade_enabled(logical): Whether trading is enabled.transfer_enabled(logical): Whether transfers are enabled.account_type(character): Account type ("MARGIN").user_assets(list): List of asset balance objects.
Method get_max_borrowable()
Get Max Borrowable Amount
Queries the maximum borrowable amount for an asset on margin.
Arguments
assetCharacter; asset to query (e.g.,
"USDT").isolatedSymbolCharacter or NULL; isolated margin pair (e.g.,
"BTCUSDT").recvWindowInteger or NULL; max 60000.
Method get_max_transferable()
Get Max Transferable Amount
Queries the maximum transferable-out amount for an asset on margin.
Arguments
assetCharacter; asset to query (e.g.,
"USDT").isolatedSymbolCharacter or NULL; isolated margin pair (e.g.,
"BTCUSDT").recvWindowInteger or NULL; max 60000.
Method get_interest_history()
Get Margin Interest History
Retrieves margin interest accrual history with pagination.
JSON Response
{
"rows": [
{
"isolatedSymbol": "",
"asset": "USDT",
"interest": "0.01055556",
"interestAccuredTime": 1672012800000,
"interestRate": "0.00019",
"principal": "200.00000000",
"type": "ON_BORROW"
},
{
"isolatedSymbol": "",
"asset": "USDT",
"interest": "0.01055556",
"interestAccuredTime": 1672099200000,
"interestRate": "0.00019",
"principal": "200.00000000",
"type": "PERIODIC"
}
],
"total": 2
}Usage
BinanceMargin$get_interest_history(
asset = NULL,
startTime = NULL,
endTime = NULL,
current = NULL,
size = NULL,
archived = NULL,
recvWindow = NULL
)Arguments
assetCharacter or NULL; filter by asset (e.g.,
"USDT").startTimeInteger or NULL; start timestamp in milliseconds.
endTimeInteger or NULL; end timestamp in milliseconds.
currentInteger or NULL; current page (default 1).
sizeInteger or NULL; page size (default 10, max 100).
archivedCharacter or NULL;
"true"to query 6-month archived data.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per interest record and the following columns:
asset(character): Asset charged interest.interest(character): Interest amount accrued.interest_accured_time(POSIXct): Time of interest accrual.interest_rate(character): Applied interest rate.principal(character): Principal amount borrowed.type(character): Margin type ("ON_BORROW","PERIODIC", etc.).isolated_symbol(character): Isolated margin pair (if applicable).
Method get_force_liquidation_history()
Get Force Liquidation History
Retrieves margin force liquidation records with pagination.
Usage
BinanceMargin$get_force_liquidation_history(
startTime = NULL,
endTime = NULL,
isolatedSymbol = NULL,
current = NULL,
size = NULL,
recvWindow = NULL
)Arguments
startTimeInteger or NULL; start timestamp in milliseconds.
endTimeInteger or NULL; end timestamp in milliseconds.
isolatedSymbolCharacter or NULL; isolated margin pair.
currentInteger or NULL; current page (default 1).
sizeInteger or NULL; page size (default 10, max 100).
recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per liquidation record and the following columns:
avg_price(character): Average liquidation price.executed_qty(character): Liquidated quantity.order_id(integer): Liquidation order identifier.price(character): Liquidation price.qty(character): Total quantity.side(character):"BUY"or"SELL".symbol(character): Trading pair.time(POSIXct): Liquidation time.is_isolated(logical): Whether this was an isolated margin liquidation.updated_time(POSIXct): Last update time.
Method get_trades()
Get Margin Trades
Retrieves margin trade history for a symbol.
Usage
BinanceMargin$get_trades(
symbol,
orderId = NULL,
startTime = NULL,
endTime = NULL,
fromId = NULL,
limit = NULL,
isIsolated = NULL,
recvWindow = NULL
)Arguments
symbolCharacter; trading pair (e.g.,
"BTCUSDT").orderIdInteger or NULL; filter by order ID.
startTimeInteger or NULL; start timestamp in milliseconds.
endTimeInteger or NULL; end timestamp in milliseconds.
fromIdInteger or NULL; trade ID to fetch from.
limitInteger or NULL; max results (default 500, max 1000).
isIsolatedCharacter or NULL;
"TRUE"or"FALSE"for isolated margin.recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per trade and columns including:
symbol(character): Trading pair.id(integer): Trade ID.order_id(integer): Order ID.price(character): Trade price.qty(character): Trade quantity.commission(character): Commission paid.commission_asset(character): Commission asset.time(POSIXct): Trade execution time.is_buyer(logical): Whether the trade was a buy.is_maker(logical): Whether the trade was a maker.is_isolated(logical): Whether this is an isolated margin trade.
Method get_isolated_account()
Get Isolated Margin Account Info
Retrieves isolated margin account details.
JSON Response
{
"assets": [
{
"baseAsset": {
"asset": "BTC",
"borrowEnabled": true,
"borrowed": "0.00000000",
"free": "0.00100000",
"interest": "0.00000000",
"locked": "0.00000000",
"netAsset": "0.00100000",
"netAssetOfBtc": "0.00100000",
"repayEnabled": true,
"totalAsset": "0.00100000"
},
"quoteAsset": {
"asset": "USDT",
"borrowEnabled": true,
"borrowed": "0.00000000",
"free": "50.00000000",
"interest": "0.00000000",
"locked": "0.00000000",
"netAsset": "50.00000000",
"netAssetOfBtc": "0.00094750",
"repayEnabled": true,
"totalAsset": "50.00000000"
},
"symbol": "BTCUSDT",
"isolatedCreated": true,
"enabled": true,
"marginLevel": "999.00000000",
"marginRatio": "5.00000000",
"indexPrice": "52800.00000000",
"liquidatePrice": "0.00000000",
"liquidateRate": "0.00000000",
"tradeEnabled": true
}
],
"totalAssetOfBtc": "0.00194750",
"totalLiabilityOfBtc": "0.00000000",
"totalNetAssetOfBtc": "0.00194750"
}Arguments
symbolsCharacter or NULL; comma-separated symbols (max 5, e.g.,
"BTCUSDT,ETHUSDT").recvWindowInteger or NULL; max 60000.
Returns
data.table with one row per isolated margin pair (long format) and columns including:
total_asset_of_btc(character): Total asset value in BTC (repeated per pair).total_liability_of_btc(character): Total liability in BTC (repeated per pair).total_net_asset_of_btc(character): Net asset value in BTC (repeated per pair).base_asset(list): Base asset details (nested object kept as list-column).quote_asset(list): Quote asset details (nested object kept as list-column).symbol(character): Isolated margin pair symbol.isolated_created(logical): Whether the isolated pair has been created.enabled(logical): Whether the pair is enabled.margin_level(character): Current margin level.trade_enabled(logical): Whether trading is enabled.
Method add_isolated_transfer()
Isolated Margin Transfer
Transfers assets between spot and isolated margin accounts.
Usage
BinanceMargin$add_isolated_transfer(
asset,
symbol,
transFrom,
transTo,
amount,
recvWindow = NULL
)Arguments
assetCharacter; asset to transfer (e.g.,
"USDT").symbolCharacter; isolated margin pair (e.g.,
"BTCUSDT").transFromCharacter; source account:
"SPOT"or"ISOLATED_MARGIN".transToCharacter; destination account:
"SPOT"or"ISOLATED_MARGIN".amountNumeric; amount to transfer.
recvWindowInteger or NULL; max 60000.
Examples
if (FALSE) { # \dontrun{
# Synchronous
margin <- BinanceMargin$new()
account <- margin$get_account()
print(account)
# Asynchronous
margin_async <- BinanceMargin$new(async = TRUE)
main <- coro::async(function() {
account <- await(margin_async$get_account())
print(account)
})
main()
while (!later::loop_empty()) later::run_now()
} # }
## ------------------------------------------------
## Method `BinanceMargin$add_borrow`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
result <- margin$add_borrow(asset = "USDT", amount = 100)
print(result)
} # }
## ------------------------------------------------
## Method `BinanceMargin$add_repay`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
result <- margin$add_repay(asset = "USDT", amount = 100)
print(result)
} # }
## ------------------------------------------------
## Method `BinanceMargin$add_order`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
order <- margin$add_order(
symbol = "BTCUSDT", side = "BUY", type = "LIMIT",
price = 50000, quantity = 0.0001, timeInForce = "GTC"
)
print(order)
} # }
## ------------------------------------------------
## Method `BinanceMargin$cancel_order`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
cancelled <- margin$cancel_order("BTCUSDT", orderId = 28)
print(cancelled)
} # }
## ------------------------------------------------
## Method `BinanceMargin$cancel_all_orders`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
cancelled <- margin$cancel_all_orders("BTCUSDT")
print(cancelled)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_order`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
order <- margin$get_order("BTCUSDT", orderId = 28)
print(order)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_open_orders`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
open <- margin$get_open_orders("BTCUSDT")
print(open)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_all_orders`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
all <- margin$get_all_orders("BTCUSDT", limit = 50)
print(all)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_account`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
account <- margin$get_account()
print(account)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_max_borrowable`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
max_borrow <- margin$get_max_borrowable(asset = "USDT")
print(max_borrow)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_max_transferable`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
max_transfer <- margin$get_max_transferable(asset = "USDT")
print(max_transfer)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_interest_history`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
history <- margin$get_interest_history(asset = "USDT")
print(history)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_force_liquidation_history`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
liquidations <- margin$get_force_liquidation_history()
print(liquidations)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_trades`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
trades <- margin$get_trades("BTCUSDT")
print(trades)
} # }
## ------------------------------------------------
## Method `BinanceMargin$get_isolated_account`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
isolated <- margin$get_isolated_account()
print(isolated)
} # }
## ------------------------------------------------
## Method `BinanceMargin$add_isolated_transfer`
## ------------------------------------------------
if (FALSE) { # \dontrun{
margin <- BinanceMargin$new()
result <- margin$add_isolated_transfer(
asset = "USDT", symbol = "BTCUSDT",
transFrom = "SPOT", transTo = "ISOLATED_MARGIN",
amount = 100
)
print(result)
} # }