Class: StockPivot::EodQuote
- Inherits:
-
Object
- Object
- StockPivot::EodQuote
- Defined in:
- lib/stock_pivot/eod_quote.rb
Instance Attribute Summary collapse
-
#close ⇒ Object
readonly
Returns the value of attribute close.
-
#high ⇒ Object
readonly
Returns the value of attribute high.
-
#low ⇒ Object
readonly
Returns the value of attribute low.
-
#open ⇒ Object
readonly
Returns the value of attribute open.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#trade_date ⇒ Object
readonly
Returns the value of attribute trade_date.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Instance Method Summary collapse
-
#initialize(args) ⇒ EodQuote
constructor
A new instance of EodQuote.
- #range ⇒ Object
Constructor Details
#initialize(args) ⇒ EodQuote
Returns a new instance of EodQuote.
6 7 8 9 10 11 12 13 14 |
# File 'lib/stock_pivot/eod_quote.rb', line 6 def initialize(args) @symbol = args.fetch(:symbol).upcase @trade_date = args.fetch(:trade_date) @open = args.fetch(:open, 0.0).to_d @high = args.fetch(:high, 0.0).to_d @low = args.fetch(:low, 0.0).to_d @close = args.fetch(:close, 0.0).to_d @volume = args.fetch(:volume, 0).to_i end |
Instance Attribute Details
#close ⇒ Object (readonly)
Returns the value of attribute close.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def close @close end |
#high ⇒ Object (readonly)
Returns the value of attribute high.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def high @high end |
#low ⇒ Object (readonly)
Returns the value of attribute low.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def low @low end |
#open ⇒ Object (readonly)
Returns the value of attribute open.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def open @open end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def symbol @symbol end |
#trade_date ⇒ Object (readonly)
Returns the value of attribute trade_date.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def trade_date @trade_date end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
4 5 6 |
# File 'lib/stock_pivot/eod_quote.rb', line 4 def volume @volume end |
Instance Method Details
#range ⇒ Object
16 17 18 |
# File 'lib/stock_pivot/eod_quote.rb', line 16 def range @range ||= (@high - @low).round(2) end |