Sha256: 691d2f735182d704eb6167c39c656cefdf3a6c24666c3a94e9d809260b2875c3

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require 'time'

module Mcoin
  module Market
    # :nodoc:
    class Bitflyer < Base
      ENDPOINT = 'https://api.bitflyer.jp/v1/getticker?product_code=%<type>s_%<currency>s'

      private

      def build_ticker(pair, response)
        Data::Ticker.new(
          :Bitflyer, pair[:type], pair[:currency],
          last: response['ltp'].to_s,
          ask: response['best_ask'].to_s, bid: response['best_bid'].to_s,
          low: response['best_bid'].to_s, high: response['best_ask'].to_s,
          volume: response['volume'], # Trading volume in 24 hours
          timestamp: Time.parse(response['timestamp']).to_f
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mcoin-0.6.1 lib/mcoin/market/bitflyer.rb
mcoin-0.6.0 lib/mcoin/market/bitflyer.rb