module Binance::Spot::Futures

Futures endpoints @see binance-docs.github.io/apidocs/spot/en/#futures

Public Instance Methods

adjust_cross_collateral(loanCoin:, collateralCoin:, amount:, direction:, **kwargs) click to toggle source

Adjust Cross-Collateral LTV (TRADE)

POST /sapi/v2/futures/loan/adjustCollateral

@param loanCoin [String] @param collateralCoin [String] @param amount [Float] @param direction [String] “ADDITIONAL”, “REDUCED” @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-v2-trade

# File lib/binance/spot/futures.rb, line 209
def adjust_cross_collateral(loanCoin:, collateralCoin:, amount:, direction:, **kwargs)
  Binance::Utils::Validation.require_param('loanCoin', loanCoin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
  Binance::Utils::Validation.require_param('amount', amount)
  Binance::Utils::Validation.require_param('direction', direction)

  @session.sign_request(:post, '/sapi/v2/futures/loan/adjustCollateral', params: kwargs.merge(
    loanCoin: loanCoin,
    collateralCoin: collateralCoin,
    amount: amount,
    direction: direction
  ))
end
adjust_cross_collateral_history(**kwargs) click to toggle source

Adjust Cross-Collateral LTV History (USER_DATA)

GET /sapi/v1/futures/loan/adjustCollateral/history

All data will be returned if loanCoin or collateralCoin is not sent

@param kwargs [Hash] @option kwargs [String] :loanCoin @option kwargs [String] :collateralCoin @option kwargs [Integer] :startTime @option kwargs [Integer] :endTime @option kwargs [Integer] :limit default 500, max 1000 @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data

# File lib/binance/spot/futures.rb, line 237
def adjust_cross_collateral_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/futures/loan/adjustCollateral/history', params: kwargs)
end
calculate_adjust_max_amount(loanCoin:, collateralCoin:, **kwargs) click to toggle source

Get Max Amount for Adjust Cross-Collateral LTV (USER_DATA)

GET /sapi/v2/futures/loan/calcMaxAdjustAmount

@param loanCoin [String] @param collateralCoin [String] @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#get-max-amount-for-adjust-cross-collateral-ltv-v2-user_data

# File lib/binance/spot/futures.rb, line 188
def calculate_adjust_max_amount(loanCoin:, collateralCoin:, **kwargs)
  Binance::Utils::Validation.require_param('loanCoin', loanCoin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)

  @session.sign_request(:get, '/sapi/v2/futures/loan/calcMaxAdjustAmount', params: kwargs.merge(
    loanCoin: loanCoin,
    collateralCoin: collateralCoin
  ))
end
calculate_adjust_rate(loanCoin:, collateralCoin:, amount:, direction:, **kwargs) click to toggle source

Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA)

GET /sapi/v2/futures/loan/calcAdjustLevel

@param loanCoin [String] @param collateralCoin [String] @param amount [Float] @param direction [String] “ADDITIONAL”, “REDUCED” @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#calculate-rate-after-adjust-cross-collateral-ltv-v2-user_data

# File lib/binance/spot/futures.rb, line 165
def calculate_adjust_rate(loanCoin:, collateralCoin:, amount:, direction:, **kwargs)
  Binance::Utils::Validation.require_param('loanCoin', loanCoin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
  Binance::Utils::Validation.require_param('amount', amount)
  Binance::Utils::Validation.require_param('direction', direction)

  @session.sign_request(:get, '/sapi/v2/futures/loan/calcAdjustLevel', params: kwargs.merge(
    loanCoin: loanCoin,
    collateralCoin: collateralCoin,
    amount: amount,
    direction: direction
  ))
end
collateral_repay_limit(coin:, collateralCoin:, **kwargs) click to toggle source

Check Collateral Repay Limit (USER_DATA)

GET /sapi/v1/futures/loan/collateralRepayLimit

Check the maximum and minimum limit when repay with collateral.

@param coin [String] @param collateralCoin [String] @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#check-collateral-repay-limit-user_data

# File lib/binance/spot/futures.rb, line 270
def collateral_repay_limit(coin:, collateralCoin:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)

  @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayLimit', params: kwargs.merge(
    coin: coin,
    collateralCoin: collateralCoin
  ))
