Class: Yfin::History
- Inherits:
-
Object
- Object
- Yfin::History
- Defined in:
- lib/yfin/history.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(symbol, options = {}) ⇒ History
constructor
A new instance of History.
- #to_csv ⇒ Object
Constructor Details
#initialize(symbol, options = {}) ⇒ History
Returns a new instance of History.
5 6 7 8 9 10 11 |
# File 'lib/yfin/history.rb', line 5 def initialize(symbol, ={}) () @symbol = symbol @start_date = [:start_date] || Date.today - 30 @end_date = [:end_date] || Date.today @type = [:type] || :daily end |
Instance Attribute Details
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
3 4 5 |
# File 'lib/yfin/history.rb', line 3 def end_date @end_date end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
3 4 5 |
# File 'lib/yfin/history.rb', line 3 def start_date @start_date end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
3 4 5 |
# File 'lib/yfin/history.rb', line 3 def symbol @symbol end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/yfin/history.rb', line 3 def type @type end |
Instance Method Details
#to_csv ⇒ Object
13 14 15 |
# File 'lib/yfin/history.rb', line 13 def to_csv CSV.parse(data_from_yahoo, headers: :first_line, header_converters: :symbol, converters: [:date, :numeric]) end |