class StockCruncher::CLI
Simple CLI
for StockCruncher
Public Instance Methods
daily(symbol)
click to toggle source
# File lib/stockcruncher/cli.rb, line 55 def daily(symbol) opts = options.dup config = YAML.load_file(opts['config']) cruncher = StockCruncher::AlphaVantage.new(config, opts['insecure']) data = cruncher.crunch_daily(symbol, opts['full']) influx = StockCruncher::InfluxDB.new(config) influx.export_history(symbol, data, opts['catchup']) puts JSON.pretty_generate(data) unless opts['quiet'] end
movingaverages(symbol)
click to toggle source
# File lib/stockcruncher/cli.rb, line 81 def movingaverages(symbol) opts = options.dup config = YAML.load_file(opts['config']) influx = StockCruncher::InfluxDB.new(config) influx.moving_averages(symbol, opts['all'], opts['catchup']) end
quote(symbol)
click to toggle source
# File lib/stockcruncher/cli.rb, line 90 def quote(symbol) opts = options.dup config = StockCruncher::Config.load(opts['config']) cruncher = StockCruncher::AlphaVantage.new(config, opts['insecure']) data = cruncher.crunch_quote(symbol) influx = StockCruncher::InfluxDB.new(config) influx.export_last_day(data) puts JSON.pretty_generate(data) unless opts['quiet'] end
version()
click to toggle source
# File lib/stockcruncher/cli.rb, line 35 def version puts "StockCruncher version #{StockCruncher::VERSION}" end