Sha256: 78cae413a4daf0c6735efa8a377d99d09ead0ebfb4a57992cf94052588f717d6

Contents?: true

Size: 663 Bytes

Versions: 2

Compression:

Stored size: 663 Bytes

Contents

# frozen_string_literal: true

module Mcoin
  module Market
    # :nodoc:
    class Kucoin < Base
      ENDPOINT = 'https://api.kucoin.com/v1/open/tick?symbol=%<type>s-%<currency>s'

      private

      def build_ticker(pair, response)
        response = response['data']
        Data::Ticker.new(
          :Kucoin, pair[:type], pair[:currency],
          last: response['lastDealPrice'].to_s,
          ask:  response['sell'].to_s, bid:  response['buy'].to_s,
          low:  response['low'].to_s,  high: response['high'].to_s,
          volume: response['vol'].to_s,
          timestamp: response['datetime'] / 1000.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/kucoin.rb
mcoin-0.6.0 lib/mcoin/market/kucoin.rb