class Bitstamper::Models::Ticker

Constants

MAPPING

Attributes

ask[RW]
bid[RW]
currency_pair[RW]
high[RW]
last[RW]
low[RW]
open[RW]
timestamp[RW]
volume[RW]
vwap[RW]

Public Class Methods

new(hash) click to toggle source
# File lib/bitstamper/models/ticker.rb, line 19
def initialize(hash)
  hash.each do |key, value|
    type            =     ::Bitstamper::Models::Ticker::MAPPING.fetch(key, nil)
    value           =     value && type ? ::Bitstamper::Utilities::convert_value(value, type) : value
    self.send("#{key}=", value) if self.respond_to?(key)
  end
end
parse(data) click to toggle source
# File lib/bitstamper/models/ticker.rb, line 27
def self.parse(data)
  data&.collect { |item| ::Bitstamper::Models::Ticker.new(item) }
end