Split the AlphaVantage stock script into 2 scripts. One to make the API calls to AlphaVantage (this runs infrequently due to rate limit of free API keys) and saves the retrieved JSON files to cache. The other script can run more frequently and scans the cache dir for updated JSON files, and returns the formatted stock data to Conky.

This commit is contained in:
Matthew Grotke 2026-01-15 23:47:22 -05:00
parent 6b04d9296a
commit fa2717e1f7
3 changed files with 209 additions and 165 deletions

4
conf
View file

@ -30,6 +30,7 @@
-- chmod +x ~/.conky/mgconky/weather/parse_weather.sh
-- chmod +x ~/.conky/mgconky/weather/parse_forecast.sh
-- chmod +x ~/.conky/mgconky/stocks/get_stocks_alphavantage.py
-- chmod +x ~/.conky/mgconky/stocks/process_stocks_alphavantage.py
-- chmod +x ~/.conky/mgconky/stocks/get_stocks_finnhub.py
-- (4) WEATHER.
-- Make a free account at https://openweathermap.org/
@ -178,7 +179,8 @@ ${voffset -6}${execpi 60 $HOME/.conky/mgconky/stocks/get_stocks_finnhub.py --api
${endif}
# ***** Alpha Vantage API *****
${if_match "${template5}" != "YOUR_ALPHAVANTAGE_API_KEY_HERE"}
${voffset -12}${execpi 43200 $HOME/.conky/mgconky/stocks/get_stocks_alphavantage.py --api_key ${template5} --symbols ${template7} --range_in_days 30 --price_dec_places 0 --percent_dec_places 1}
${execpi 43200 $HOME/.conky/mgconky/stocks/get_stocks_alphavantage.py --api_key ${template5} --symbols ${template7} --range_in_days 30}
${voffset -12}${execpi 60 $HOME/.conky/mgconky/stocks/process_stocks_alphavantage.py --symbols ${template7} --range_in_days 30 --price_dec_places 0 --percent_dec_places 1 --stale_seconds 43200}
${endif}
#
#--------------------------