Class: Market::Quote
- Inherits:
-
Object
- Object
- Market::Quote
- Includes:
- ArgumentProcessor
- Defined in:
- lib/market.rb
Instance Attribute Summary collapse
-
#ask ⇒ Object
Returns the value of attribute ask.
-
#bid ⇒ Object
Returns the value of attribute bid.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#last ⇒ Object
Returns the value of attribute last.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Quote
constructor
A new instance of Quote.
- #inspect ⇒ Object
- #mid ⇒ Object
Methods included from ArgumentProcessor
Constructor Details
#initialize(args = {}) ⇒ Quote
Returns a new instance of Quote.
30 31 32 33 |
# File 'lib/market.rb', line 30 def initialize(args = {}) process_args(args) self.extra = {} end |
Instance Attribute Details
#ask ⇒ Object
Returns the value of attribute ask.
28 29 30 |
# File 'lib/market.rb', line 28 def ask @ask end |
#bid ⇒ Object
Returns the value of attribute bid.
28 29 30 |
# File 'lib/market.rb', line 28 def bid @bid end |
#extra ⇒ Object
Returns the value of attribute extra.
28 29 30 |
# File 'lib/market.rb', line 28 def extra @extra end |
#last ⇒ Object
Returns the value of attribute last.
28 29 30 |
# File 'lib/market.rb', line 28 def last @last end |
#symbol ⇒ Object
Returns the value of attribute symbol.
28 29 30 |
# File 'lib/market.rb', line 28 def symbol @symbol end |
Instance Method Details
#inspect ⇒ Object
39 40 41 42 43 |
# File 'lib/market.rb', line 39 def inspect "<%s: L:%s B:%s A:%s>" % [ symbol, last.to_money_s, bid.to_money_s, ask.to_money_s ] end |
#mid ⇒ Object
35 36 37 |
# File 'lib/market.rb', line 35 def mid @mid ||= [bid, ask].reduce(:+) / 2.0 end |