Module: Cryptowatch::Markets

Defined in:
lib/cryptowatch/business/markets.rb

Constant Summary collapse

API_URL =
"#{Api::API_BASE_URL}/markets"
ROUTES =
[
  :price,     #Returns a market’s last price.
  :summary,   #Other stats based on a 24-hour sliding window.
  :orderbook, #Returns a market’s order book.
  :trades,    #Returns a market’s most recent trades, incrementing chronologically.
  :ohlc       #Returns a market’s OHLC candlestick data.
]

Class Method Summary collapse

Class Method Details

.indexObject



20
21
22
# File 'lib/cryptowatch/business/markets.rb', line 20

def self.index
  return API_URL
end

.market(exchange, asset, route = nil) ⇒ Object



24
25
26
# File 'lib/cryptowatch/business/markets.rb', line 24

def self.market(exchange)
  return Api::format_url(API_URL, exchange)
end

.ohlc(exchange, asset) ⇒ Object



52
53
54
# File 'lib/cryptowatch/business/markets.rb', line 52

def self.ohlc(exchange, asset)
  return self.market(exchange, asset, :ohlc)
end

.orderbook(exchange, asset) ⇒ Object



44
45
46
# File 'lib/cryptowatch/business/markets.rb', line 44

def self.orderbook(exchange, asset)
  return self.market(exchange, asset, :orderbook)
end

.price(exchange, asset) ⇒ Object



36
37
38
# File 'lib/cryptowatch/business/markets.rb', line 36

def self.price(exchange, asset)
  return self.market(exchange, asset, :price)
end

.summary(exchange, asset) ⇒ Object



40
41
42
# File 'lib/cryptowatch/business/markets.rb', line 40

def self.summary(exchange, asset)
  return self.market(exchange, asset, :summary)
end

.trades(exchange, asset) ⇒ Object



48
49
50
# File 'lib/cryptowatch/business/markets.rb', line 48

def self.trades(exchange, asset)
  return self.market(exchange, asset, :trades)
end