Class: MaxExchangeApi::PublicApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/max_exchange_api/public_api.rb

Instance Attribute Summary

Attributes inherited from BaseApi

#config

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize

Constructor Details

This class inherits a constructor from MaxExchangeApi::BaseApi

Instance Method Details

#currenciesObject



17
18
19
# File 'lib/max_exchange_api/public_api.rb', line 17

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

#depth(market, limit: 10, sort_by_price: true) ⇒ Object



25
26
27
# File 'lib/max_exchange_api/public_api.rb', line 25

def depth(market, limit: 10, sort_by_price: true)
  send_request(:get, '/depth', market: market, limit: limit, sort_by_price: sort_by_price)
end

#k(market, limit: 30, period: 1, timestamp: nil) ⇒ Object



21
22
23
# File 'lib/max_exchange_api/public_api.rb', line 21

def k(market, limit: 30, period: 1, timestamp: nil)
  send_request(:get, '/k', market: market, limit: limit, period: period, timestamp: timestamp)
end

#marketsObject



46
47
48
# File 'lib/max_exchange_api/public_api.rb', line 46

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

#summaryObject



50
51
52
# File 'lib/max_exchange_api/public_api.rb', line 50

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

#tickers(market = nil) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/max_exchange_api/public_api.rb', line 54

def tickers(market = nil)
  if market
    send_request(:get, "/tickers/#{market}", {})
  else
    send_request(:get, '/tickers', {})
  end
end

#timestampObject



62
63
64
# File 'lib/max_exchange_api/public_api.rb', line 62

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

#trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50, offset: 0) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/max_exchange_api/public_api.rb', line 29

def trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50,
           offset: 0)
  send_request(
    :get,
    '/trades',
    market: market,
    timestamp: timestamp,
    from: from,
    to: to,
    order_by: order_by,
    pagination: pagination,
    page: page,
    limit: limit,
    offset: offset,
  )
end

#vip_levels(level = nil) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/max_exchange_api/public_api.rb', line 9

def vip_levels(level = nil)
  if level
    send_request(:get, "/vip_levels/#{level}", {})
  else
    send_request(:get, '/vip_levels', {})
  end
end