class Iqfeed::Level1Observer

Attributes

ask[RW]
bid[RW]
symbol[RW]

Public Class Methods

new(symbol) click to toggle source
# File lib/iqfeed/level1_client.rb, line 8
def initialize(symbol)
        @symbol = symbol
end

Public Instance Methods

update(tick) click to toggle source
# File lib/iqfeed/level1_client.rb, line 12
def update(tick)
        @bid = tick.bid if @bid.nil? && tick.type =~ /(t|b)/
        @bid = tick.bid if tick.type =~ /b/
        @ask = tick.ask if @ask.nil? && tick.type =~ /(t|a)/
        @ask = tick.ask if tick.type =~ /a/
        puts tick.to_s(@bid, @ask) if tick.sym == @symbol && tick.type =~ /t/
end