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_cross_margin_data(**kwargs) ⇒ Object
Query Cross Margin Fee Data (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_data(**kwargs) ⇒ Object
Query Isolated Margin Fee Data (USER_DATA).
-
#get_isolated_margin_tier(symbol:, **kwargs) ⇒ Object
Query Isolated Margin Tier Data (USER_DATA).
-
#get_margin_interest_rate_history(asset:, **kwargs) ⇒ Object
Query Margin Interest Rate History (USER_DATA).
-
#get_margin_order_usage(**kwargs) ⇒ Object
Query Current Margin Order Count Usage (TRADE).
-
#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_available_inventory(type:) ⇒ Object
Query Margin Available Inventory(USER_DATA).
-
#margin_borrow_repay(asset:, isIsolated:, symbol:, amount:, type:, **kwargs) ⇒ Object
Margin account borrow/repay (MARGIN).
-
#margin_borrow_repay_record(type:, **kwargs) ⇒ Object
Query borrow/repay records in Margin account (USER_DATA).
-
#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_leverage_bracket ⇒ Object
Query Liability Coin Leverage Bracket in Cross Margin Pro Mode(MARKET_DATA).
-
#margin_manual_liquidation(type:, **kwargs) ⇒ Object
Margin Manual Liquidation.
-
#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_price_index(symbol:) ⇒ Object
Query Margin PriceIndex (MARKET_DATA).
-
#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
475 476 477 478 479 |
# File 'lib/binance/spot/margin.rb', line 475 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
489 490 491 492 493 |
# File 'lib/binance/spot/margin.rb', line 489 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
513 514 515 |
# File 'lib/binance/spot/margin.rb', line 513 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
539 540 541 |
# File 'lib/binance/spot/margin.rb', line 539 def get_bnb_burn(**kwargs) @session.sign_request(:get, '/sapi/v1/bnbBurn', params: kwargs) end |
#get_cross_margin_data(**kwargs) ⇒ Object
Query Cross Margin Fee Data (USER_DATA)
GET /sapi/v1/margin/crossMarginData
570 571 572 |
# File 'lib/binance/spot/margin.rb', line 570 def get_cross_margin_data(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/crossMarginData', params: kwargs) end |
#get_isolated_margin_account(**kwargs) ⇒ Object
Query Isolated Margin Account Info (USER_DATA)
GET /sapi/v1/margin/isolated/account
463 464 465 |
# File 'lib/binance/spot/margin.rb', line 463 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
502 503 504 |
# File 'lib/binance/spot/margin.rb', line 502 def get_isolated_margin_account_limit(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/accountLimit', params: kwargs) end |
#get_isolated_margin_data(**kwargs) ⇒ Object
Query Isolated Margin Fee Data (USER_DATA)
GET /sapi/v1/margin/isolatedMarginData
583 584 585 |
# File 'lib/binance/spot/margin.rb', line 583 def get_isolated_margin_data(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolatedMarginData', params: kwargs) end |
#get_isolated_margin_tier(symbol:, **kwargs) ⇒ Object
Query Isolated Margin Tier Data (USER_DATA)
GET /sapi/v1/margin/isolatedMarginTier
596 597 598 599 600 |
# File 'lib/binance/spot/margin.rb', line 596 def get_isolated_margin_tier(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @session.sign_request(:get, '/sapi/v1/margin/isolatedMarginTier', 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
555 556 557 558 559 |
# File 'lib/binance/spot/margin.rb', line 555 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 |
#get_margin_order_usage(**kwargs) ⇒ Object
Query Current Margin Order Count Usage (TRADE)
GET /sapi/v1/margin/rateLimit/order
611 612 613 |
# File 'lib/binance/spot/margin.rb', line 611 def get_margin_order_usage(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/rateLimit/order', params: kwargs) end |
#margin_account(**kwargs) ⇒ Object
Query Cross Margin Account Details (USER_DATA)
GET /sapi/v1/margin/account
234 235 236 |
# File 'lib/binance/spot/margin.rb', line 234 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
13 14 15 |
# File 'lib/binance/spot/margin.rb', line 13 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
281 282 283 284 285 |
# File 'lib/binance/spot/margin.rb', line 281 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
22 23 24 |
# File 'lib/binance/spot/margin.rb', line 22 def margin_all_pairs @session.limit_request(path: '/sapi/v1/margin/allPairs') end |
#margin_available_inventory(type:) ⇒ Object
Query Margin Available Inventory(USER_DATA)
GET /sapi/v1/margin/available-inventory
42 43 44 45 46 |
# File 'lib/binance/spot/margin.rb', line 42 def margin_available_inventory(type:) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:get, '/sapi/v1/margin/available-inventory', params: { type: type }) end |
#margin_borrow_repay(asset:, isIsolated:, symbol:, amount:, type:, **kwargs) ⇒ Object
Margin account borrow/repay (MARGIN)
POST /sapi/v1/margin/borrow-repay
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/binance/spot/margin.rb', line 174 def margin_borrow_repay(asset:, isIsolated:, symbol:, amount:, type:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) Binance::Utils::Validation.require_param('isIsolated', isIsolated) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('amount', amount) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:post, '/sapi/v1/margin/borrow-repay', params: kwargs.merge( asset: asset, isIsolated: isIsolated, symbol: symbol, amount: amount, type: type )) end |
#margin_borrow_repay_record(type:, **kwargs) ⇒ Object
Query borrow/repay records in Margin account (USER_DATA)
GET /sapi/v1/margin/borrow-repay
205 206 207 208 209 |
# File 'lib/binance/spot/margin.rb', line 205 def margin_borrow_repay_record(type:, **kwargs) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:get, '/sapi/v1/margin/borrow-repay', params: kwargs.merge(type: type)) end |
#margin_cancel_all_order(symbol:, **kwargs) ⇒ Object
Margin Account Cancel all Open Orders on a Symbol (TRADE)
DELETE /sapi/v1/margin/openOrders
118 119 120 121 122 123 124 |
# File 'lib/binance/spot/margin.rb', line 118 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
339 340 341 342 343 344 345 |
# File 'lib/binance/spot/margin.rb', line 339 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
101 102 103 104 105 106 107 |
# File 'lib/binance/spot/margin.rb', line 101 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
223 224 225 |
# File 'lib/binance/spot/margin.rb', line 223 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
375 376 377 |
# File 'lib/binance/spot/margin.rb', line 375 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
358 359 360 |
# File 'lib/binance/spot/margin.rb', line 358 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
388 389 390 |
# File 'lib/binance/spot/margin.rb', line 388 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
158 159 160 |
# File 'lib/binance/spot/margin.rb', line 158 def margin_interest_history(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/interestHistory', params: kwargs) end |
#margin_leverage_bracket ⇒ Object
Query Liability Coin Leverage Bracket in Cross Margin Pro Mode(MARKET_DATA)
GET /sapi/v1/margin/leverageBracket
53 54 55 |
# File 'lib/binance/spot/margin.rb', line 53 def margin_leverage_bracket @session.limit_request(path: '/sapi/v1/margin/leverageBracket') end |
#margin_manual_liquidation(type:, **kwargs) ⇒ Object
Margin Manual Liquidation
POST /sapi/v1/margin/manual-liquidation
419 420 421 422 423 |
# File 'lib/binance/spot/margin.rb', line 419 def margin_manual_liquidation(type:, **kwargs) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:post, '/sapi/v1/margin/manual-liquidation', params: kwargs.merge(type: type)) end |
#margin_max_borrowable(asset:, **kwargs) ⇒ Object
Query Max Borrow (USER_DATA)
GET /sapi/v1/margin/maxBorrowable
434 435 436 437 438 |
# File 'lib/binance/spot/margin.rb', line 434 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
449 450 451 452 453 |
# File 'lib/binance/spot/margin.rb', line 449 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
404 405 406 407 408 |
# File 'lib/binance/spot/margin.rb', line 404 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
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/binance/spot/margin.rb', line 77 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
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/binance/spot/margin.rb', line 309 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
264 265 266 |
# File 'lib/binance/spot/margin.rb', line 264 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
249 250 251 252 253 |
# File 'lib/binance/spot/margin.rb', line 249 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_price_index(symbol:) ⇒ Object
Query Margin PriceIndex (MARKET_DATA)
GET /sapi/v1/margin/priceIndex
31 32 33 34 |
# File 'lib/binance/spot/margin.rb', line 31 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_transfer_history(**kwargs) ⇒ Object
Get Cross Margin Transfer History (USER_DATA)
GET /sapi/v1/margin/transfer
140 141 142 |
# File 'lib/binance/spot/margin.rb', line 140 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.
528 529 530 |
# File 'lib/binance/spot/margin.rb', line 528 def toggle_bnb_burn(**kwargs) @session.sign_request(:post, '/sapi/v1/bnbBurn', params: kwargs) end |