Sha256: 9cde8da97d8549a19526f5f315c07898a88c4627d51d0db87b18dc0219c4f741

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true

module Mcoin
  module Market
    # :nodoc:
    class Btcbox < Base
      ENDPOINT = 'https://www.btcbox.co.jp/api/v1/ticker?coin=%<type>s'

      def watch(type, currency)
        @pairs.add({ type: type.to_s.downcase, currency: currency.to_s.downcase })
      end

      private

      def build_ticker(pair, response)
        Data::Ticker.new(
          :Btcbox, pair[:type].upcase, 'JPY',
          last: response['last'],
          ask:  response['sell'], bid:  response['buy'],
          low:  response['low'],  high: response['high'],
          volume:    response['vol'],
          timestamp: Time.now.utc.to_i
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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