Script to get Stock History Information

I wrote a python script to get stock market current and history information based on Google finance API. Here I am going to explain about that.

How to setup

  • Download GetStockInfo.py into /usr/local/bin folder as stockinfo
  • chmod +x /usr/local/bin/stockinfo
  • Run stockinfo as command from anywhere in your terminal
  • I create alias command with different stock list and get info whenever I want
wget --no-check-certificate https://gist.github.com/arulrajnet/cb1476234967717a4d6d/raw/GetStockInfo.py
chmod +x GetStockInfo.py
sudo cp GetStockInfo.py /usr/local/bin/stockinfo

To get given stock current and history information

stockinfo -s NASDAQ:AAPL,NASDAQ:GOOG,NASDAQ:MSFT,INDEXBOM:SENSEX -i 7d,1m,1y

Instead of you can use

python GetStockInfo.py -s NASDAQ:AAPL,NASDAQ:GOOG,NASDAQ:MSFT,INDEXBOM:SENSEX -i 7d,1m,1y

Stock Info with Stock and Interval Selection

To get given stock current information

stockinfo -s NASDAQ:AAPL,NASDAQ:GOOG,NASDAQ:MSFT,INDEXBOM:SENSEX

Stock Info with Stock Selection only

To get default stock current information

stockinfo

Stock Info with default stock

To get default stock current and history information

stockinfo -i 7d,1m

stock info with interval selection only

License

Free to copy paste. Back-link to this post if you are good coder :wink:

Show Comments