yflive is a Yahoo! Finance live data streamer. Originally created as an alternative to scraping prices of Yahoo! Finance, yflive implements a websocket client for receiving live quotes from Yahoo! Finance directly.
For historic prices or other financial information, yfinance is recommended.
Use the package manager pip to install yflive.
pip install yflive
The following example shows a simple setup, which subscribes to the tickers AAPL and TSLA and prints received quotes until interrupted.
from yflive import QuoteStreamer
qs = QuoteStreamer()
qs.subscribe(["AAPL", "TSLA"])
qs.on_quote = lambda qs, q: print(q)
# Non-blocking if should_thread=True (default is False)
qs.start(should_thread=False)
Quotes are in real time (with exceptions) and normally only available during trading hours.
For additional information regarding Yahoo! Finance data, please refer to their section on data accuracy found here.
This is very early stage
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
yflive is distributed under the Apache-2.0 License. Review LICENSE.txt for further information.