Module: Binance::Client::REST::Withdraw_API

Defined in:
lib/binance/client/rest/withdraw_api.rb

Overview

Public: A Module containing all of the Withdraw API endpoints

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

Internal: Create Lambda that returns a new Faraday client instance and add it to the REST class instance variable @api. This is called while a new instance of the REST class is created.

base - The base class that is being extended into.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/binance/client/rest/withdraw_api.rb', line 17

def self.extended(base)
  REST.api[:withdraw] = lambda do
    Faraday.new(url: "#{BASE_URL}/wapi") do |conn|
      conn.request :url_encoded
      conn.response :json, content_type: /\bjson$/
      conn.headers['X-MBX-APIKEY'] = base.api_key
      conn.use TimestampRequestMiddleware
      conn.use SignRequestMiddleware, base.secret_key
      conn.adapter base.adapter
    end
  end
end

Instance Method Details

#account_status(options) ⇒ Object

Public: Retrieve current account status

options - The Hash which hosts various REST query params.

:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



100
101
102
# File 'lib/binance/client/rest/withdraw_api.rb', line 100

def (options)
  request :withdraw, :get, 'accountStatus', options
end

#deposit_address(options) ⇒ Object

Public: Retrieve the deposit address for a specific asset

options - The Hash which hosts various REST query params.

:asset      - The String of which asset to retrieve (optional).
:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



89
90
91
# File 'lib/binance/client/rest/withdraw_api.rb', line 89

def deposit_address(options)
  request :withdraw, :get, 'depositAddress', options
end

#deposit_history(options = {}) ⇒ Object

Public: Retrieve the deposit history for the authenticated account

options - The Hash which hosts various REST query params.

:asset      - The String of which asset to retrieve (optional).
:status     - The Number of which status to retrieve (optional).
:startTime  - The Timestamp of when to start the history in
              milliseconds (optional).
:endTime    - The Timestamp of when to end the history in
              milliseconds (optional).
:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



60
61
62
# File 'lib/binance/client/rest/withdraw_api.rb', line 60

def deposit_history(options = {})
  request :withdraw, :get, 'depositHistory', options
end

#withdraw(options) ⇒ Object

Public: Withdraw the specified asset to the given address using the authenticated account

options - The Hash which hosts various REST query params.

:asset      - The String of which asset to withdraw.
:address    - The String of where to send the asset to.
:addressTag - The String secondary address identifier (optional).
:amount     - The String decimal value of how much to withdraw.
:name       - The String description of the address
:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



43
44
45
# File 'lib/binance/client/rest/withdraw_api.rb', line 43

def withdraw(options)
  request :withdraw, :post, 'withdraw', options
end

#withdraw_history(options = {}) ⇒ Object

Public: Retrieve the withdraw history for the authenticated account

options - The Hash which hosts various REST query params.

:asset      - The String of which asset to retrieve (optional).
:status     - The Number of which status to retrieve (optional).
:startTime  - The Timestamp of when to start the history in
              milliseconds (optional).
:endTime    - The Timestamp of when to end the history in
              milliseconds (optional).
:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



77
78
79
# File 'lib/binance/client/rest/withdraw_api.rb', line 77

def withdraw_history(options = {})
  request :withdraw, :get, 'withdrawHistory', options
end