class Cryptoexchange::Exchanges::Trademn::Services::Pairs

Constants

PAIRS_URL
TARGETS

Public Instance Methods

adapt(output) click to toggle source
# File lib/cryptoexchange/exchanges/trademn/services/pairs.rb, line 13
def adapt(output)
  market_pairs = []
  output.each do |pair|
    base, target = strip_pairs(pair)
    next unless base && target
    market_pairs << Cryptoexchange::Models::MarketPair.new(
                      base: base,
                      target: target,
                      market: Trademn::Market::NAME
                    )
  end
  market_pairs
end
fetch() click to toggle source
Calls superclass method Cryptoexchange::Services::Pairs#fetch
# File lib/cryptoexchange/exchanges/trademn/services/pairs.rb, line 8
def fetch
  output = super
  adapt(output['supported_pairs'])
end
strip_pairs(pair_symbol) click to toggle source
# File lib/cryptoexchange/exchanges/trademn/services/pairs.rb, line 27
def strip_pairs(pair_symbol)
#Match last 3 against targets
  TARGETS.include? pair_symbol[-3..-1]
    base = pair_symbol[0..-4]
    target = pair_symbol[-3..-1]
  [base, target]
end