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
55 56 57 58 59 60 61 62 63 |
# File 'lib/stockcruncher/cli.rb', line 55 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']) influx = StockCruncher::InfluxDB.new(config) influx.export_history(symbol, data, opts['catchup']) puts JSON.pretty_generate(data) unless opts['quiet'] end |
#movingaverages(symbol) ⇒ Object
81 82 83 84 85 86 |
# File 'lib/stockcruncher/cli.rb', line 81 def movingaverages(symbol) opts = .dup config = YAML.load_file(opts['config']) influx = StockCruncher::InfluxDB.new(config) influx.moving_averages(symbol, opts['all'], opts['catchup']) end |
#quote(symbol) ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/stockcruncher/cli.rb', line 90 def quote(symbol) opts = .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 ⇒ Object
35 36 37 |
# File 'lib/stockcruncher/cli.rb', line 35 def version puts "StockCruncher version #{StockCruncher::VERSION}" end |