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.
24 25 26 27 |
# File 'lib/market.rb', line 24 def initialize(args = {}) process_args(args) self.extra = {} end |
Instance Attribute Details
#ask ⇒ Object
Returns the value of attribute ask.
22 23 24 |
# File 'lib/market.rb', line 22 def ask @ask end |
#bid ⇒ Object
Returns the value of attribute bid.
22 23 24 |
# File 'lib/market.rb', line 22 def bid @bid end |
#extra ⇒ Object
Returns the value of attribute extra.
22 23 24 |
# File 'lib/market.rb', line 22 def extra @extra end |
#last ⇒ Object
Returns the value of attribute last.
22 23 24 |
# File 'lib/market.rb', line 22 def last @last end |
#symbol ⇒ Object
Returns the value of attribute symbol.
22 23 24 |
# File 'lib/market.rb', line 22 def symbol @symbol end |
Instance Method Details
#inspect ⇒ Object
33 34 35 36 37 |
# File 'lib/market.rb', line 33 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
29 30 31 |
# File 'lib/market.rb', line 29 def mid @mid ||= [bid, ask].reduce(:+) / 2.0 end |