Class: Cryptoexchange::Exchanges::Huobi::Services::Pairs

Inherits:
Services::Pairs show all
Defined in:
lib/cryptoexchange/exchanges/huobi/services/pairs.rb

Constant Summary collapse

PAIRS_URLS =
[
  "#{Cryptoexchange::Exchanges::Huobi::Market::DOT_PRO_API_URL}/v1/common/symbols"
]

Constants inherited from Services::Pairs

Services::Pairs::HTTP_METHOD, Services::Pairs::MARKET, Services::Pairs::PAIRS_URL, Services::Pairs::POST_PARAMS

Instance Method Summary collapse

Methods inherited from Services::Pairs

#default_override_exist?, #default_override_path, #exchange_class, #fetch_via_api, #fetch_via_api_using_post, #fetch_via_override, #http_get, #http_post, #user_override_exist?, #user_override_path

Instance Method Details

#adapt(output) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/cryptoexchange/exchanges/huobi/services/pairs.rb', line 16

def adapt(output)
  output['data'].map do |pair|
    Cryptoexchange::Models::MarketPair.new({
      base: pair['base-currency'],
      target: pair['quote-currency'],
      market: Huobi::Market::NAME
    })
  end
end

#fetchObject



9
10
11
12
13
14
# File 'lib/cryptoexchange/exchanges/huobi/services/pairs.rb', line 9

def fetch
  PAIRS_URLS.map do |endpoint|
    output = fetch_via_api(endpoint)
    adapt(output)
  end.flatten
end