class Cryptoexchange::Exchanges::Jex::Services::Pairs

Constants

PAIRS_URL

Public Instance Methods

adapt(output) click to toggle source
# File lib/cryptoexchange/exchanges/jex/services/pairs.rb, line 12
def adapt(output)
  market_pairs = []
  output.map do |pair, ticker|
    if !derivative(pair)
      base, target = pair.split('/')
      market_pairs << Cryptoexchange::Models::MarketPair.new(
        base: base.upcase,
        target: target.upcase,
        market: Jex::Market::NAME
      )
    end
  end
  market_pairs
end
derivative(pair) click to toggle source
# File lib/cryptoexchange/exchanges/jex/services/pairs.rb, line 27
def derivative(pair)
  etf = /(ETF)/ =~ pair
  option = /(PUT|CALL)/ =~ pair
  if etf && !pair.include?("/")
    true  
  elsif option && pair.count("/") > 1
    true
  elsif option
    true
  else
    false
  end
end
fetch() click to toggle source
Calls superclass method Cryptoexchange::Services::Pairs#fetch
# File lib/cryptoexchange/exchanges/jex/services/pairs.rb, line 7
def fetch
  output = super
  adapt(output)
end