Class: FTX::API::Orders

Inherits:
Private show all
Defined in:
lib/ftx/api/orders.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #key, #secret

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from FTX::API::Base

Instance Method Details

#create(query = {}) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
# File 'lib/ftx/api/orders.rb', line 23

def create(query = {})
  raise ArgumentError.new(
    "Market, side, price (can be nil), tupe and size params required"
    ) unless [:market, :side, :price, :type, :size].all? { |i| query.include? i }
  
  send_request(:post, "/orders", query)
end

#get(order_id) ⇒ Object



15
16
17
# File 'lib/ftx/api/orders.rb', line 15

def get(order_id)
  send_request(:get, "/orders/#{order_id}", {})
end

#get_by_client_id(client_id) ⇒ Object



19
20
21
# File 'lib/ftx/api/orders.rb', line 19

def get_by_client_id(client_id)
  send_request(:get, "/orders/by_client_id/#{client_id}", {})
end

#history(query = {}) ⇒ Object



11
12
13
# File 'lib/ftx/api/orders.rb', line 11

def history(query = {})
  send_request(:get, "/orders/history", query)
end

#open(query = {}) ⇒ Object



7
8
9
# File 'lib/ftx/api/orders.rb', line 7

def open(query = {})
  send_request(:get, "/orders", query)
end