end
collateral_repay_quote(coin:, collateralCoin:, amount:, **kwargs) click to toggle source

Get Collateral Repay Quote (USER_DATA)

GET /sapi/v1/futures/loan/collateralRepay

Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds.

@param coin [String] @param collateralCoin [String] @param amount [Float] @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#get-collateral-repay-quote-user_data

# File lib/binance/spot/futures.rb, line 292
def collateral_repay_quote(coin:, collateralCoin:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge(
    coin: coin,
    collateralCoin: collateralCoin,
    amount: amount
  ))
end
cross_collateral_borrow(coin:, collateralCoin:, **kwargs) click to toggle source

Borrow For Cross-Collateral (TRADE)

POST /sapi/v1/futures/loan/borrow

@param coin [String] @param collateralCoin [String] @param kwargs [Hash] @option kwargs [Float] :amount Mandatory when collateralAmount is empty. @option kwargs [Float] :collateralAmount Mandatory when amount is empty. @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#borrow-for-cross-collateral-trade

# File lib/binance/spot/futures.rb, line 68
def cross_collateral_borrow(coin:, collateralCoin:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)

  @session.sign_request(:post, '/sapi/v1/futures/loan/borrow', params: kwargs.merge(
    coin: coin,
    collateralCoin: collateralCoin
  ))
end
cross_collateral_borrow_history(**kwargs) click to toggle source

Cross-Collateral Borrow History (USER_DATA)

GET /sapi/v1/futures/loan/borrow/history

@param kwargs [Hash] @option kwargs [String] :coin @option kwargs [Integer] :startTime @option kwargs [Integer] :endTime @option kwargs [Integer] :limit default 500, max 1000 @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data

# File lib/binance/spot/futures.rb, line 89
def cross_collateral_borrow_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/futures/loan/borrow/history', params: kwargs)
end
cross_collateral_info(**kwargs) click to toggle source

Cross-Collateral Information (USER_DATA)

GET /sapi/v2/futures/loan/configs

@param kwargs [Hash] @option kwargs [String] :loanCoin @option kwargs [String] :collateralCoin @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#cross-collateral-information-v2-user_data

# File lib/binance/spot/futures.rb, line 150
def cross_collateral_info(**kwargs)
  @session.sign_request(:get, '/sapi/v2/futures/loan/configs', params: kwargs)
end
cross_collateral_interest_history(**kwargs) click to toggle source

Cross-Collateral Interest History (USER_DATA)

GET /sapi/v1/futures/loan/interestHistory

@param kwargs [Hash] @option kwargs [String] :collateralCoin @option kwargs [Integer] :startTime @option kwargs [Integer] :endTime @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 @option kwargs [Integer] :limit default 500, max 1000 @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data

# File lib/binance/spot/futures.rb, line 352
def cross_collateral_interest_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/futures/loan/interestHistory', params: kwargs)
end
cross_collateral_liquidation_history(**kwargs) click to toggle source

Cross-Collateral Liquidation History (USER_DATA)

GET /sapi/v1/futures/loan/liquidationHistory

All data will be returned if loanCoin or collateralCoin is not sent

@param kwargs [Hash] @option kwargs [String] :loanCoin @option kwargs [String] :collateralCoin @option kwargs [Integer] :startTime @option kwargs [Integer] :endTime @option kwargs [Integer] :limit default 500, max 1000 @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data

# File lib/binance/spot/futures.rb, line 255
def cross_collateral_liquidation_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/futures/loan/liquidationHistory', params: kwargs)
end
cross_collateral_repay(coin:, collateralCoin:, amount:, **kwargs) click to toggle source

Repay For Cross-Collateral (TRADE)

