This small project uses the Yahoo stock API to fetch and retrieve stock prices for Conky
As you can see, the script is named 'conkystocks.py' and should be placed in your $HOME/.conky directory. It has been tested on Python 3.5 on Linux and imports 'json' and 'urllib'.
As far as I can tell, api.iextrading.com does not support the Dow Jones Index or S&P 500. However, it does support the related ETFs DIA and SPY. For these two symbols conkystock.py will convert them to the approximate price and change of the indexes if the "CONVERT_FUNDS_TO_INDEXES" in conkystocks.py is set to True.
To define which stocks are fetched, put your stock symbols in the stocks.json file in the JSON array, like so:
{
"stocks" : ["dia", "nvda", "jcap", "tsm", "msft", "fxf", "sds"]
}
The stocks.json file should be colocated with conkystocks.py in your $HOME/.conky directory.
Typically used with execi like so:
${execpi 60 ./conkystocks.py | column -t}