class Cryptoexchange::Exchanges::Coinhub::Services::Pairs

Constants

PAIRS_URL

Public Instance Methods

fetch() click to toggle source
# File lib/cryptoexchange/exchanges/coinhub/services/pairs.rb, line 7
def fetch
  raw_output = HTTP.get(PAIRS_URL)
  output = JSON.parse(raw_output)
  market_pairs = []
  output['results'].each do |pair|
    market_pairs << Cryptoexchange::Models::MarketPair.new(
                      inst_id: pair['id'],
                      base: pair['fromSymbol'],
                      target: pair['toSymbol'],
                      market: Coinhub::Market::NAME
                    )
  end
  market_pairs
end