module Binance::Spot::Margin
def disable_isolated_margin_account(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Disable-Isolated-Margin-Account -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def enable_isolated_margin_account(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Enable-Isolated-Margin-Account -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def get_all_isolated_margin_pairs(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000
Parameters:
-
kwargs(Hash) --
def get_all_isolated_margin_pairs(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/allPairs', params: kwargs) end
def get_bnb_burn(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Get-BNB-Burn-Status -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000
Parameters:
-
kwargs(Hash) --
def get_bnb_burn(**kwargs) @session.sign_request(:get, '/sapi/v1/bnbBurn', params: kwargs) end
def get_cross_margin_data(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Fee-Data -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
(String) -- -
Default:(Integer) -- user's vip level
Parameters:
-
kwargs(Hash) --
def get_cross_margin_data(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/crossMarginData', params: kwargs) end
def get_isolated_margin_account(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:symbols(String) -- Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT"
Parameters:
-
kwargs(Hash) --
def get_isolated_margin_account(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/account', params: kwargs) end
def get_isolated_margin_account_limit(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Query-Enabled-Isolated-Margin-Account-Limit -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000
Parameters:
-
kwargs(Hash) --
def get_isolated_margin_account_limit(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/accountLimit', params: kwargs) end
def get_isolated_margin_data(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
(String) -- -
Default:(Integer) -- user's vip level
Parameters:
-
kwargs(Hash) --
def get_isolated_margin_data(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolatedMarginData', params: kwargs) end
def get_isolated_margin_tier(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/market-data/Query-Isolated-Margin-Tier-Data -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
(Integer) --
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def get_margin_interest_rate_history(asset:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
Default:(Integer) -- 20. Maximum: 100 -
Default:(Integer) -- present. Maximum range: 3 months. -
Default:(Integer) -- 7 days ago -
Default:(Integer) -- user's vip level
Parameters:
-
kwargs(Hash) -- -
asset(String) --
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
def get_margin_order_usage(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
(String) -- -
(String) --
Parameters:
-
kwargs(Hash) --
def get_margin_order_usage(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/rateLimit/order', params: kwargs) end
def margin_account(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000
Parameters:
-
kwargs(Hash) --
def margin_account(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/account', params: kwargs) end
def margin_all_assets
- See: https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets -
def margin_all_assets @session.limit_request(path: '/sapi/v1/margin/allAssets') end
def margin_all_orders(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:limit(Integer) -- Default 500; max 1000. -
:endTime(Integer) -- -
:startTime(Integer) -- -
:orderId(String) -- -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def margin_all_pairs
- See: https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs -
def margin_all_pairs @session.limit_request(path: '/sapi/v1/margin/allPairs') end
def margin_cancel_all_order(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def margin_cancel_oco(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-OCO -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:newClientOrderId(String) -- -
:listClientOrderId(String) -- Either orderListId or listClientOrderId must be provided -
:orderListId(Integer) -- Either orderListId or listClientOrderId must be provided -
:isIsolated(String) --
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def margin_cancel_order(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:newClientOrderId(String) -- -
:origClientOrderId(String) -- -
:orderId(String) -- -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def margin_force_liquidation_record(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Get-Force-Liquidation-Record -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:size(Integer) -- Default:10 Max:100 -
:current(Integer) -- Currently querying page. Start from 1. Default:1 -
:endTime(Integer) -- -
:startTime(Integer) -- -
:isolatedSymbol(String) --
Parameters:
-
kwargs(Hash) --
def margin_force_liquidation_record(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/forceLiquidationRec', params: kwargs) end
def margin_get_all_oco(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-OCO -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:limit(Integer) -- -
:endTime(Integer) -- -
:startTime(Integer) -- -
:fromId(Integer) -- If supplied, neither startTime nor endTime can be provided -
:isIsolated(String) -- -
:symbol(String) --
Parameters:
-
kwargs(Hash) --
def margin_get_all_oco(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/allOrderList', params: kwargs) end
def margin_get_oco(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-OCO -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:origClientOrderId(String) -- Either orderListId or origClientOrderId must be provided -
:orderListId(Integer) -- Either orderListId or origClientOrderId must be provided -
:isIsolated(String) -- -
:symbol(String) --
Parameters:
-
kwargs(Hash) --
def margin_get_oco(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/orderList', params: kwargs) end
def margin_get_open_oco(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-OCO -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:isIsolated(String) -- -
:symbol(String) --
Parameters:
-
kwargs(Hash) --
def margin_get_open_oco(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/openOrderList', params: kwargs) end
def margin_interest_history(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:archived(String) -- Default: false. Set to true for archived data from 6 months ago -
:size(Integer) -- Default:10 Max:100 -
:current(Integer) -- Currently querying page. Start from 1. Default:1 -
:endTime(Integer) -- -
:startTime(Integer) -- -
:isolatedSymbol(String) -- -
:asset(String) --
Parameters:
-
kwargs(Hash) --
def margin_interest_history(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/interestHistory', params: kwargs) end
def margin_max_borrowable(asset:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:isolatedSymbol(String) --
Parameters:
-
kwargs(Hash) -- -
asset(String) --
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
def margin_max_transferable(asset:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/transfer/Query-Max-Transfer-Out-Amount -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:isolatedSymbol(String) --
Parameters:
-
kwargs(Hash) -- -
asset(String) --
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
def margin_my_trades(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:limit(Integer) -- Default 500; max 1000. -
:orderfromIdId(String) -- -
:endTime(Integer) -- -
:startTime(Integer) --
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def margin_new_order(symbol:, side:, type:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:timeInForce(String) -- GTC,IOC,FOK -
:sideEffectType(String) -- NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT. -
:newOrderRespType(String) -- -
:icebergQty(Float) -- Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. -
:newClientOrderId(String) -- -
:stopPrice(Float) -- Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. -
:price(Float) -- -
:quoteOrderQty(Float) -- -
:quantity(Float) -- -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
Parameters:
-
kwargs(Hash) -- -
type(String) -- -
side(String) -- -
symbol(String) --
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
def margin_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OCO -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:sideEffectType(String) -- NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT. -
:newOrderRespType(String) -- -
:stopLimitTimeInForce(String) -- Valid values are GTC/FOK/IOC -
:stopIcebergQty(Float) -- -
:stopLimitPrice(Float) -- If provided, stopLimitTimeInForce is required. -
:stopClientOrderId(String) -- -
:limitIcebergQty(Float) -- -
:limitClientOrderId(String) -- -
:listClientOrderId(String) -- -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
Parameters:
-
kwargs(Hash) -- -
stopPrice(Float) -- -
price(Float) -- -
quantity(Float) -- -
side(String) -- -
symbol(String) --
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
def margin_open_orders(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE" -
:symbol(String) --
Parameters:
-
kwargs(Hash) --
def margin_open_orders(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/openOrders', params: kwargs) end
def margin_order(symbol:, **kwargs)
- See: https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:origClientOrderId(String) -- -
:orderId(Integer) -- -
:isIsolated(String) -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
Parameters:
-
kwargs(Hash) -- -
symbol(String) --
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
def margin_price_index(symbol:)
- See: https://developers.binance.com/docs/margin_trading/market-data/Query-Margin-PriceIndex -
def margin_price_index(symbol:) Binance::Utils::Validation.require_param('symbol', symbol) @session.limit_request(path: '/sapi/v1/margin/priceIndex', params: { symbol: symbol }) end
def margin_transfer_history(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/transfer/Get-Cross-Margin-Transfer-History -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:archived(String) -- Default: false. Set to true for archived data from 6 months ago -
:size(Integer) -- Default:10 Max:100 -
:current(Integer) -- Currently querying page. Start from 1. Default:1 -
:endTime(Integer) -- -
:startTime(Integer) -- -
:type(String) -- -
:asset(String) --
Parameters:
-
kwargs(Hash) --
def margin_transfer_history(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/transfer', params: kwargs) end
def toggle_bnb_burn(**kwargs)
- See: https://developers.binance.com/docs/margin_trading/account/Toggle-BNB-Burn-On-Spot-Trade-And-Margin-Interest -
Options Hash:
(**kwargs)-
:recvWindow(Integer) -- The value cannot be greater than 60000 -
:interestBNBBurn(String) -- "true" or "false"; Determines whether to use BNB to pay for margin loan's interest -
:spotBNBBurn(String) -- "true" or "false"; Determines whether to use BNB to pay for trading fees on SPOT
Parameters:
-
kwargs(Hash) --
def toggle_bnb_burn(**kwargs) @session.sign_request(:post, '/sapi/v1/bnbBurn', params: kwargs) end