Class: Binance::SDK::Account
- Inherits:
-
Object
- Object
- Binance::SDK::Account
- Defined in:
- lib/binance/sdk/account.rb
Class Method Summary collapse
- .balance!(recvWindow: 5000, currency: 'USDT') ⇒ Object
- .info!(recvWindow: 5000) ⇒ Object
- .positions ⇒ Object
Class Method Details
.balance!(recvWindow: 5000, currency: 'USDT') ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/binance/sdk/account.rb', line 19 def balance!(recvWindow: 5000, currency: 'USDT') = Configuration. params = { recvWindow: recvWindow, timestamp: } balance = Request.send!( api_key_type: :read_info, path: Endpoints.fetch(:account_balance), params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: Configuration.api_key, api_secret_key: Configuration.secret_key ) if futures? balance.find { |i| i[:asset] == currency }[:balance].to_f else balance[:balances].find { |i| i[:asset] == currency }[:free] end end |
.info!(recvWindow: 5000) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/binance/sdk/account.rb', line 5 def info!(recvWindow: 5000) = Configuration. params = { recvWindow: recvWindow, timestamp: } response = Request.send!( api_key_type: :read_info, path: "/sapi/v1/account/status", params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: Configuration.api_key, api_secret_key: Configuration.secret_key ) puts response end |
.positions ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/binance/sdk/account.rb', line 37 def positions params = { recvWindow: 60000, timestamp: Configuration. } Request.send!( api_key_type: :read_info, path: Endpoints.fetch(:account_position_risk), params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: Configuration.api_key, api_secret_key: Configuration.secret_key ) end |