Module: Binance::Spot::Margin
- Included in:
- Binance::Spot
- Defined in:
- lib/binance/spot/margin.rb
Overview
Margin endpoints
Instance Method Summary collapse
-
#disable_isolated_margin_account(symbol:, **kwargs) ⇒ Object
Disable Isolated Margin Account (TRADE).
-
#enable_isolated_margin_account(symbol:, **kwargs) ⇒ Object
Enable Isolated Margin Account (TRADE).
-
#get_all_isolated_margin_pairs(**kwargs) ⇒ Object
Get All Isolated Margin Symbol(USER_DATA).
-
#get_bnb_burn(**kwargs) ⇒ Object
Get BNB Burn Status (USER_DATA).
-
#get_isolated_margin_account(**kwargs) ⇒ Object
Query Isolated Margin Account Info (USER_DATA).
-
#get_isolated_margin_account_limit(**kwargs) ⇒ Object
Query Enabled Isolated Margin Account Limit (USER_DATA).
-
#get_isolated_margin_pair(symbol:, **kwargs) ⇒ Object
Query Isolated Margin Symbol (USER_DATA).
-
#get_isolated_margin_transfer(symbol:, **kwargs) ⇒ Object
Get Isolated Margin Transfer History (USER_DATA).
-
#get_margin_interest_rate_history(asset:, **kwargs) ⇒ Object
Query Margin Interest Rate History (USER_DATA).
-
#isolated_margin_transfer(asset:, symbol:, transFrom:, transTo:, amount:, **kwargs) ⇒ Object
Isolated Margin Account Transfer (MARGIN).
-
#margin_account(**kwargs) ⇒ Object
Query Cross Margin Account Details (USER_DATA).
-
#margin_all_assets ⇒ Object
Get All Margin Assets (MARKET_DATA).
-
#margin_all_orders(symbol:, **kwargs) ⇒ Object
Query Margin Account’s All Order (USER_DATA).
-
#margin_all_pairs ⇒ Object
Get All Margin Pairs (MARKET_DATA).
-
#margin_asset(asset:) ⇒ Object
Query Margin Asset (MARKET_DATA).
-
#margin_borrow(asset:, amount:, **kwargs) ⇒ Object
Margin Account Borrow (MARGIN).
-
#margin_cancel_all_order(symbol:, **kwargs) ⇒ Object
Margin Account Cancel all Open Orders on a Symbol (TRADE).
-
#margin_cancel_oco(symbol:, **kwargs) ⇒ Object
Margin Account Cancel OCO (TRADE).
-
#margin_cancel_order(symbol:, **kwargs) ⇒ Object
Margin Account Cancel Order (TRADE).
-
#margin_force_liquidation_record(**kwargs) ⇒ Object
Get Force Liquidation Record (USER_DATA).
-
#margin_get_all_oco(**kwargs) ⇒ Object
Query Margin Account’s all OCO (USER_DATA).
-
#margin_get_oco(**kwargs) ⇒ Object
Query Margin Account’s OCO (USER_DATA).
-
#margin_get_open_oco(**kwargs) ⇒ Object
Query Margin Account’s Open OCO (USER_DATA).
-
#margin_interest_history(**kwargs) ⇒ Object
Get Interest History (USER_DATA).
-
#margin_load_record(asset:, **kwargs) ⇒ Object
Query Loan Record (USER_DATA).
-
#margin_max_borrowable(asset:, **kwargs) ⇒ Object
Query Max Borrow (USER_DATA).
-
#margin_max_transferable(asset:, **kwargs) ⇒ Object
Query Max Transfer-Out Amount (USER_DATA).
-
#margin_my_trades(symbol:, **kwargs) ⇒ Object
Query Margin Account’s Trade List (USER_DATA).
-
#margin_new_order(symbol:, side:, type:, **kwargs) ⇒ Object
Margin Account New Order (TRADE).
-
#margin_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) ⇒ Object
Margin Account New OCO (TRADE).
-
#margin_open_orders(**kwargs) ⇒ Object
Query Margin Account’s Open Order (USER_DATA).
-
#margin_order(symbol:, **kwargs) ⇒ Object
Query Margin Account’s Order (USER_DATA).
-
#margin_pair(symbol:) ⇒ Object
Query Margin Pair (MARKET_DATA).
-
#margin_price_index(symbol:) ⇒ Object
Query Margin PriceIndex (MARKET_DATA).
-
#margin_repay(asset:, amount:, **kwargs) ⇒ Object
Margin Account Repay (MARGIN).
-
#margin_repay_record(asset:, **kwargs) ⇒ Object
Query Repay Record (USER_DATA).
-
#margin_transfer(asset:, amount:, type:, **kwargs) ⇒ Object
Cross Margin Account Transfer (MARGIN).
-
#margin_transfer_history(**kwargs) ⇒ Object
Get Cross Margin Transfer History (USER_DATA).
-
#toggle_bnb_burn(**kwargs) ⇒ Object
Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA).
Instance Method Details
#disable_isolated_margin_account(symbol:, **kwargs) ⇒ Object
Disable Isolated Margin Account (TRADE)
DELETE /sapi/v1/margin/isolated/account
575 576 577 578 579 |
# File 'lib/binance/spot/margin.rb', line 575 def disable_isolated_margin_account(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
589 590 591 592 593 |
# File 'lib/binance/spot/margin.rb', line 589 def enable_isolated_margin_account(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
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
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
563 564 565 |
# File 'lib/binance/spot/margin.rb', line 563 def get_isolated_margin_account(**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
602 603 604 |
# File 'lib/binance/spot/margin.rb', line 602 def get_isolated_margin_account_limit(**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
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
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
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
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
300 301 302 |
# File 'lib/binance/spot/margin.rb', line 300 def margin_account(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/account', params: kwargs) end |
#margin_all_assets ⇒ Object
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
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_pairs ⇒ Object
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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.
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
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.
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 |