Module: Binance::Client::REST::AccountAPI

Included in:
Binance::Client::REST
Defined in:
lib/binance/client/rest/account_api.rb

Overview

Public: A module containing all of the Account API endpoints

Instance Method Summary collapse

Instance Method Details

#account_info(options = {}) ⇒ Object

Public: Retrieve account information for the authenticated account

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



144
145
146
# File 'lib/binance/client/rest/account_api.rb', line 144

def (options = {})
  request :signed, :get, :account, options
end

#account_trade_list(options) ⇒ Object

Public: Retrieve trade data of the specified symbol for the authenticated account

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve.
:limit  - The Number of how many trades to request (optional).
:fromId - The String of which trade ID to fetch from (optional).
:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



159
160
161
# File 'lib/binance/client/rest/account_api.rb', line 159

def (options)
  request :signed, :get, :myTrades, options
end

#all_orders(options) ⇒ Object

Public: Retrieve all orders of the specified symbol for the authenticated account

options - The Hash which hosts various REST query params.

:symbol     - The String of which trading pair to retrieve.
:orderId    - The String determining which order to start the data
              from (optional).
:limit      - The Number of how many trades to request (optional).
:recvWindow - The Number of how long a request is valid for in
              milliseconds (optional).

Returns a Hash with the request response



133
134
135
# File 'lib/binance/client/rest/account_api.rb', line 133

def all_orders(options)
  request :signed, :get, :allOrders, options
end

#cancel_order(options) ⇒ Object

Public: Cancel the order specified for the authenticated account. One must send either an :orderId or :origOrderId, but not both.

options - The Hash which hosts various REST query params.

:symbol            - The String of which trading pair to delete from
                     (optional).
:orderId           - The String determining which order to cancel
                     (optional).
:origClientOrderId - The String determining which order to cancel
                     (optional).
:newClientOrderId  - The String used in uniquely identifying the
                     cancel order (optional).
:recvWindow        - The Number of how long a request is valid for
                     in milliseconds (optional).

Returns a Hash with the request response



104
105
106
# File 'lib/binance/client/rest/account_api.rb', line 104

def cancel_order(options)
  request :signed, :delete, :order, options
end

#close_stream(options) ⇒ Object

Public: Close the User Data stream associated with the listen key

options - The Hash which hosts various REST query params.

:listen_key - The String of which stream to close

Returns a Hash with the request response



186
187
188
# File 'lib/binance/client/rest/account_api.rb', line 186

def close_stream(options)
  request :verified, :delete, :userDataStream, options
end

#create_order(options) ⇒ Object

Public: Create a new order on the specified symbol for the authenticated account

options - The Hash which hosts various REST query params.

:symbol           - The String of which trading pair to create the
                    order on.
:side             - The String determining which side to create the
                    order on.
:type             - The String determining what type of order it is.
:timeInForce      - The String determining what the time in force is
                    (optional).
:quantity         - The String determining the amount of assets to
                    purchase.
:price            - The String determining what price to purchase at
                    (optional).
:newClientOrderId - The String which uniquely identifies this order
                    (optional).
:stopPrice        - The String determining which price to stop at
                    (optional).
:icebergQty       - The String determining the amount of assets to
                    show on the order book (optional).
:newOrderRespType - The String which sets the type of response to
                    receive (optional).
:recvWindow       - The Number of how long a request is valid for
                    in milliseconds (optional).

Returns a Hash of the request response



34
35
36
# File 'lib/binance/client/rest/account_api.rb', line 34

def create_order(options)
  request :signed, :post, :order, options
end

#create_test_order(options) ⇒ Object

Public: Create a test order on the specified symbol for the authenticated account

options - The Hash which hosts various REST query params.

:symbol           - The String of which trading pair to create the
                    order on.
:side             - The String determining which side to create the
                    order on.
:type             - The String determining what type of order it is.
:timeInForce      - The String determining what the time in force is
                    (optional).
:quantity         - The String determining the amount of assets to
                    purchase.
:price            - The String determining what price to purchase at
                    (optional).
:newClientOrderId - The String which uniquely identifies this order
                    (optional).
:stopPrice        - The String determining which price to stop at
                    (optional).
:icebergQty       - The String determining the amount of assets to
                    show on the order book (optional).
:newOrderRespType - The String which sets the type of response to
                    receive (optional).
:recvWindow       - The Number of how long a request is valid for
                    in milliseconds (optional).

Returns a Hash of the request response



65
66
67
# File 'lib/binance/client/rest/account_api.rb', line 65

def create_test_order(options)
  request :signed, :post, :order_test, options
end

#keep_stream_alive(options) ⇒ Object

Public: Ping the server to keep User Data stream alive

options - The Hash which hosts various REST query params.

:listen_key - The String of which stream to keep alive

Returns a Hash with the request response



176
177
178
# File 'lib/binance/client/rest/account_api.rb', line 176

def keep_stream_alive(options)
  request :verified, :put, :userDataStream, options
end

#listen_keyObject

Public: Retrieve the listen key for the given api key

Returns a Hash with the request response



166
167
168
# File 'lib/binance/client/rest/account_api.rb', line 166

def listen_key
  request :verified, :post, :userDataStream
end

#open_orders(options) ⇒ Object

Public: Retrieve open orders for the authenticated account

options - The Hash which hosts various REST query params.

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

Returns a Hash with the request response



117
118
119
# File 'lib/binance/client/rest/account_api.rb', line 117

def open_orders(options)
  request :signed, :get, :openOrders, options
end

#query_order(options) ⇒ Object

Public: Query an orders status on the specified symbol for the authenticated account. One must send either an :orderId or :origOrderId, but not both.

options - The Hash which hosts various REST query params.

:symbol            - The String of which trading pair to query from
                     (optional).
:orderId           - The String determining which order to query
                     (optional).
:origClientOrderId - The String determining which order to cancel
                     (optional).
:recvWindow        - The Number of how long a request is valid for
                     in milliseconds (optional).

Returns a Hash of the request response



84
85
86
# File 'lib/binance/client/rest/account_api.rb', line 84

def query_order(options)
  request :signed, :get, :order, options
end