Friday, March 23, 2018

marquery.py - Check stocks, crypto currency prices and foreign exchange rates quickly

Each and every time I want to see what is the current value of BTC or ETH, or check specific stock price, I have to fire up my browser and visit exchange site to get latest market trends.
For someone who is used to terminal, I would prefer to type a command, couple of switches and get what I need. And since I couldn't find anything similar, I decided to write the tool that would do exactly that: query free (and updated) API and display data that I need. Or maybe write JSON response to file that I would use later on.
That is how marquery.py was born. It is 6k python script that queries AlphaVantage API (be sure to get the free API key) and enables you to search for specific stock price, checks current price of crypto currency, and gets current foreign exchange rates.
You can get it from my GitHub. After cloning, run python3 marquery.py -h (or chmod it to become executable) to see available positional and optional arguments:


So, if I want to check how the current Facebook stocks are going (with all this Cambridge Analytica stuff they are really hot right now), I would type python3 marquery.py -s FB:


Let's say I have invested some money into Bitcoin and want to see what is the current price (python3 marquery.py -c BTC):


Or if I want to see what is the current USD to BAM ratio (python3 marquery.py -f USD BAM):


Feel free to explore other switches. I find it very handy. And if you find it interesting, fork it! Ncurses-based continuous watch list feature would be nice... 

No comments:

Post a Comment