class Iqfeed::Tick

Attributes

ask[RW]
bid[RW]
last_price[RW]
last_size[RW]
tick_id[RW]
time_stamp[RW]
total_volume[RW]

Public Class Methods

parse(line) click to toggle source
# File lib/iqfeed/history_client.rb, line 25
def self.parse(line)
        tick = Tick.new
        fields = line.split(',')
        tick.time_stamp = fields[0].to_s
        tick.last_price = fields[1].to_f
        tick.last_size = fields[2].to_i
        tick.total_volume = fields[3].to_i
        tick.bid = fields[4].to_f
        tick.ask = fields[5].to_f
        tick                 
end

Public Instance Methods

to_csv() click to toggle source
# File lib/iqfeed/history_client.rb, line 41
def to_csv
        [@time_stamp, @last_price, @last_size, @total_volume, @bid, @ask].join(';')
end
to_s() click to toggle source
# File lib/iqfeed/history_client.rb, line 37
def to_s
        "Timestamp:#{@time_stamp} LastPrice:#{@last_price} LastSize:#{@last_size} TotalVolume:#{@total_volume} Bid:#{@bid} Ask:#{@ask}"
end