Module: Binance::Spot::Margin

Included in:
Binance::Spot
Defined in:
lib/binance/spot/margin.rb

Overview

Margin endpoints

Instance Method Summary collapse

Instance Method Details

#disable_isolated_margin_account(symbol:, **kwargs) ⇒ Object

Disable Isolated Margin Account (TRADE)

DELETE /sapi/v1/margin/isolated/account

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



575
576
577
578
579
# File 'lib/binance/spot/margin.rb', line 575

def (symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:delete, '/sapi/v1/margin/isolated/account', params: kwargs.merge(symbol: symbol))
end

#enable_isolated_margin_account(symbol:, **kwargs) ⇒ Object

Enable Isolated Margin Account (TRADE)

POST /sapi/v1/margin/isolated/account

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



589
590
591
592
593
# File 'lib/binance/spot/margin.rb', line 589

def (symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:post, '/sapi/v1/margin/isolated/account', params: kwargs.merge(symbol: symbol))
end

#get_all_isolated_margin_pairs(**kwargs) ⇒ Object

Get All Isolated Margin Symbol(USER_DATA)

GET /sapi/v1/margin/isolated/allPairs

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



627
628
629
# File 'lib/binance/spot/margin.rb', line 627

def get_all_isolated_margin_pairs(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/isolated/allPairs', params: kwargs)
end

#get_bnb_burn(**kwargs) ⇒ Object

Get BNB Burn Status (USER_DATA)

GET /sapi/v1/bnbBurn

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



653
654
655
# File 'lib/binance/spot/margin.rb', line 653

def get_bnb_burn(**kwargs)
  @session.sign_request(:get, '/sapi/v1/bnbBurn', params: kwargs)
end

#get_isolated_margin_account(**kwargs) ⇒ Object

Query Isolated Margin Account Info (USER_DATA)

GET /sapi/v1/margin/isolated/account

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbols (String)

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

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



563
564
565
# File 'lib/binance/spot/margin.rb', line 563

def (**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/isolated/account', params: kwargs)
end

#get_isolated_margin_account_limit(**kwargs) ⇒ Object

Query Enabled Isolated Margin Account Limit (USER_DATA)

GET /sapi/v1/margin/isolated/accountLimit

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



602
603
604
# File 'lib/binance/spot/margin.rb', line 602

def (**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/isolated/accountLimit', params: kwargs)
end

#get_isolated_margin_pair(symbol:, **kwargs) ⇒ Object

Query Isolated Margin Symbol (USER_DATA)

GET /sapi/v1/margin/isolated/pair

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



614
615
616
617
618
# File 'lib/binance/spot/margin.rb', line 614

def get_isolated_margin_pair(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:get, '/sapi/v1/margin/isolated/pair', params: kwargs.merge(symbol: symbol))
end

#get_isolated_margin_transfer(symbol:, **kwargs) ⇒ Object

Get Isolated Margin Transfer History (USER_DATA)

GET /sapi/v1/margin/isolated/transfer

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)
  • :transFrom (String)

    “SPOT”, “ISOLATED_MARGIN”

  • :transTo (String)

    “SPOT”, “ISOLATED_MARGIN”

  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Current page, default 1

  • :size (Integer)

    Default 10, max 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



549
550
551
552
553
# File 'lib/binance/spot/margin.rb', line 549

def get_isolated_margin_transfer(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:get, '/sapi/v1/margin/isolated/transfer', params: kwargs.merge(symbol: symbol))
end

#get_margin_interest_rate_history(asset:, **kwargs) ⇒ Object

Query Margin Interest Rate History (USER_DATA)

GET /sapi/v1/margin/interestRateHistory

Parameters:

  • asset (String)
  • kwargs (Hash)
  • vipLevel (Hash)

    a customizable set of options

  • startTime (Hash)

    a customizable set of options

  • endTime (Hash)

    a customizable set of options

  • limit (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



669
670
671
672
673
# File 'lib/binance/spot/margin.rb', line 669

def get_margin_interest_rate_history(asset:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.sign_request(:get, '/sapi/v1/margin/interestRateHistory', params: kwargs.merge(asset: asset))
end

#isolated_margin_transfer(asset:, symbol:, transFrom:, transTo:, amount:, **kwargs) ⇒ Object

Isolated Margin Account Transfer (MARGIN)

POST /sapi/v1/margin/isolated/transfer

Parameters:

  • asset (String)
  • symbol (String)
  • transFrom (String)

    “SPOT”, “ISOLATED_MARGIN”

  • transTo (String)

    “SPOT”, “ISOLATED_MARGIN”

  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/binance/spot/margin.rb', line 518

def isolated_margin_transfer(asset:, symbol:, transFrom:, transTo:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('transFrom', transFrom)
  Binance::Utils::Validation.require_param('transTo', transTo)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:post, '/sapi/v1/margin/isolated/transfer', params: kwargs.merge(
    asset: asset,
    symbol: symbol,
    transFrom: transFrom,
    transTo: transTo,
    amount: amount
  ))
end

#margin_account(**kwargs) ⇒ Object

Query Cross Margin Account Details (USER_DATA)

GET /sapi/v1/margin/account

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



300
301
302
# File 'lib/binance/spot/margin.rb', line 300

def (**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/account', params: kwargs)
end

#margin_all_assetsObject

Get All Margin Assets (MARKET_DATA)

GET /sapi/v1/margin/allAssets



107
108
109
# File 'lib/binance/spot/margin.rb', line 107

def margin_all_assets
  @session.limit_request(path: '/sapi/v1/margin/allAssets')
end

#margin_all_orders(symbol:, **kwargs) ⇒ Object

Query Margin Account’s All Order (USER_DATA)

GET /sapi/v1/margin/allOrders

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :orderId (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :limit (Integer)

    Default 500; max 1000.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



347
348
349
350
351
# File 'lib/binance/spot/margin.rb', line 347

def margin_all_orders(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:get, '/sapi/v1/margin/allOrders', params: kwargs.merge(symbol: symbol))
end

#margin_all_pairsObject

Get All Margin Pairs (MARKET_DATA)

GET /sapi/v1/margin/allPairs



116
117
118
# File 'lib/binance/spot/margin.rb', line 116

def margin_all_pairs
  @session.limit_request(path: '/sapi/v1/margin/allPairs')
end

#margin_asset(asset:) ⇒ Object

Query Margin Asset (MARKET_DATA)

GET /sapi/v1/margin/asset



84
85
86
87
88
# File 'lib/binance/spot/margin.rb', line 84

def margin_asset(asset:)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.limit_request(path: '/sapi/v1/margin/asset', params: { asset: asset })
end

#margin_borrow(asset:, amount:, **kwargs) ⇒ Object

Margin Account Borrow (MARGIN)

POST /sapi/v1/margin/loan

Apply for a loan.

Parameters:

  • asset (String)
  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”; default “FALSE”

  • :symbol (String)

    isolated symbol

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



45
46
47
48
49
50
51
52
53
# File 'lib/binance/spot/margin.rb', line 45

def margin_borrow(asset:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:post, '/sapi/v1/margin/loan', params: kwargs.merge(
    asset: asset,
    amount: amount
  ))
end

#margin_cancel_all_order(symbol:, **kwargs) ⇒ Object

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

DELETE /sapi/v1/margin/openOrders

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



191
192
193
194
195
196
197
# File 'lib/binance/spot/margin.rb', line 191

def margin_cancel_all_order(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:delete, '/sapi/v1/margin/openOrders', params: kwargs.merge(
    symbol: symbol
  ))
end

#margin_cancel_oco(symbol:, **kwargs) ⇒ Object

Margin Account Cancel OCO (TRADE)

DELETE /sapi/v1/margin/orderList

Canceling an individual leg will cancel the entire OCO

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)
  • :orderListId (Integer)

    Either orderListId or listClientOrderId must be provided

  • :listClientOrderId (String)

    Either orderListId or listClientOrderId must be provided

  • :newClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



405
406
407
408
409
410
411
# File 'lib/binance/spot/margin.rb', line 405

def margin_cancel_oco(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:delete, '/sapi/v1/margin/orderList', params: kwargs.merge(
    symbol: symbol
  ))
end

#margin_cancel_order(symbol:, **kwargs) ⇒ Object

Margin Account Cancel Order (TRADE)

DELETE /sapi/v1/margin/order

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :orderId (String)
  • :origClientOrderId (String)
  • :newClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



174
175
176
177
178
179
180
# File 'lib/binance/spot/margin.rb', line 174

def margin_cancel_order(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:delete, '/sapi/v1/margin/order', params: kwargs.merge(
    symbol: symbol
  ))
end

#margin_force_liquidation_record(**kwargs) ⇒ Object

Get Force Liquidation Record (USER_DATA)

GET /sapi/v1/margin/forceLiquidationRec

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :isolatedSymbol (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Currently querying page. Start from 1. Default:1

  • :size (Integer)

    Default:10 Max:100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



289
290
291
# File 'lib/binance/spot/margin.rb', line 289

def margin_force_liquidation_record(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/forceLiquidationRec', params: kwargs)
end

#margin_get_all_oco(**kwargs) ⇒ Object

Query Margin Account’s all OCO (USER_DATA)

GET /sapi/v1/margin/allOrderList

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbol (String)
  • :isIsolated (String)
  • :fromId (Integer)

    If supplied, neither startTime nor endTime can be provided

  • :startTime (Integer)
  • :endTime (Integer)
  • :limit (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



441
442
443
# File 'lib/binance/spot/margin.rb', line 441

def margin_get_all_oco(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/allOrderList', params: kwargs)
end

#margin_get_oco(**kwargs) ⇒ Object

Query Margin Account’s OCO (USER_DATA)

GET /sapi/v1/margin/orderList

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbol (String)
  • :isIsolated (String)
  • :orderListId (Integer)

    Either orderListId or origClientOrderId must be provided

  • :origClientOrderId (String)

    Either orderListId or origClientOrderId must be provided

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



424
425
426
# File 'lib/binance/spot/margin.rb', line 424

def margin_get_oco(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/orderList', params: kwargs)
end

#margin_get_open_oco(**kwargs) ⇒ Object

Query Margin Account’s Open OCO (USER_DATA)

GET /sapi/v1/margin/openOrderList

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbol (String)
  • :isIsolated (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



454
455
456
# File 'lib/binance/spot/margin.rb', line 454

def margin_get_open_oco(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/openOrderList', params: kwargs)
end

#margin_interest_history(**kwargs) ⇒ Object

Get Interest History (USER_DATA)

GET /sapi/v1/margin/interestHistory

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)
  • :isolatedSymbol (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Currently querying page. Start from 1. Default:1

  • :size (Integer)

    Default:10 Max:100

  • :archived (String)

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

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



273
274
275
# File 'lib/binance/spot/margin.rb', line 273

def margin_interest_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/interestHistory', params: kwargs)
end

#margin_load_record(asset:, **kwargs) ⇒ Object

Query Loan Record (USER_DATA)

GET /sapi/v1/margin/loan

Parameters:

  • asset (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isolatedSymbol (String)
  • :txId (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Currently querying page. Start from 1. Default:1

  • :size (Integer)

    Default:10 Max:100

  • :archived (String)

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

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



232
233
234
235
236
# File 'lib/binance/spot/margin.rb', line 232

def margin_load_record(asset:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.sign_request(:get, '/sapi/v1/margin/loan', params: kwargs.merge(asset: asset))
end

#margin_max_borrowable(asset:, **kwargs) ⇒ Object

Query Max Borrow (USER_DATA)

GET /sapi/v1/margin/maxBorrowable

Parameters:

  • asset (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isolatedSymbol (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



485
486
487
488
489
# File 'lib/binance/spot/margin.rb', line 485

def margin_max_borrowable(asset:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.sign_request(:get, '/sapi/v1/margin/maxBorrowable', params: kwargs.merge(asset: asset))
end

#margin_max_transferable(asset:, **kwargs) ⇒ Object

Query Max Transfer-Out Amount (USER_DATA)

GET /sapi/v1/margin/maxTransferable

Parameters:

  • asset (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isolatedSymbol (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



500
501
502
503
504
# File 'lib/binance/spot/margin.rb', line 500

def margin_max_transferable(asset:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.sign_request(:get, '/sapi/v1/margin/maxTransferable', params: kwargs.merge(asset: asset))
end

#margin_my_trades(symbol:, **kwargs) ⇒ Object

Query Margin Account’s Trade List (USER_DATA)

GET /sapi/v1/margin/myTrades

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :startTime (Integer)
  • :endTime (Integer)
  • :orderfromIdId (String)
  • :limit (Integer)

    Default 500; max 1000.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



470
471
472
473
474
# File 'lib/binance/spot/margin.rb', line 470

def margin_my_trades(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:get, '/sapi/v1/margin/myTrades', params: kwargs.merge(symbol: symbol))
end

#margin_new_order(symbol:, side:, type:, **kwargs) ⇒ Object

Margin Account New Order (TRADE)

POST /sapi/v1/margin/order

Parameters:

  • symbol (String)
  • side (String)
  • type (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :quantity (Float)
  • :quoteOrderQty (Float)
  • :price (Float)
  • :stopPrice (Float)

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

  • :newClientOrderId (String)
  • :icebergQty (Float)

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

  • :newOrderRespType (String)
  • :sideEffectType (String)

    NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.

  • :timeInForce (String)

    GTC,IOC,FOK

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/binance/spot/margin.rb', line 150

def margin_new_order(symbol:, side:, type:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('side', side)
  Binance::Utils::Validation.require_param('type', type)

  @session.sign_request(:post, '/sapi/v1/margin/order', params: kwargs.merge(
    symbol: symbol,
    side: side,
    type: type
  ))
end

#margin_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) ⇒ Object

Margin Account New OCO (TRADE)

POST /sapi/v1/margin/order/oco

Parameters:

  • symbol (String)
  • side (String)
  • quantity (Float)
  • price (Float)
  • stopPrice (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :listClientOrderId (String)
  • :limitClientOrderId (String)
  • :limitIcebergQty (Float)
  • :stopClientOrderId (String)
  • :stopLimitPrice (Float)

    If provided, stopLimitTimeInForce is required.

  • :stopIcebergQty (Float)
  • :stopLimitTimeInForce (String)

    Valid values are GTC/FOK/IOC

  • :newOrderRespType (String)
  • :sideEffectType (String)

    NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/binance/spot/margin.rb', line 375

def margin_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('side', side)
  Binance::Utils::Validation.require_param('quantity', quantity)
  Binance::Utils::Validation.require_param('price', price)
  Binance::Utils::Validation.require_param('stopPrice', stopPrice)

  @session.sign_request(:post, '/sapi/v1/margin/order/oco', params: kwargs.merge(
    symbol: symbol,
    side: side,
    quantity: quantity,
    price: price,
    stopPrice: stopPrice
  ))
end

#margin_open_orders(**kwargs) ⇒ Object

Query Margin Account’s Open Order (USER_DATA)

GET /sapi/v1/margin/openOrders

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbol (String)
  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



330
331
332
# File 'lib/binance/spot/margin.rb', line 330

def margin_open_orders(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/openOrders', params: kwargs)
end

#margin_order(symbol:, **kwargs) ⇒ Object

Query Margin Account’s Order (USER_DATA)

GET /sapi/v1/margin/order

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”, default “FALSE”

  • :orderId (Integer)
  • :origClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



315
316
317
318
319
# File 'lib/binance/spot/margin.rb', line 315

def margin_order(symbol:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:get, '/sapi/v1/margin/order', params: kwargs.merge(symbol: symbol))
end

#margin_pair(symbol:) ⇒ Object

Query Margin Pair (MARKET_DATA)

GET /sapi/v1/margin/pair



96
97
98
99
100
# File 'lib/binance/spot/margin.rb', line 96

def margin_pair(symbol:)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.limit_request(path: '/sapi/v1/margin/pair', params: { symbol: symbol })
end

#margin_price_index(symbol:) ⇒ Object

Query Margin PriceIndex (MARKET_DATA)

GET /sapi/v1/margin/priceIndex



125
126
127
128
# File 'lib/binance/spot/margin.rb', line 125

def margin_price_index(symbol:)
  Binance::Utils::Validation.require_param('symbol', symbol)
  @session.limit_request(path: '/sapi/v1/margin/priceIndex', params: { symbol: symbol })
end

#margin_repay(asset:, amount:, **kwargs) ⇒ Object

Margin Account Repay (MARGIN)

POST /sapi/v1/margin/repay

Repay loan for margin account.

Parameters:

  • asset (String)
  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isIsolated (String)

    for isolated margin or not, “TRUE”, “FALSE”; default “FALSE”

  • :symbol (String)

    isolated symbol

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



68
69
70
71
72
73
74
75
76
# File 'lib/binance/spot/margin.rb', line 68

def margin_repay(asset:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:post, '/sapi/v1/margin/repay', params: kwargs.merge(
    asset: asset,
    amount: amount
  ))
end

#margin_repay_record(asset:, **kwargs) ⇒ Object

Query Repay Record (USER_DATA)

GET /sapi/v1/margin/repay

Parameters:

  • asset (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :isolatedSymbol (String)
  • :txId (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Currently querying page. Start from 1. Default:1

  • :size (Integer)

    Default:10 Max:100

  • :archived (String)

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

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



253
254
255
256
257
# File 'lib/binance/spot/margin.rb', line 253

def margin_repay_record(asset:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.sign_request(:get, '/sapi/v1/margin/repay', params: kwargs.merge(asset: asset))
end

#margin_transfer(asset:, amount:, type:, **kwargs) ⇒ Object

Cross Margin Account Transfer (MARGIN)

POST /sapi/v1/margin/transfer

Execute transfer between spot account and cross margin account.

Parameters:

  • asset (String)
  • amount (Float)
  • type (Integer)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/binance/spot/margin.rb', line 20

def margin_transfer(asset:, amount:, type:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)
  Binance::Utils::Validation.require_param('amount', amount)
  Binance::Utils::Validation.require_param('type', type)

  @session.sign_request(:post, '/sapi/v1/margin/transfer', params: kwargs.merge(
    asset: asset,
    amount: amount,
    type: type
  ))
end

#margin_transfer_history(**kwargs) ⇒ Object

Get Cross Margin Transfer History (USER_DATA)

GET /sapi/v1/margin/transfer

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)
  • :type (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Currently querying page. Start from 1. Default:1

  • :size (Integer)

    Default:10 Max:100

  • :archived (String)

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

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



213
214
215
# File 'lib/binance/spot/margin.rb', line 213

def margin_transfer_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/margin/transfer', params: kwargs)
end

#toggle_bnb_burn(**kwargs) ⇒ Object

Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA)

POST /sapi/v1/bnbBurn

“spotBNBBurn” and “interestBNBBurn” should be sent at least one.

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :spotBNBBurn (String)

    “true” or “false”; Determines whether to use BNB to pay for trading fees on SPOT

  • :interestBNBBurn (String)

    “true” or “false”; Determines whether to use BNB to pay for margin loan’s interest

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



642
643
644
# File 'lib/binance/spot/margin.rb', line 642

def toggle_bnb_burn(**kwargs)
  @session.sign_request(:post, '/sapi/v1/bnbBurn', params: kwargs)
end