Class: FTX::API::Markets

Inherits:
Public show all
Defined in:
lib/ftx/api/markets.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

#get(market_name) ⇒ Object



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

def get(market_name)
  send_request(:get, "/markets/#{market_name}", {})
end

#historic(market_name, query = {}) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
# File 'lib/ftx/api/markets.rb', line 19

def historic(market_name, query = {})
  raise ArgumentError.new(
    "Resolution required as a window length in seconds. 
    options: 15, 60, 300, 900, 3600, 14400, 86400, or 
    any multiple of 86400 up to 30*86400") unless query.dig(:resolution)
  
  send_request(:get, "/markets/#{market_name}/candles", query)
end

#listObject



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

def list
  send_request(:get, '/markets', {})
end

#orderbook(market_name, depth: nil) ⇒ Object



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

def orderbook(market_name, depth: nil)
  send_request(:get, "/markets/#{market_name}/orderbook", depth: depth)
end