Module: Binance::Client::REST::Account_API
- Defined in:
- lib/binance/client/rest/account_api.rb
Overview
Public: A module containing all of the Account API endpoints
Class Method Summary collapse
-
.extended(base) ⇒ Object
Internal: Create Lambda that returns a new Faraday client instance and add it to the REST class instance variable @api.
Instance Method Summary collapse
-
#account_info(options = {}) ⇒ Object
Public: Retrieve account information for the authenticated account.
-
#account_trade_list(options) ⇒ Object
Public: Retrieve trade data of the specified symbol for the authenticated account.
-
#all_orders(options) ⇒ Object
Public: Retrieve all orders of the specified symbol for the authenticated account.
-
#cancel_order(options) ⇒ Object
Public: Cancel the order specified for the authenticated account.
-
#create_order(options) ⇒ Object
Public: Create a new order on the specified symbol for the authenticated account.
-
#create_test_order(options) ⇒ Object
Public: Create a test order on the specified symbol for the authenticated account.
-
#open_orders(options) ⇒ Object
Public: Retrieve open orders for the authenticated account.
-
#query_order(options) ⇒ Object
Public: Query an orders status on the specified symbol for the authenticated account.
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/account_api.rb', line 17 def self.extended(base) REST.api[:account] = lambda do Faraday.new(url: "#{BASE_URL}/api") do |conn| conn.request :json 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_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
167 168 169 |
# File 'lib/binance/client/rest/account_api.rb', line 167 def account_info( = {}) request :account, :get, 'account', 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
182 183 184 |
# File 'lib/binance/client/rest/account_api.rb', line 182 def account_trade_list() request :account, :get, 'myTrades', 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
156 157 158 |
# File 'lib/binance/client/rest/account_api.rb', line 156 def all_orders() request :account, :get, 'allOrders', 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
127 128 129 |
# File 'lib/binance/client/rest/account_api.rb', line 127 def cancel_order() request :account, :delete, 'order', 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
57 58 59 |
# File 'lib/binance/client/rest/account_api.rb', line 57 def create_order() request :account, :post, 'order', 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
88 89 90 |
# File 'lib/binance/client/rest/account_api.rb', line 88 def create_test_order() request :account, :post, 'order/test', 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
140 141 142 |
# File 'lib/binance/client/rest/account_api.rb', line 140 def open_orders() request :account, :get, 'openOrders', 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
107 108 109 |
# File 'lib/binance/client/rest/account_api.rb', line 107 def query_order() request :account, :get, 'order', end |