Module: Binance::Api::Margin

Defined in:
lib/binance/api/margin.rb,
lib/binance/api/margin/order.rb,
lib/binance/api/margin/account.rb

Defined Under Namespace

Classes: Account, Order

Class Method Summary collapse

Class Method Details

.borrow!(asset: nil, amount: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object

Your Margin Wallet balance determines the amount of funds you can borrow, following a fixed rate of 5:1 (5x).



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/binance/api/margin.rb', line 7

def borrow!(asset: nil, amount: nil, recvWindow: nil, api_key: nil, api_secret_key: nil)
  timestamp = Configuration.timestamp
  params = {
    asset: asset, amount: amount, recvWindow: recvWindow, timestamp: timestamp,
  }.delete_if { |_, value| value.nil? }
  ensure_required_keys!(params: params)
  path = "/sapi/v1/margin/loan"
  Request.send!(api_key_type: :trading, method: :post, path: path,
                params: params, security_type: :margin, tld: Configuration.tld,
                api_key: api_key, api_secret_key: api_secret_key)
end

.repay!(asset: nil, isIsolated: nil, amount: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/binance/api/margin.rb', line 19

def repay!(asset: nil, isIsolated: nil, amount: nil, recvWindow: nil, api_key: nil, api_secret_key: nil)
  timestamp = Configuration.timestamp
  params = {
    asset: asset, amount: amount, recvWindow: recvWindow, timestamp: timestamp,
  }.delete_if { |_, value| value.nil? }
  ensure_required_keys!(params: params)
  path = "/sapi/v1/margin/repay"
  Request.send!(api_key_type: :trading, method: :post, path: path,
                params: params, security_type: :margin, tld: Configuration.tld,
                api_key: api_key, api_secret_key: api_secret_key)
end