lib/mcoin/data/ticker.rb in mcoin-0.1.0 vs lib/mcoin/data/ticker.rb in mcoin-0.2.0
- old
+ new
@@ -1,21 +1,24 @@
+# frozen_string_literal: true
+
module Mcoin
module Data
# :nodoc:
class Ticker
- attr_reader :type, :currency
+ attr_reader :market, :type, :currency
attr_accessor :last, :ask, :bid, :low, :high, :volume
- def initialize(type, currency, data = {})
+ def initialize(market, type, currency, data = {})
+ @market = market
@type = type
@currency = currency
data.each do |key, value|
send("#{key}=", value)
end
end
def to_influx(tags = {}, values = {})
- tags = { type: @type, currency: @currency }.merge(tags)
+ tags = { type: @type, currency: @currency, market: @market }.merge(tags)
values = {
last: @last,
ask: @ask, bid: @bid,
low: @low, high: @high,
volume: @volume