Sha256: d1bc8c59b72fd1abd1a365125d361d0a9d01a3aee969ed530684f8af6f233af8

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

module Mcoin
  module Market
    # :nodoc:
    class Okex < Base
      ENDPOINT = 'https://www.okex.com/api/v1/ticker.do?symbol=%<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)
        response = response['ticker']
        Data::Ticker.new(
          :Okex, pair[:type].upcase, pair[:currency].upcase,
          last: response['last'],
          ask:  response['sell'], bid:  response['buy'],
          low:  response['low'],  high: response['high'],
          volume: response['vol'],
          timestamp: response['date'].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/okex.rb
mcoin-0.6.0 lib/mcoin/market/okex.rb