Sha256: 35d9658fe7aa5ce914426f4437f9836dce4b3a9aedf33300f977cd8d93cd7068

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

# lib/sqa/stock.rb

class SQA::Stock
  attr_accessor :company_name
  attr_accessor :df             # The DataFrane
  attr_accessor :ticker

  def initialize(ticker:, source: :yahoo_finance, type: :csv)
    @ticker       = ticker
    @company_name = "Company Name"
    klass         = "SQA::DataFrame::#{source.to_s.camelize}".constantize
    @df           = klass.send("from_#{type.downcase}", ticker)
  end

  def to_s
    "#{ticker} with #{@df.size} data points from #{@df.timestamp.first} to #{@df.timestamp.last}"
  end
end

__END__

aapl = Stock.new('aapl', SQA::Datastore::CSV)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sqa-0.0.6 lib/sqa/stock.rb
sqa-0.0.5 lib/sqa/stock.rb
sqa-0.0.4 lib/sqa/stock.rb
sqa-0.0.3 lib/sqa/stock.rb
sqa-0.0.2 lib/sqa/stock.rb