Financial Stock Screener
A powerful financial stock screening application that allows users to create custom screens based on various financial metrics and criteria. The application integrates with Yahoo Finance to provide real-time stock data and historical price information.
Features
- 🔐 User Authentication: Secure user registration and login system
- 📊 Stock Data: Real-time stock information from Yahoo Finance
- 🔍 Custom Screens: Create and save custom stock screening criteria
- 📈 Historical Data: Access historical price data for stocks
- 👥 Public/Private Screens: Share your screens with other users or keep them private
- 📱 RESTful API: Well-documented API for easy integration\
Tech Stack
- Backend: FastAPI (Python)
- Database: SQLite
- Authentication: JWT
- Stock Data: Yahoo Finance API
- Documentation: OpenAPI/Swagger
Prerequisites
- Python 3.8+
- pip (Python package manager)
- SQLite3
Installation
- Clone the repository:
git clone https://github.com/garbhitsh/Financialbackend.git
cd financial-screener- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .envEdit .env file with your configuration.
- Initialize the database:
python app/scripts/init_db.py- Populate initial stock data:
python app/scripts/populate_stocks.pyRunning the Application
- Start the development server:
uvicorn app.main:app --reload- Access the API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Documentation
The API documentation is available in two formats:
- API Documentation: Detailed API endpoint documentation
- Architecture Documentation: System architecture and design
Project Structure
financial-screener/
├── app/
│ ├── api/
│ │ └── v1/
│ │ ├── endpoints/
│ │ └── api.py
│ ├── core/
│ │ ├── config.py
│ │ └── security.py
│ ├── db/
│ │ └── base.py
│ ├── models/
│ │ ├── stock.py
│ │ ├── screen.py
│ │ └── user.py
│ ├── schemas/
│ │ ├── stock.py
│ │ ├── screen.py
│ │ └── user.py
│ ├── services/
│ │ ├── stock_service.py
│ │ ├── screen_service.py
│ │ └── yfinance_service.py
│ └── scripts/
│ ├── init_db.py
│ └── populate_stocks.py
├── tests/
├── .env.example
├── requirements.txt
└── README.md
Available Screen Criteria
The application supports screening based on the following metrics:
- Market Capitalization
- P/E Ratio
- Price
- Price to Book Ratio
- Dividend Yield
- EPS (Earnings per Share)
- Beta
- 52-Week High/Low
- Average Volume
Example Usage
- Register a new user:
curl -X POST http://localhost:8000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "securepassword", "full_name": "John Doe"}'- Create a screen:
curl -X POST http://localhost:8000/api/v1/screens \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Value Stocks",
"description": "Stocks with low P/E ratio and high dividend yield",
"is_public": false,
"criteria": [
{
"field": "pe_ratio",
"operator": "<",
"value": 15
},
{
"field": "dividend_yield",
"operator": ">",
"value": 3.0
}
]
}'- Run a screen:
curl -X POST http://localhost:8000/api/v1/screens/1/run \
-H "Authorization: Bearer <your_token>"Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
Testing
Run the test suite:
pytestSecurity
- All passwords are hashed using bcrypt
- JWT tokens are used for authentication
- Rate limiting is implemented to prevent abuse
- Input validation is performed on all endpoints
- SQL injection prevention through SQLAlchemy
Performance
- Database queries are optimized with proper indexing
- Response caching for frequently accessed data
- Pagination for large datasets
- Efficient data serialization
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please open an issue in the GitHub repository or contact the maintainers.
Acknowledgments
- Yahoo Finance for providing stock data
- FastAPI for the excellent web framework
- SQLAlchemy for the ORM
- All contributors who have helped with the project
On this page
Languages
Python99.6%Dockerfile0.4%TypeScript0.0%
Contributors
Created May 7, 2025
Updated May 7, 2025
