Class: StockCruncher::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/stockcruncher/cli.rb

Overview

Simple CLI for StockCruncher

Instance Method Summary collapse

Instance Method Details

#daily(symbol) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/stockcruncher/cli.rb', line 47

def daily(symbol)
  opts = options.dup
  config = YAML.load_file(opts['config'])
  cruncher = StockCruncher::AlphaVantage.new(config, opts['insecure'])
  raw_data = cruncher.crunch_daily(symbol, opts['full'])
  StockCruncher::InfluxDB.new(config).export_history(symbol, raw_data)
  puts raw_data unless opts['quiet']
end

#quote(symbol) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/stockcruncher/cli.rb', line 58

def quote(symbol)
  opts = options.dup
  config = YAML.load_file(opts['config'])
  cruncher = StockCruncher::AlphaVantage.new(config, opts['insecure'])
  raw_data = cruncher.crunch_quote(symbol)
  StockCruncher::InfluxDB.new(config).export_last_day(raw_data)
  puts raw_data unless opts['quiet']
end

#versionObject



34
35
36
# File 'lib/stockcruncher/cli.rb', line 34

def version
  puts "StockCruncher version #{StockCruncher::VERSION}"
end