Module: OandaApiV20::Orders
- Included in:
- Api
- Defined in:
- lib/oanda_api_v20/orders.rb
Instance Method Summary collapse
-
#order(*args) ⇒ Object
POST /v3/accounts/:account_id/orders GET /v3/accounts/:account_id/orders/:order_id PUT /v3/accounts/:account_id/orders/:order_id PUT /v3/accounts/:account_id/orders/:order_id/clientExtensions PUT /v3/accounts/:account_id/orders/:order_id/cancel.
-
#orders(options = {}) ⇒ Object
GET /v3/accounts/:account_id/orders.
-
#pending_orders ⇒ Object
GET /v3/accounts/:account_id/pendingOrders.
Instance Method Details
#order(*args) ⇒ Object
POST /v3/accounts/:account_id/orders GET /v3/accounts/:account_id/orders/:order_id PUT /v3/accounts/:account_id/orders/:order_id PUT /v3/accounts/:account_id/orders/:order_id/clientExtensions PUT /v3/accounts/:account_id/orders/:order_id/cancel
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/oanda_api_v20/orders.rb', line 9 def order(*args) = args.shift .is_a?(Hash) ? = : id = = args.shift unless args.nil? || args.empty? url = id ? "#{base_uri}/accounts/#{account_id}/orders/#{id}" : "#{base_uri}/accounts/#{account_id}/orders" url = order_url_for_put(url, ) if http_verb == :put ? Client.send(http_verb, url, headers: headers, body: .to_json) : Client.send(http_verb, url, headers: headers) end |
#orders(options = {}) ⇒ Object
GET /v3/accounts/:account_id/orders
21 22 23 |
# File 'lib/oanda_api_v20/orders.rb', line 21 def orders( = {}) Client.send(http_verb, "#{base_uri}/accounts/#{account_id}/orders", headers: headers, query: ) end |
#pending_orders ⇒ Object
GET /v3/accounts/:account_id/pendingOrders
26 27 28 |
# File 'lib/oanda_api_v20/orders.rb', line 26 def pending_orders Client.send(http_verb, "#{base_uri}/accounts/#{account_id}/pendingOrders", headers: headers) end |