A simple python function for getting free real-time stock prices
Intraday stock prices is a Python function that you may easily use within your financial applications. It allows you to get free and real-time stock prices, of compagnies all aound the world.
The function uses Google's financial data to provide the stock information. It is simple to use, to customise and to maintain.
Intraday stock prices scans the stock data you're looking for from Google's research page. It then converts,reads and filters such data in order to give you the stock current price as an integer object.
The function requieres additional libraries and tools to scan, convert and process the data :
-
Wkhtmltopdf (https://wkhtmltopdf.org/) : a tool for taking screenshots of a specific website and saving them as image files
-
The Imgkit python library (https://pypi.org/project/imgkit/) : a wkhtmltopdf python wrapper
-
Google's Tesseract-OCR (https://github.com/tesseract-ocr/tesseract) : a tool for converting an image's content to text data
-
The Pytesseract library (https://pypi.org/project/pytesseract/): a Google's Tesseract-OCR python wrapper
You will first need to download and install the previously mentionned tools and libraries. Depending on your installation paths, you may need to update the function code :
You may then call the function from your program, specifying which compagnie's stock price you would like to have.
Please consider the following subjects :
-
the function argument should be a string. You are however free to type the compagny's name or its stock ticker.
-
The result display may take few seconds, since it is using the Google's Tesseract-OCR application to convert the screenshot to textual data.
Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.
This project is GPL-3.0 licensed.