Class: Binance::Api::Account
- Inherits:
-
Object
- Object
- Binance::Api::Account
- Defined in:
- lib/binance/api/account.rb
Class Method Summary collapse
- .fees!(recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
- .info!(recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
- .trades!(fromId: nil, limit: 500, recvWindow: 5000, symbol: nil, api_key: nil, api_secret_key: nil) ⇒ Object
- .withdraw!(coin: nil, withdrawOrderId: nil, network: nil, address: nil, addressTag: nil, amount: nil, transactionFeeFlag: false, name: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
-
.withdraw_history!(coin: nil, status: nil, offset: nil, limit: nil, startTime: nil, endTime: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days.
Class Method Details
.fees!(recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/binance/api/account.rb', line 5 def fees!(recvWindow: nil, api_key: nil, api_secret_key: nil) = Configuration. params = { recvWindow: recvWindow, timestamp: } Request.send!(api_key_type: :read_info, path: "/wapi/v3/assetDetail.html", params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key) end |
.info!(recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/binance/api/account.rb', line 13 def info!(recvWindow: nil, api_key: nil, api_secret_key: nil) = Configuration. params = { recvWindow: recvWindow, timestamp: } Request.send!(api_key_type: :read_info, path: "/api/v3/account", params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key) end |
.trades!(fromId: nil, limit: 500, recvWindow: 5000, symbol: nil, api_key: nil, api_secret_key: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/binance/api/account.rb', line 21 def trades!(fromId: nil, limit: 500, recvWindow: 5000, symbol: nil, api_key: nil, api_secret_key: nil) raise Error.new(message: "max limit is 500") unless limit <= 500 raise Error.new(message: "symbol is required") if symbol.nil? = Configuration. params = { fromId: fromId, limit: limit, recvWindow: recvWindow, symbol: symbol, timestamp: } Request.send!(api_key_type: :read_info, path: "/api/v3/myTrades", params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key) end |
.withdraw!(coin: nil, withdrawOrderId: nil, network: nil, address: nil, addressTag: nil, amount: nil, transactionFeeFlag: false, name: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
Note:
have not tested this for binance.us yet.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/binance/api/account.rb', line 32 def withdraw!(coin: nil, withdrawOrderId: nil, network: nil, address: nil, addressTag: nil, amount: nil, transactionFeeFlag: false, name: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) raise Error.new(message: "amount is required") if amount.nil? raise Error.new(message: "coin is required") if coin.nil? raise Error.new(message: "address is required") if address.nil? = Configuration. params = { coin: coin, withdrawOrderId: withdrawOrderId, network: network, address: address, timestamp: , addressTag: addressTag, amount: amount, transactionFeeFlag: transactionFeeFlag, name: name, recvWindow: recvWindow, } Request.send!(api_key_type: :withdrawals, path: "/sapi/v1/capital/withdraw/apply", params: params.delete_if { |key, value| value.nil? }, method: :post, security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key) end |
.withdraw_history!(coin: nil, status: nil, offset: nil, limit: nil, startTime: nil, endTime: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object
If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/binance/api/account.rb', line 49 def withdraw_history!(coin: nil, status: nil, offset: nil, limit: nil, startTime: nil, endTime: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) = Configuration. params = { coin: coin, status: status, offset: offset, limit: limit, startTime: startTime, endTime: endTime, recvWindow: recvWindow, timestamp: , } Request.send!(api_key_type: :withdrawals, path: "/sapi/v1/capital/withdraw/history", params: params.delete_if { |key, value| value.nil? }, method: :get, security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key) end |