Class: YahooFinance::StockHistory
- Inherits:
-
Object
- Object
- YahooFinance::StockHistory
- Defined in:
- lib/yahoo_finance/stock.rb
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(stock, start_date, end_date = nil) ⇒ StockHistory
constructor
A new instance of StockHistory.
Constructor Details
#initialize(stock, start_date, end_date = nil) ⇒ StockHistory
Returns a new instance of StockHistory.
285 286 287 288 289 290 291 292 293 |
# File 'lib/yahoo_finance/stock.rb', line 285 def initialize stock, start_date, end_date = nil @stock = stock @start_date = start_date if end_date @end_date = end_date else @end_date = Date.today - 1 end end |
Instance Method Details
#fetch ⇒ Object
295 296 297 298 |
# File 'lib/yahoo_finance/stock.rb', line 295 def fetch ys = YahooStock::History.new(:stock_symbol => @stock, :start_date => @start_date, :end_date => @end_date) ys.results(:to_hash).output end |