class Cryptoexchange::Exchanges::Kraken::Services::Pairs
Constants
- ASSETS_URL
Custom to
Kraken
- PAIRS_URL
Public Instance Methods
adapt(output)
click to toggle source
# File lib/cryptoexchange/exchanges/kraken/services/pairs.rb, line 12 def adapt(output) market_pairs = [] output['result'].each do |key, pair| market_pairs << Cryptoexchange::Models::MarketPair.new( base: symbol_from_assets(pair['base']), target: symbol_from_assets(pair['quote']), market: Kraken::Market::NAME ) end market_pairs end
fetch()
click to toggle source
Calls superclass method
Cryptoexchange::Services::Pairs#fetch
# File lib/cryptoexchange/exchanges/kraken/services/pairs.rb, line 7 def fetch output = super adapt(output) end
Private Instance Methods
assets()
click to toggle source
# File lib/cryptoexchange/exchanges/kraken/services/pairs.rb, line 30 def assets fetch_response = HTTP.timeout(:write => 2, :connect => 5, :read => 8).get(self.class::ASSETS_URL) JSON.parse(fetch_response.to_s)['result'] end
symbol_from_assets(kraken_symbol)
click to toggle source
# File lib/cryptoexchange/exchanges/kraken/services/pairs.rb, line 35 def symbol_from_assets(kraken_symbol) assets[kraken_symbol]['altname'] end