Class: OKEX::API::Markets

Inherits:
Public show all
Defined in:
lib/okex/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 OKEX::API::Base

Instance Method Details

#list(type: :spot) ⇒ Object

Raises:

  • (ArgumentError)


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

def list(type: :spot)
  raise ArgumentError, "type must be either 'futures' or 'spot'" unless %w(futures spot).include?(type.to_s)
  send_request(:get, "/#{type.to_s}/v3/instruments", {})
end

#ticker(futures_name, type: :spot) ⇒ Object

Raises:

  • (ArgumentError)


17
18
19
20
# File 'lib/okex/api/markets.rb', line 17

def ticker(futures_name, type: :spot)
  raise ArgumentError, "type must be either 'futures' or 'spot'" unless %w(futures spot).include?(type.to_s)
  send_request(:get, "/#{type.to_s}/v3/instruments/#{futures_name}/ticker", {})
end

#tickers(type: :spot) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/okex/api/markets.rb', line 12

def tickers(type: :spot)
  raise ArgumentError, "type must be either 'futures' or 'spot'" unless %w(futures spot).include?(type.to_s)
  send_request(:get, "/#{type.to_s}/v3/instruments/ticker", {})
end