Module: Binance::Spot::Futures

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

Overview

Futures endpoints

Instance Method Summary collapse

Instance Method Details

#adjust_cross_collateral(loanCoin:, collateralCoin:, amount:, direction:, **kwargs) ⇒ Object

Adjust Cross-Collateral LTV (TRADE)

POST /sapi/v2/futures/loan/adjustCollateral

Parameters:

  • loanCoin (String)
  • collateralCoin (String)
  • amount (Float)
  • direction (String)

    “ADDITIONAL”, “REDUCED”

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



209
210
211
212
213
214
215
216
217
218
219
220
221
# 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) ⇒ Object

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

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :loanCoin (String)
  • :collateralCoin (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :limit (Integer)

    default 500, max 1000

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



237
238
239
# 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) ⇒ Object

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

GET /sapi/v2/futures/loan/calcMaxAdjustAmount

Parameters:

  • loanCoin (String)
  • collateralCoin (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



188
189
190
191
192
193
194
195
196
# 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) ⇒ Object

Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA)

GET /sapi/v2/futures/loan/calcAdjustLevel

Parameters:

  • loanCoin (String)
  • collateralCoin (String)
  • amount (Float)
  • direction (String)

    “ADDITIONAL”, “REDUCED”

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



165
166
167
168
169
170
171
172
173
174
175
176
177
# 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) ⇒ Object

Check Collateral Repay Limit (USER_DATA)

GET /sapi/v1/futures/loan/collateralRepayLimit

Check the maximum and minimum limit when repay with collateral.

Parameters:

  • coin (String)
  • collateralCoin (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



270
271
272
273
274
275
276
277
278
# 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) ⇒ Object

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.

Parameters:

  • coin (String)
  • collateralCoin (String)
  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



292
293
294
295
296
297
298
299
300
301
302
# 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) ⇒ Object

Borrow For Cross-Collateral (TRADE)

POST /sapi/v1/futures/loan/borrow

Parameters:

  • coin (String)
  • collateralCoin (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :amount (Float)

    Mandatory when collateralAmount is empty.

  • :collateralAmount (Float)

    Mandatory when amount is empty.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



68
69
70
71
72
73
74
75
76
# 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) ⇒ Object

Cross-Collateral Borrow History (USER_DATA)

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

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    default 500, max 1000

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



89
90
91
# 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) ⇒ Object

Cross-Collateral Information (USER_DATA)

GET /sapi/v2/futures/loan/configs

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :loanCoin (String)
  • :collateralCoin (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



150
151
152
# 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) ⇒ Object

Cross-Collateral Interest History (USER_DATA)

GET /sapi/v1/futures/loan/interestHistory

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Currently querying page. Start from 1. Default:1

  • :limit (Integer)

    default 500, max 1000

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



352
353
354
# 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) ⇒ Object

Cross-Collateral Liquidation History (USER_DATA)

GET /sapi/v1/futures/loan/liquidationHistory

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

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :loanCoin (String)
  • :collateralCoin (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :limit (Integer)

    default 500, max 1000

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



255
256
257
# 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) ⇒ Object

Repay For Cross-Collateral (TRADE)

POST /sapi/v1/futures/loan/repay

Parameters:

  • coin (String)
  • collateralCoin (String)
  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



103
104
105
106
107
108
109
110
111
112
113
# 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) ⇒ Object

Cross-Collateral Repayment History (USER_DATA)

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

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    default 500, max 1000

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



126
127
128
# 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) ⇒ Object

Cross-Collateral Wallet (USER_DATA)

GET /sapi/v2/futures/loan/wallet

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



137
138
139
# 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) ⇒ Object

New Future Account Transfer (USER_DATA)

POST /sapi/v1/futures/transfer

Execute transfer between spot account and futures account.

Parameters:

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

    1: transfer from spot account to USDT-M futures account.
    2: transfer from USDT-M futures account to spot account.
    3: transfer from spot account to COIN-M futures account.
    4: transfer from COIN-M futures account to spot account.

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/binance/spot/futures.rb', line 23

def (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) ⇒ Object

Get Future Account Transaction History List (USER_DATA)

GET /sapi/v1/futures/transfer

Parameters:

  • asset (String)
  • startTime (Integer)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :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:



47
48
49
50
51
52
53
54
55
# File 'lib/binance/spot/futures.rb', line 47

def (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) ⇒ Object

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.

Parameters:

  • quoteId (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



314
315
316
317
318
319
320
# 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) ⇒ Object

Collateral Repayment Result (USER_DATA)

GET /sapi/v1/futures/loan/collateralRepayResult

Check collateral repayment result.

Parameters:

  • quoteId (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



332
333
334
335
336
337
338
# 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