module IndependentReserve

Constants

VERSION

Public Class Methods

market_summary(primary_currency_code:, secondary_currency_code:) click to toggle source
# File lib/independent_reserve.rb, line 10
def self.market_summary(primary_currency_code:, secondary_currency_code:)
  url = "https://api.independentreserve.com/Public/GetMarketSummary"\
    "?PrimaryCurrencyCode=#{primary_currency_code}"\
    "&SecondaryCurrencyCode=#{secondary_currency_code}"

  response_body = HTTP.get(url).to_s
  hash = JSON.parse(response_body, decimal_class: BigDecimal)
  hash.transform_keys { |key| key.underscore.to_sym }
end