Class: Ytterb::StockSymbol::Freshness

Inherits:
ReportBase
  • Object
show all
Defined in:
lib/ytterb/stock_symbol/report_filters/freshness.rb

Instance Method Summary collapse

Methods inherited from ReportBase

#initialize

Constructor Details

This class inherits a constructor from Ytterb::StockSymbol::ReportBase

Instance Method Details

#outputObject



20
21
22
23
24
25
# File 'lib/ytterb/stock_symbol/report_filters/freshness.rb', line 20

def output
  output = "Freshness report\n" <<
      "----------------\n"
  @freshness.keys.sort.reverse.each {|k| output += "'#{k}' => #{@freshness[k].size} \n" }
  output
end

#processObject



11
12
13
14
15
16
17
18
# File 'lib/ytterb/stock_symbol/report_filters/freshness.rb', line 11

def process
  @freshness = {}
  @sml.stock_symbols.each do |smbl|
    latest = smbl.history.keys.collect {|x| Date.parse(x)}.sort.last.to_s
    @freshness[latest] ||= []
    @freshness[latest] << smbl
  end
end