diff options
author | Paul Duncan <pabs@pablotron.org> | 2020-03-06 20:00:14 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2020-03-06 20:00:14 -0500 |
commit | 11bcdbc1070552dfc99df332d554e99057281d1b (patch) | |
tree | e2ac14edb6709555008eea76bc439ea83a27576c /bin | |
parent | b6df5d6739975848fc10893700d78cdd616a0c96 (diff) | |
download | alonzo-mood-calculator-11bcdbc1070552dfc99df332d554e99057281d1b.tar.bz2 alonzo-mood-calculator-11bcdbc1070552dfc99df332d554e99057281d1b.zip |
asdf
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/get-stock.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/get-stock.py b/bin/get-stock.py new file mode 100755 index 0000000..334cab6 --- /dev/null +++ b/bin/get-stock.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +# +# get-stock.py: fetch current stock ticker information and write it to +# as JSON to standard output. +# +# Usage: +# +# # fetch current google price and write it to current.json +# get-stock.py GOOG > current.json +# + +import sys +import json +import yfinance + +# check command-line arguments +if len(sys.argv) < 2: + raise RuntimeError('missing code') + +# get ticker info, convert to json, print to stdout +print(json.dumps(yfinance.Ticker(sys.argv[1]).info)) |