Class: Cryptohopper::Resources::Exchange

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptohopper/resources/exchange.rb

Overview

‘client.exchange` — public market data (no auth required).

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Exchange

Returns a new instance of Exchange.



7
8
9
# File 'lib/cryptohopper/resources/exchange.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#candles(exchange:, market:, timeframe:, from: nil, to: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/cryptohopper/resources/exchange.rb', line 16

def candles(exchange:, market:, timeframe:, from: nil, to: nil)
  @client._request(
    "GET", "/exchange/candle",
    params: {
      exchange: exchange, market: market, timeframe: timeframe,
      from: from, to: to
    }
  )
end

#currencies(exchange) ⇒ Object



36
37
38
39
# File 'lib/cryptohopper/resources/exchange.rb', line 36

def currencies(exchange)
  @client._request("GET", "/exchange/currencies",
                   params: { exchange: exchange })
end

#exchangesObject



41
42
43
# File 'lib/cryptohopper/resources/exchange.rb', line 41

def exchanges
  @client._request("GET", "/exchange/exchanges")
end

#forex_ratesObject



45
46
47
# File 'lib/cryptohopper/resources/exchange.rb', line 45

def forex_rates
  @client._request("GET", "/exchange/forex-rates")
end

#markets(exchange) ⇒ Object



31
32
33
34
# File 'lib/cryptohopper/resources/exchange.rb', line 31

def markets(exchange)
  @client._request("GET", "/exchange/markets",
                   params: { exchange: exchange })
end

#orderbook(exchange:, market:) ⇒ Object



26
27
28
29
# File 'lib/cryptohopper/resources/exchange.rb', line 26

def orderbook(exchange:, market:)
  @client._request("GET", "/exchange/orderbook",
                   params: { exchange: exchange, market: market })
end

#ticker(exchange:, market:) ⇒ Object



11
12
13
14
# File 'lib/cryptohopper/resources/exchange.rb', line 11

def ticker(exchange:, market:)
  @client._request("GET", "/exchange/ticker",
                   params: { exchange: exchange, market: market })
end