Sha256: 0f2f8f9687a34d5421e86d2910ce2c70522305d536d63b7babcc03c976e1d9bd

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true

module Mcoin
  module Market
    # :nodoc:
    class Coincheck < Base
      ENDPOINT = 'https://coincheck.com/api/ticker?pair=%<type>s_%<currency>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(
          :Coincheck, pair[:type].upcase, pair[:currency],
          last: response['last'].to_s,
          ask:  response['ask'].to_s,  bid: response['bid'].to_s,
          high: response['high'].to_s, low: response['low'].to_s,
          volume: response['volume'],
          timestamp: response['timestamp']
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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