Class: StockCruncher::CLI
- Inherits:
-
Thor
- Object
- Thor
- StockCruncher::CLI
- Defined in:
- lib/stockcruncher/cli.rb
Overview
Simple CLI for StockCruncher
Instance Method Summary collapse
Instance Method Details
#daily(symbol) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/stockcruncher/cli.rb', line 48 def daily(symbol) opts = .dup config = YAML.load_file(opts['config']) cruncher = StockCruncher::AlphaVantage.new(config, opts['insecure']) data = cruncher.crunch_daily(symbol, opts['full']) StockCruncher::InfluxDB.new(config).export_history(symbol, data) puts JSON.pretty_generate(data) unless opts['quiet'] end |
#movingaverages(symbol) ⇒ Object
66 67 68 69 70 |
# File 'lib/stockcruncher/cli.rb', line 66 def movingaverages(symbol) opts = .dup config = YAML.load_file(opts['config']) StockCruncher::InfluxDB.new(config).moving_averages(symbol, opts['all']) end |
#quote(symbol) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/stockcruncher/cli.rb', line 74 def quote(symbol) opts = .dup config = StockCruncher::Config.load(opts['config']) cruncher = StockCruncher::AlphaVantage.new(config, opts['insecure']) data = cruncher.crunch_quote(symbol) StockCruncher::InfluxDB.new(config).export_last_day(data) puts JSON.pretty_generate(data) unless opts['quiet'] end |
#version ⇒ Object
35 36 37 |
# File 'lib/stockcruncher/cli.rb', line 35 def version puts "StockCruncher version #{StockCruncher::VERSION}" end |