class Cryptoexchange::Exchanges::B2bx::Services::Pairs

Constants

PAIRS_URL

Public Instance Methods

fetch() click to toggle source
# File lib/cryptoexchange/exchanges/b2bx/services/pairs.rb, line 7
def fetch
  market_pairs = []
  raw_output = HTTP.use(:auto_inflate).headers("Accept-Encoding" => "gzip").get(PAIRS_URL)
  output = JSON.parse(raw_output)
  output.each do |pair|
    symbol = pair['Instrument']
    base, target = symbol.split(Cryptoexchange::Exchanges::B2bx::Market::SUPPORTED_PAIRS_REGEX)
      market_pairs << Cryptoexchange::Models::MarketPair.new(
        base:   base,
        target: target,
        market: B2bx::Market::NAME
    )
  end
  market_pairs
end