diff --git a/README.md b/README.md index b876ce1..c45096c 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ You can find more info on all `kline_candlestick` attributes & available interva - [`fees!`](https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#asset-detail-user_data): Get withdrawal information (status, minimum amount and fees) for all symbols. - [`info!`](https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-information-user_data): Get current account information. - [`trades!`](https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-trade-list-user_data): Get trades for a specific account and symbol. +- [`withdraw!`](https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi): Submit a withdraw request. _I haven't confirmed this works for binance.us yet. If you find that it does, please submit a PR!_ ### Binance::Api::DataStream class methods diff --git a/binance-ruby.gemspec b/binance-ruby.gemspec index 3b6dc51..3c8de8d 100644 --- a/binance-ruby.gemspec +++ b/binance-ruby.gemspec @@ -42,5 +42,5 @@ Gem::Specification.new do |spec| spec.add_dependency 'faye-websocket', '~> 0.11' spec.add_dependency 'eventmachine', '~> 1.2' - spec.add_runtime_dependency 'activesupport', '~> 5.1', '>= 5.1.0' + spec.add_runtime_dependency 'activesupport', '>= 5.1.0' end diff --git a/lib/binance/api/account.rb b/lib/binance/api/account.rb index 6ded399..bf6520b 100644 --- a/lib/binance/api/account.rb +++ b/lib/binance/api/account.rb @@ -27,6 +27,23 @@ def trades!(fromId: nil, limit: 500, recvWindow: 5000, symbol: nil, api_key: nil params: params.delete_if { |key, value| value.nil? }, security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key) end + + # @note have not tested this for binance.us yet. + 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? + timestamp = Configuration.timestamp + params = { + coin: coin, withdrawOrderId: withdrawOrderId, network: network, address: address, timestamp: timestamp, + addressTag: addressTag, amount: amount, transactionFeeFlag: transactionFeeFlag, + name: name, recvWindow: recvWindow, + } + Request.send!(api_key_type: :read_info, 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 end end end diff --git a/lib/binance/api/version.rb b/lib/binance/api/version.rb index 0304075..a0e858b 100644 --- a/lib/binance/api/version.rb +++ b/lib/binance/api/version.rb @@ -1,5 +1,5 @@ module Binance module Api - VERSION = "1.2.2" + VERSION = "1.2.3" end end