Class: Binance::SDK::Asset

Inherits:
Object
  • Object
show all
Defined in:
lib/binance/sdk/asset.rb

Class Method Summary collapse

Class Method Details

.change_margin_type(symbol:, type: 'ISOLATED') ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/binance/sdk/asset.rb', line 5

def change_margin_type(symbol:, type: 'ISOLATED')
   params = {
      recvWindow: 60000,
      timestamp: Configuration.timestamp.to_i - 1000,
      symbol: symbol,
      marginType: type
   }

   Request.send!(
    method: :post,
    api_key_type: :read_info, path: Endpoints.fetch(:margin_type),
    params: params.delete_if { |_, value| value.nil? },
    security_type: :user_data, api_key: Configuration.api_key, api_secret_key: Configuration.secret_key
  )
rescue Binance::SDK::Error::NoNeedToChangeMarginType
end