Class: BinanceAPI::WAPI
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #account_status(options = {}) ⇒ Object
- #deposit_address(asset, options = {}) ⇒ Object
- #deposit_history(asset, options = {}) ⇒ Object
- #system_status ⇒ Object
- #withdraw(asset, address, amount, options = {}) ⇒ Object
- #withdraw_fee(asset, options = {}) ⇒ Object
- #withdraw_history(asset, options = {}) ⇒ Object
Instance Method Details
#account_status(options = {}) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/binance_api/wapi.rb', line 113 def account_status( = {}) recv_window = .delete(:recv_window) || BinanceAPI.recv_window = .delete(:timestamp) || Time.now params = { recvWindow: recv_window, timestamp: .to_i * 1000 # to milliseconds } response = safe do RestClient.get "#{BASE_URL}/wapi/v3/accountStatus.html", params: params_with_signature(params, api_secret), 'X-MBX-APIKEY' => api_key end build_result response end |
#deposit_address(asset, options = {}) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/binance_api/wapi.rb', line 74 def deposit_address(asset, = {}) recv_window = .delete(:recv_window) || BinanceAPI.recv_window = .delete(:timestamp) || Time.now params = { asset: asset, status: .fetch(:status, nil), recvWindow: recv_window, timestamp: .to_i * 1000 # to milliseconds } response = safe do RestClient.get "#{BASE_URL}/wapi/v3/depositAddress.html", params: params_with_signature(params, api_secret), 'X-MBX-APIKEY' => api_key end build_result response end |
#deposit_history(asset, options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/binance_api/wapi.rb', line 30 def deposit_history(asset, = {}) recv_window = .delete(:recv_window) || BinanceAPI.recv_window = .delete(:timestamp) || Time.now params = { asset: asset, status: .fetch(:status, nil), startTime: .fetch(:start_time, nil), endTime: .fetch(:end_time, nil), recvWindow: recv_window, timestamp: .to_i * 1000 # to milliseconds } response = safe do RestClient.get "#{BASE_URL}/wapi/v3/depositHistory.html", params: params_with_signature(params, api_secret), 'X-MBX-APIKEY' => api_key end build_result response end |
#system_status ⇒ Object
131 132 133 134 135 136 |
# File 'lib/binance_api/wapi.rb', line 131 def system_status response = safe { RestClient.get("#{BASE_URL}/wapi/v3/systemStatus.html") } json = JSON.parse(response.body, symbolize_names: true) BinanceAPI::Result.new(json, response.code == 200) end |
#withdraw(asset, address, amount, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/binance_api/wapi.rb', line 7 def withdraw(asset, address, amount, = {}) recv_window = .delete(:recv_window) || BinanceAPI.recv_window = .delete(:timestamp) || Time.now params = { asset: asset, address: address, addressTag: .fetch(:address_tag, nil), amount: amount, name: .fetch(:name, nil), recvWindow: recv_window, timestamp: .to_i * 1000 # to milliseconds } response = safe do RestClient.get "#{BASE_URL}/wapi/v3/withdraw.html", params: params_with_signature(params, api_secret), 'X-MBX-APIKEY' => api_key end build_result response end |
#withdraw_fee(asset, options = {}) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/binance_api/wapi.rb', line 94 def withdraw_fee(asset, = {}) recv_window = .delete(:recv_window) || BinanceAPI.recv_window = .delete(:timestamp) || Time.now params = { asset: asset, recvWindow: recv_window, timestamp: .to_i * 1000 # to milliseconds } response = safe do RestClient.get "#{BASE_URL}/wapi/v3/withdrawFee.html", params: params_with_signature(params, api_secret), 'X-MBX-APIKEY' => api_key end build_result response end |
#withdraw_history(asset, options = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/binance_api/wapi.rb', line 52 def withdraw_history(asset, = {}) recv_window = .delete(:recv_window) || BinanceAPI.recv_window = .delete(:timestamp) || Time.now params = { asset: asset, status: .fetch(:status, nil), startTime: .fetch(:start_time, nil), endTime: .fetch(:end_time, nil), recvWindow: recv_window, timestamp: .to_i * 1000 # to milliseconds } response = safe do RestClient.get "#{BASE_URL}/wapi/v3/withdrawHistory.html", params: params_with_signature(params, api_secret), 'X-MBX-APIKEY' => api_key end build_result response end |