Sha256: 4357c6f146de5719a1ec4ee7cddcb8156490c1338a15017be12006f60d48c04b
Contents?: true
Size: 587 Bytes
Versions: 7
Compression:
Stored size: 587 Bytes
Contents
module CurrencyRate class OkcoinAdapter < Adapter FETCH_URL = { 'LTC_USD' => 'https://www.okcoin.com/api/v1/ticker.do?symbol=ltc_usd', 'BTC_USD' => 'https://www.okcoin.com/api/v1/ticker.do?symbol=btc_usd', 'LTC_CNY' => 'https://www.okcoin.cn/api/ticker.do?symbol=ltc_cny', 'BTC_CNY' => 'https://www.okcoin.cn/api/ticker.do?symbol=btc_cny' } def normalize(data) return nil unless super data.reduce({}) do |result, (pair, value)| result[pair] = BigDecimal(value["ticker"]["last"].to_s) result end end end end
Version data entries
7 entries across 7 versions & 1 rubygems