POST /sapi/v1/futures/loan/repay

@param coin [String] @param collateralCoin [String] @param amount [Float] @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#repay-for-cross-collateral-trade

# File lib/binance/spot/futures.rb, line 103
def cross_collateral_repay(coin:, collateralCoin:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:post, '/sapi/v1/futures/loan/repay', params: kwargs.merge(
    coin: coin,
    collateralCoin: collateralCoin,
    amount: amount
  ))
end
cross_collateral_repay_history(**kwargs) click to toggle source

Cross-Collateral Repayment History (USER_DATA)

GET /sapi/v1/futures/loan/repay/history

@param kwargs [Hash] @option kwargs [String] :coin @option kwargs [Integer] :startTime @option kwargs [Integer] :endTime @option kwargs [Integer] :limit default 500, max 1000 @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data

# File lib/binance/spot/futures.rb, line 126
def cross_collateral_repay_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/futures/loan/repay/history', params: kwargs)
end
cross_collateral_wallet(**kwargs) click to toggle source

Cross-Collateral Wallet (USER_DATA)

GET /sapi/v2/futures/loan/wallet

@param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#cross-collateral-wallet-v2-user_data

# File lib/binance/spot/futures.rb, line 137
def cross_collateral_wallet(**kwargs)
  @session.sign_request(:get, '/sapi/v2/futures/loan/wallet', params: kwargs)
end
futures_account_transfer(asset:, amount:, type:, **kwargs) click to toggle source

New Future Account Transfer (USER_DATA)

POST /sapi/v1/futures/transfer

Execute transfer between spot account and futures account.

@param asset [String] @param amount [Float] @param type [Integer] 1: transfer from spot account to USDT-M futures account.

2: transfer from USDT-M futures account to spot account. <br>
3: transfer from spot account to COIN-M futures account. <br>
4: transfer from COIN-M futures account to spot account. <br>

@param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data

# File lib/binance/spot/futures.rb, line 23
def futures_account_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/futures/transfer', params: kwargs.merge(
    asset: asset,
    amount: amount,
    type: type
  ))
end
futures_account_transfer_history(asset:, startTime:, **kwargs) click to toggle source

Get Future Account Transaction History List (USER_DATA)

GET /sapi/v1/futures/transfer

@param asset [String] @param startTime [Integer] @param kwargs [Hash] @option kwargs [Integer] :endTime @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 @option kwargs [Integer] :size Default:10 Max:100 @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#get-future-account-transaction-history-list-user_data

# File lib/binance/spot/futures.rb, line 47
def futures_account_transfer_history(asset:, startTime:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)
  Binance::Utils::Validation.require_param('startTime', startTime)

  @session.sign_request(:get, '/sapi/v1/futures/transfer', params: kwargs.merge(
    asset: asset,
    startTime: startTime
  ))
end
repay_with_collateral(quoteId:, **kwargs) click to toggle source

Repay with Collateral (USER_DATA)

POST /sapi/v1/futures/loan/collateralRepay

Repay with collateral. Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds.

@param quoteId [String] @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#repay-with-collateral-user_data

# File lib/binance/spot/futures.rb, line 314
def repay_with_collateral(quoteId:, **kwargs)
  Binance::Utils::Validation.require_param('quoteId', quoteId)

  @session.sign_request(:post, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge(
    quoteId: quoteId
  ))
end
repayment_result(quoteId:, **kwargs) click to toggle source

Collateral Repayment Result (USER_DATA)

GET /sapi/v1/futures/loan/collateralRepayResult

Check collateral repayment result.

@param quoteId [String] @param kwargs [Hash] @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 @see binance-docs.github.io/apidocs/spot/en/#collateral-repayment-result-user_data

# File lib/binance/spot/futures.rb, line 332
def repayment_result(quoteId:, **kwargs)
  Binance::Utils::Validation.require_param('quoteId', quoteId)

  @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayResult', params: kwargs.merge(
    quoteId: quoteId
  ))
end