In this project, I've created a stock screener web application using FastAPI (a new Python framework built on Starlette) by following along with Part Time Larry's "FastAPI Python Tutorial - Building a Stock Screener with FastAPI" videos on youtube. The project utilizes many of the FastAPI features including pydantic models, dependency injection, background/async tasks, and SQLAlchemy integration. API endpoint testing was done using Insomnia API client.
The frontend UI design is done using SemanticUI and Jinja2 templates, including CSS and JavaScript from the CDN.
The database design is done using SQLAlchemy models. The database has one table 'stocks.db' that holds stock data retrieved programmatically as a background task to prevent UI hang from yahoo finance (yfinance package).
Install required packages using pip install -r requirements.txt
.
Run the app by executing ./run
in the terminal.
Open the app by going to http://localhost:8000/
in your browser.
Click the Add Stocks
button and then type in a list of stock ticker symbols. The app will then fetch up-to-date data on each ticker and insert into a local database stocks.db
.
Screen stocks from those in the database by using the filters for price
, forward price-to-earnings ratio
, forward earnings-per-share ratio
, dividend yield
,50 day moving average
, and 200 day moving average
.
- Python
- FastAPI
- SemanticUI
- Jinja2
- SQLAlchemy
- Pydantic
Paden Roder
Contributions, issues, and feature requests are welcome!
Give a ⭐️ if you like this project!