class Cryptoexchange::Exchanges::Ercdex::Services::IdFetcher

Constants

PAIR_SYMBOLS
PAIR_SYMBOLS_URL

Public Class Methods

get_id(base, target) click to toggle source
# File lib/cryptoexchange/exchanges/ercdex/services/id_fetcher.rb, line 9
def self.get_id(base, target)
  if PAIR_SYMBOLS.empty?
   pairs_response = HTTP.get(PAIR_SYMBOLS_URL)
   PAIR_SYMBOLS << pairs_response.parse(:json)
  end
    # filtering through asset dictionary to find market_pair and obtaining the market_pair base and target's ID
    pair = PAIR_SYMBOLS[0].select{ |s| s["tokenPair"]["tokenA"]["symbol"] == base && s["tokenPair"]["tokenB"]["symbol"] == target }
  pair
end