Sha256: ca27ecc33e7cc6711c355357a0c00442ff1fc84cb47f6028c3dfaea1483e5e3a

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

module Mcoin
  module Market
    # :nodoc:
    class Cryptopia < Base
      ENDPOINT = 'https://www.cryptopia.co.nz/api/GetMarket/%<type>s_%<currency>s'

      private

      def build_ticker(pair, response)
        response = response['Data']
        Data::Ticker.new(
          :Cryptopia, pair[:type], pair[:currency],
          last: response['LastPrice'].to_s,
          ask:  response['AskPrice'].to_s,  bid: response['BidPrice'].to_s,
          high: response['High'].to_s, low: response['Low'].to_s,
          volume: response['Volume'],
          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/cryptopia.rb
mcoin-0.6.0 lib/mcoin/market/cryptopia.rb