Module: Binance::Spot::Trade
- Included in:
- Binance::Spot
- Defined in:
- lib/binance/spot/trade.rb
Overview
This module includes all spot trading methods, including:
-
place orders (spot and oco)
-
query orders (spot and oco)
-
cancel orders (spot and oco)
-
account information
-
my trades
Instance Method Summary collapse
-
#account(**kwargs) ⇒ Object
Account Information (USER_DATA).
-
#all_order_list(**kwargs) ⇒ Object
Query all OCO (USER_DATA).
-
#all_orders(symbol:, **kwargs) ⇒ Object
All Orders (USER_DATA).
-
#cancel_open_orders(symbol:, **kwargs) ⇒ Object
Cancel all Open Orders on a Symbol (TRADE).
-
#cancel_order(symbol:, **kwargs) ⇒ Object
Cancel Order (TRADE).
-
#cancel_order_list(symbol:, **kwargs) ⇒ Object
Cancel OCO (TRADE).
-
#cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs) ⇒ Object
Cancel an Existing Order and Send a New Order (TRADE).
-
#get_order(symbol:, **kwargs) ⇒ Object
Query Order (USER_DATA).
-
#get_order_rate_limit(**kwargs) ⇒ Object
Query Current Order Count Usage (TRADE).
-
#my_trades(symbol:, **kwargs) ⇒ Object
Account Trade List (USER_DATA).
-
#new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) ⇒ Object
New OCO (TRADE).
-
#new_order(symbol:, side:, type:, **kwargs) ⇒ Object
New Order.
-
#new_order_test(symbol:, side:, type:, **kwargs) ⇒ Object
TestNew Order.
-
#open_order_list(**kwargs) ⇒ Object
Query Open OCO (USER_DATA).
-
#open_orders(**kwargs) ⇒ Object
Current Open Orders (USER_DATA).
-
#order_list(**kwargs) ⇒ Object
Query OCO (USER_DATA).
Instance Method Details
#account(**kwargs) ⇒ Object
Account Information (USER_DATA)
GET /api/v3/account
261 262 263 |
# File 'lib/binance/spot/trade.rb', line 261 def account(**kwargs) @session.sign_request(:get, '/api/v3/account', params: kwargs) end |
#all_order_list(**kwargs) ⇒ Object
Query all OCO (USER_DATA)
GET /api/v3/allOrderList
Retrieves all OCO based on provided optional parameters
239 240 241 |
# File 'lib/binance/spot/trade.rb', line 239 def all_order_list(**kwargs) @session.sign_request(:get, '/api/v3/allOrderList', params: kwargs) end |
#all_orders(symbol:, **kwargs) ⇒ Object
All Orders (USER_DATA)
GET /api/v3/allOrders
Get all account orders; active, canceled, or filled.
150 151 152 153 154 |
# File 'lib/binance/spot/trade.rb', line 150 def all_orders(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @session.sign_request(:get, '/api/v3/allOrders', params: kwargs.merge(symbol: symbol)) end |
#cancel_open_orders(symbol:, **kwargs) ⇒ Object
Cancel all Open Orders on a Symbol (TRADE)
DELETE /api/v3/openOrders
102 103 104 105 106 |
# File 'lib/binance/spot/trade.rb', line 102 def cancel_open_orders(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @session.sign_request(:delete, '/api/v3/openOrders', params: kwargs.merge(symbol: symbol)) end |
#cancel_order(symbol:, **kwargs) ⇒ Object
Cancel Order (TRADE)
DELETE /api/v3/order
88 89 90 91 92 |
# File 'lib/binance/spot/trade.rb', line 88 def cancel_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @session.sign_request(:delete, '/api/v3/order', params: kwargs.merge(symbol: symbol)) end |
#cancel_order_list(symbol:, **kwargs) ⇒ Object
Cancel OCO (TRADE)
DELETE /api/v3/orderList
205 206 207 208 209 |
# File 'lib/binance/spot/trade.rb', line 205 def cancel_order_list(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @session.sign_request(:delete, '/api/v3/orderList', params: kwargs.merge(symbol: symbol)) end |
#cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs) ⇒ Object
Cancel an Existing Order and Send a New Order (TRADE)
POST /api/v3/order/cancelReplace
316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/binance/spot/trade.rb', line 316 def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) Binance::Utils::Validation.require_param('type', type) Binance::Utils::Validation.require_param('cancelReplaceMode', cancelReplaceMode) @session.sign_request(:post, '/api/v3/order/cancelReplace', params: kwargs.merge( symbol: symbol, side: side, type: type, cancelReplaceMode: cancelReplaceMode )) end |
#get_order(symbol:, **kwargs) ⇒ Object
Query Order (USER_DATA)
GET /api/v3/order
118 119 120 121 122 |
# File 'lib/binance/spot/trade.rb', line 118 def get_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @session.sign_request(:get, '/api/v3/order', params: kwargs.merge(symbol: symbol)) end |
#get_order_rate_limit(**kwargs) ⇒ Object
Query Current Order Count Usage (TRADE)
GET /api/v3/rateLimit/order
289 290 291 |
# File 'lib/binance/spot/trade.rb', line 289 def get_order_rate_limit(**kwargs) @session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs) end |
#my_trades(symbol:, **kwargs) ⇒ Object
Account Trade List (USER_DATA)
GET /api/v3/myTrades
278 279 280 |
# File 'lib/binance/spot/trade.rb', line 278 def my_trades(symbol:, **kwargs) @session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol)) end |
#new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) ⇒ Object
New OCO (TRADE)
POST /api/v3/order/oco
Send in a new OCO
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/binance/spot/trade.rb', line 178 def new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) Binance::Utils::Validation.require_param('quantity', quantity) Binance::Utils::Validation.require_param('price', price) Binance::Utils::Validation.require_param('stopPrice', stopPrice) @session.sign_request(:post, '/api/v3/order/oco', params: kwargs.merge( symbol: symbol, side: side, quantity: quantity, price: price, stopPrice: stopPrice )) end |
#new_order(symbol:, side:, type:, **kwargs) ⇒ Object
New Order
POST /api/v3/order
send in a new order
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/binance/spot/trade.rb', line 65 def new_order(symbol:, side:, type:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:post, '/api/v3/order', params: kwargs.merge( symbol: symbol, side: side, type: type )) end |
#new_order_test(symbol:, side:, type:, **kwargs) ⇒ Object
TestNew Order
POST /api/v3/order/test
send in a new order to test the request, no order is really generated.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/binance/spot/trade.rb', line 33 def new_order_test(symbol:, side:, type:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:post, '/api/v3/order/test', params: kwargs.merge( symbol: symbol, side: side, type: type )) end |
#open_order_list(**kwargs) ⇒ Object
Query Open OCO (USER_DATA)
GET /api/v3/openOrderList
250 251 252 |
# File 'lib/binance/spot/trade.rb', line 250 def open_order_list(**kwargs) @session.sign_request(:get, '/api/v3/openOrderList', params: kwargs) end |
#open_orders(**kwargs) ⇒ Object
Current Open Orders (USER_DATA)
GET /api/v3/openOrders
132 133 134 |
# File 'lib/binance/spot/trade.rb', line 132 def open_orders(**kwargs) @session.sign_request(:get, '/api/v3/openOrders', params: kwargs) end |
#order_list(**kwargs) ⇒ Object
Query OCO (USER_DATA)
GET /api/v3/orderList
Retrieves a specific OCO based on provided optional parameters
222 223 224 |
# File 'lib/binance/spot/trade.rb', line 222 def order_list(**kwargs) @session.sign_request(:get, '/api/v3/orderList', params: kwargs) end |