Module: Binance::Spot::Loan

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

Overview

all loan endpoints

Instance Method Summary collapse

Instance Method Details

#adjust_flexible_loan_ltv(loanCoin:, collateralCoin:, adjustmentAmount:, direction:, **kwargs) ⇒ Object

Flexible Loan Adjust LTV (TRADE)

POST /sapi/v2/loan/flexible/adjust/ltv

Parameters:

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

    ADDITIONAL or REDUCED

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/binance/spot/loan.rb', line 88

def adjust_flexible_loan_ltv(loanCoin:, collateralCoin:, adjustmentAmount:, direction:, **kwargs)
  Binance::Utils::Validation.require_param('loanCoin', loanCoin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
  Binance::Utils::Validation.require_param('adjustmentAmount', adjustmentAmount)
  Binance::Utils::Validation.require_param('direction', direction)

  @session.sign_request(:post, '/sapi/v2/loan/flexible/adjust/ltv', params: kwargs.merge(
    loanCoin: loanCoin,
    collateralCoin: collateralCoin,
    adjustmentAmount: adjustmentAmount,
    direction: direction
  ))
end

#borrow_flexible_loan(loanCoin:, collateralCoin:, **kwargs) ⇒ Object

Flexible Loan Borrow (TRADE)

POST /sapi/v2/loan/flexible/borrow

Parameters:

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

Options Hash (**kwargs):

  • :loanAmount (Float)

    Mandatory when collateralAmount is empty

  • :collateralAmount (Float)

    Mandatory when loanAmount is empty

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



43
44
45
46
47
48
49
50
51
# File 'lib/binance/spot/loan.rb', line 43

def borrow_flexible_loan(loanCoin:, collateralCoin:, **kwargs)
  Binance::Utils::Validation.require_param('loanCoin', loanCoin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)

  @session.sign_request(:post, '/sapi/v2/loan/flexible/borrow', params: kwargs.merge(
    loanCoin: loanCoin,
    collateralCoin: collateralCoin
  ))
end

#get_flexible_loan_assets_data(**kwargs) ⇒ Object

Get Flexible Loan Assets Data (USER_DATA)

GET /sapi/v2/loan/flexible/loanable/data

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    The value cannot be greater than 60000

See Also:



28
29
30
# File 'lib/binance/spot/loan.rb', line 28

def get_flexible_loan_assets_data(**kwargs)
  @session.sign_request(:get, '/sapi/v2/loan/flexible/loanable/data', params: kwargs)
end

#get_flexible_loan_borrow_history(**kwargs) ⇒ Object

Get Flexible Loan Borrow History(USER_DATA)

GET /sapi/v2/loan/flexible/borrow/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



132
133
134
# File 'lib/binance/spot/loan.rb', line 132

def get_flexible_loan_borrow_history(**kwargs)
  @session.sign_request(:get, '/sapi/v2/loan/flexible/borrow/history', params: kwargs)
end

#get_flexible_loan_collateral_data(**kwargs) ⇒ Object

Get Flexible Loan Collateral Assets Data (USER_DATA)

GET /sapi/v2/loan/flexible/collateral/data

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    The value cannot be greater than 60000

See Also:



16
17
18
# File 'lib/binance/spot/loan.rb', line 16

def get_flexible_loan_collateral_data(**kwargs)
  @session.sign_request(:get, '/sapi/v2/loan/flexible/collateral/data', params: kwargs)
end

#get_flexible_loan_ltv_adjustment_history(**kwargs) ⇒ Object

Get Flexible Loan LTV Adjustment History (USER_DATA)

GET /sapi/v2/loan/flexible/ltv/adjustment/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



115
116
117
# File 'lib/binance/spot/loan.rb', line 115

def get_flexible_loan_ltv_adjustment_history(**kwargs)
  @session.sign_request(:get, '/sapi/v2/loan/flexible/ltv/adjustment/history', params: kwargs)
end

#get_flexible_loan_ongoing_orders(**kwargs) ⇒ Object

Get Flexible Loan Ongoing Orders (USER_DATA)

GET /sapi/v2/loan/flexible/ongoing/orders

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



147
148
149
# File 'lib/binance/spot/loan.rb', line 147

def get_flexible_loan_ongoing_orders(**kwargs)
  @session.sign_request(:get, '/sapi/v2/loan/flexible/ongoing/orders', params: kwargs)
end

#get_flexible_loan_repayment_history(**kwargs) ⇒ Object

Get Flexible Loan Repayment History (USER_DATA)

GET /sapi/v2/loan/flexible/repay/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



164
165
166
# File 'lib/binance/spot/loan.rb', line 164

def get_flexible_loan_repayment_history(**kwargs)
  @session.sign_request(:get, '/sapi/v2/loan/flexible/repay/history', params: kwargs)
end

#get_loan_borrow_history(**kwargs) ⇒ Object

Get Loan Borrow History (USER_DATA)

GET /sapi/v1/loan/borrow/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderId (Integer)

    orderId in POST /sapi/v1/loan/borrow

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



199
200
201
# File 'lib/binance/spot/loan.rb', line 199

def get_loan_borrow_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/loan/borrow/history', params: kwargs)
end

#get_loan_history(**kwargs) ⇒ Object

Get Crypto Loans Income History (USER_DATA)

GET /sapi/v1/loan/income

Parameters:

  • kwargs (Hash)
  • kwargs (String)

    :asset

Options Hash (**kwargs):

  • :type (String)

    All types will be returned by default. Enum:borrowIn ,collateralSpent, repayAmount, collateralReturn(Collateral return after repayment), addCollateral removeCollateral, collateralReturnAfterLiquidation

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

    default 20, max 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



181
182
183
# File 'lib/binance/spot/loan.rb', line 181

def get_loan_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/loan/income', params: kwargs)
end

#get_loan_ltv_adjustment_history(**kwargs) ⇒ Object

Get Loan LTV Adjustment History (USER_DATA)

GET /sapi/v1/loan/ltv/adjustment/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



217
218
219
# File 'lib/binance/spot/loan.rb', line 217

def get_loan_ltv_adjustment_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/loan/ltv/adjustment/history', params: kwargs)
end

#get_loan_repayment_history(**kwargs) ⇒ Object

Get Loan Repayment History (USER_DATA)

GET /sapi/v1/loan/repay/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Current querying page. Start from 1; default: 1; max: 1000

  • :limit (Integer)

    Default: 10; max: 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



235
236
237
# File 'lib/binance/spot/loan.rb', line 235

def get_loan_repayment_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/loan/repay/history', params: kwargs)
end

#repay_flexible_loan(loanCoin:, collateralCoin:, repayAmount:, **kwargs) ⇒ Object

Flexible Loan Repay (TRADE)

POST /sapi/v2/loan/flexible/repay

Parameters:

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

Options Hash (**kwargs):

  • :collateralReturn (Boolean)

    Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order, and lower LTV.

  • :fullRepayment (Boolean)

    Default: FALSE. TRUE: Full repayment; FALSE: Partial repayment, based on loanAmount

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/binance/spot/loan.rb', line 65

def repay_flexible_loan(loanCoin:, collateralCoin:, repayAmount:, **kwargs)
  Binance::Utils::Validation.require_param('loanCoin', loanCoin)
  Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
  Binance::Utils::Validation.require_param('repayAmount', repayAmount)

  @session.sign_request(:post, '/sapi/v2/loan/flexible/repay', params: kwargs.merge(
    loanCoin: loanCoin,
    collateralCoin: collateralCoin,
    repayAmount: repayAmount
  ))
end