Class: RTicker::Option
Overview
Represents option contracts which are derivatives of either equities or futures.
Instance Attribute Summary collapse
-
#ask ⇒ Object
Because option contracts are not traded as much as their underlying, the bid/ask spread can be pretty high and there might be quite a bit of time since a trade has occurred for a given contract.
-
#bid ⇒ Object
Because option contracts are not traded as much as their underlying, the bid/ask spread can be pretty high and there might be quite a bit of time since a trade has occurred for a given contract.
Attributes inherited from Entry
#bold, #curr_value, #description, #last_changed, #purchase_count, #purchase_price, #symbol
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(symbol, description = nil, purchase_count = nil, purchase_price = nil, bold = false) ⇒ Option
constructor
A new instance of Option.
Constructor Details
#initialize(symbol, description = nil, purchase_count = nil, purchase_price = nil, bold = false) ⇒ Option
Returns a new instance of Option.
19 20 21 22 |
# File 'lib/rticker/option.rb', line 19 def initialize (symbol, description=nil, purchase_count=nil, purchase_price=nil, bold=false) super(symbol, description, purchase_count, purchase_price, bold) @bid = @ask = nil end |
Instance Attribute Details
#ask ⇒ Object
Because option contracts are not traded as much as their underlying, the bid/ask spread can be pretty high and there might be quite a bit of time since a trade has occurred for a given contract. Therefore it is sometimes more meaningful to represent the value of an option by showing both the current bid and ask prices rather than the last trade price.
17 18 19 |
# File 'lib/rticker/option.rb', line 17 def ask @ask end |
#bid ⇒ Object
Because option contracts are not traded as much as their underlying, the bid/ask spread can be pretty high and there might be quite a bit of time since a trade has occurred for a given contract. Therefore it is sometimes more meaningful to represent the value of an option by showing both the current bid and ask prices rather than the last trade price.
17 18 19 |
# File 'lib/rticker/option.rb', line 17 def bid @bid end |
Class Method Details
.update(entries) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rticker/option.rb', line 24 def Option.update (entries) go = Proc.new do |entry| Thread.new { Option.run_update entry } end threads = [] for entry in entries # Can only grab one option contract at a time, so request each one in # a separate thread. threads << go.call(entry) end threads.each {|t| t.join} end |