class Cryptoexchange::Exchanges::Idex::Services::Pairs

Constants

HTTP_METHOD
PAIRS_URL

Public Instance Methods

adapt(pair_list) click to toggle source
# File lib/cryptoexchange/exchanges/idex/services/pairs.rb, line 27
def adapt(pair_list)
  pair_list.map do |pair|
    target, base = pair.split("_")
    Cryptoexchange::Models::MarketPair.new(
      base: base,
      target: target,
      market: Idex::Market::NAME
    )
  end
end
fetch() click to toggle source
Calls superclass method Cryptoexchange::Services::Pairs#fetch
# File lib/cryptoexchange/exchanges/idex/services/pairs.rb, line 8
def fetch
  output = super
  pair_list = filter_nil_pair(output)
  adapt(pair_list)
end
filter_nil_pair(output) click to toggle source
# File lib/cryptoexchange/exchanges/idex/services/pairs.rb, line 14
def filter_nil_pair(output)
  pair_list = []
  output.map do |k, v|
    i = 0
    v.select do |key, value|
      i += 1 if value == "N/A"
    end
    next if i >= 5
    pair_list << k
  end
  pair_list
end