Class: StocksExchangeApiClient::Public

Inherits:
Object
  • Object
show all
Defined in:
lib/stocks_exchange_api_client/public.rb

Class Method Summary collapse

Class Method Details

.currenciesObject



4
5
6
7
8
# File 'lib/stocks_exchange_api_client/public.rb', line 4

def currencies
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           'currencies')
end

.grafic(params = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/stocks_exchange_api_client/public.rb', line 49

def grafic(params = {})
  params[:pair] = params[:pair].nil? ? DEFAULT_PAIRS : params[:pair]
  params[:count] = params[:count].nil? ? MAX_COUNT : params[:count]
  params[:order] = params[:order].nil? ? ASC : params[:order]
  params[:interval] = params[:interval].nil? ? INTERVAL[:day] : params[:interval]
  params[:page] = params[:page].nil? ? 1 : params[:page]
  params[:order] = ASC unless params[:since].nil? || params[:end].nil?
  encode_www_form = URI.encode_www_form(params)

  url = "grafic_public?#{encode_www_form}"
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           url)
end

.marketsObject



10
11
12
13
14
# File 'lib/stocks_exchange_api_client/public.rb', line 10

def markets
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           'markets')
end

.markets_summary(currency1 = 'ETH', currency2 = 'BTC') ⇒ Object



16
17
18
19
20
21
# File 'lib/stocks_exchange_api_client/public.rb', line 16

def markets_summary(currency1 = 'ETH', currency2 = 'BTC')
  url = "market_summary/#{currency1}/#{currency2}"
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           url)
end

.order_book(pair = DEFAULT_PAIRS) ⇒ Object



42
43
44
45
46
47
# File 'lib/stocks_exchange_api_client/public.rb', line 42

def order_book(pair = DEFAULT_PAIRS)
  url = "orderbook?pair=#{pair}"
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           url)
end

.pricesObject



29
30
31
32
33
# File 'lib/stocks_exchange_api_client/public.rb', line 29

def prices
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           'prices')
end

.tickerObject



23
24
25
26
27
# File 'lib/stocks_exchange_api_client/public.rb', line 23

def ticker
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           'ticker')
end

.trade_history(pair = DEFAULT_PAIRS) ⇒ Object



35
36
37
38
39
40
# File 'lib/stocks_exchange_api_client/public.rb', line 35

def trade_history(pair = DEFAULT_PAIRS)
  url = "trades?pair=#{pair}"
  StocksExchangeApiClient.make_api_request(:get,
                                           nil,
                                           url)
end