A comprehensive Django web application for financial data analysis and stock portfolio management. This application fetches real-time financial data from Yahoo Finance, calculates custom financial scores, and provides an intuitive interface for organizing and analyzing stock investments.
- Real-time Stock Data: Fetch current financial metrics from Yahoo Finance API
- Custom Financial Scoring: Proprietary algorithm that evaluates stocks based on multiple financial indicators
- Category Management: Organize stocks into custom categories for better portfolio management
- Data Visualization: Clean, sortable tables displaying comprehensive financial metrics
- Bulk Operations: Add multiple stocks simultaneously and perform batch operations
- Debt to Equity Ratio: Company's financial leverage
- Insider Holdings: Percentage of shares held by company insiders
- Price Analysis: Current price vs. target price with upside calculation
- Valuation Ratios: Trailing and forward P/E ratios
- Earnings Data: Trailing and forward earnings per share (EPS)
- Profitability Metrics: Return on Assets (ROA), Return on Equity (ROE), and profit margins
- Custom Score: Weighted composite score based on all financial factors
- Interactive Tables: Sort by any financial metric
- Category Filtering: View stocks by category or all stocks
- Bulk Selection: Select multiple stocks for batch operations
- Real-time Updates: Refresh financial data with a single click
- Responsive Design: Works on desktop and mobile devices
- Backend: Django 5.0
- Database: MySQL (configured for production) / SQLite (development)
- Financial Data API: Yahoo Finance via
yfinancelibrary - Data Processing: pandas, numpy
- Frontend: HTML5, CSS3, JavaScript
- Web Scraping: BeautifulSoup4, lxml
- HTTP Requests: requests library
- Python 3.8+
- MySQL (for production) or SQLite (for development)
- Internet connection (for fetching financial data)
git clone https://github.com/Juanpa0128j/FinancialDataApp.git
cd FinancialDataApppython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtUpdate webSite/settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}The application is pre-configured for MySQL. Update the database credentials in webSite/settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'your_database_name',
'HOST': 'your_host',
'USER': 'your_username',
'PASSWORD': 'your_password',
'PORT': 3306,
}
}python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverVisit http://127.0.0.1:8000 to access the application.
- Single Stock: Enter a stock symbol (e.g., "AAPL") in the create tag form
- Multiple Stocks: Enter comma-separated symbols (e.g., "AAPL, GOOGL, MSFT")
- The application will automatically fetch financial data and calculate scores
- Create Category: Use the dropdown menu to add new categories
- Add Stocks to Category: Select stocks and choose target categories
- Transfer Between Categories: Move stocks from one category to another
- Delete Categories: Remove categories and their associations
- Sorting: Click on any column header to sort by that metric
- Filtering: Use category dropdown to filter stocks
- Updating: Click "Update data from tag/s" to refresh financial information
- Custom Score: Higher scores indicate better financial performance based on the algorithm
The custom scoring algorithm evaluates stocks based on:
- Debt Management: Lower debt-to-equity ratios score higher
- Insider Confidence: Higher insider ownership indicates confidence
- Growth Potential: Positive difference between target and current price
- Valuation: Reasonable P/E ratios and improving earnings
- Profitability: Strong ROA, ROE, and profit margins
FinancialDataApp/
โโโ manage.py # Django management script
โโโ requirements.txt # Python dependencies
โโโ webSite/ # Django project settings
โ โโโ settings.py # Application configuration
โ โโโ urls.py # URL routing
โ โโโ wsgi.py # WSGI configuration
โโโ webApp/ # Main application
โโโ models.py # Database models (Tag, Category)
โโโ views.py # Business logic and request handling
โโโ forms.py # Django forms
โโโ admin.py # Django admin configuration
โโโ cron.py # Scheduled tasks
โโโ templates/ # HTML templates
โ โโโ home.html # Main dashboard
โ โโโ create_tag.html # Stock creation form
โ โโโ ...
โโโ static/ # CSS, JavaScript, images
โ โโโ css/
โ โโโ js/
โ โโโ favicon.png
โโโ yahoo_query/ # Financial data fetching module
โโโ financial_analysis.py
/- Main dashboard (home)/create_tag/- Add new stocks/visualize_category/- Filter by category/delete_tag/- Remove stocks/delete_category/- Remove categories/tag_ordering/- Sort functionality/update_tag/- Refresh financial data/add_tag_to_category/- Category management/transfer_tag_between_categories/- Move stocks between categories
The application is pre-configured for PythonAnywhere deployment:
- Upload code to PythonAnywhere
- Configure MySQL database
- Update
ALLOWED_HOSTSin settings.py - Set up static files serving
- Configure WSGI file
For deployment on other platforms:
- Update
ALLOWED_HOSTSin settings.py - Configure database settings
- Set
DEBUG = Falsefor production - Configure static files serving
- Set up environment variables for sensitive data
Create a .env file:
SECRET_KEY=your-secret-key
DEBUG=False
DATABASE_URL=mysql://user:password@host:port/database
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
The application includes a cron job script (webApp/cron.py) for automated data updates. Configure your server's cron to run:
0 9 * * 1-5 python /path/to/your/app/webApp/cron.py- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
This application is for educational and informational purposes only. The financial data and scores provided should not be considered as investment advice. Always consult with qualified financial advisors before making investment decisions.
- Financial data depends on Yahoo Finance API availability
- Some stocks may not have complete financial data
- Scores are calculated based on available data only
For support, please open an issue on GitHub or contact the development team.
- Add more financial metrics and ratios
- Implement user authentication and personal portfolios
- Add data visualization charts and graphs
- Include news sentiment analysis
- Add export functionality (CSV, PDF)
- Implement real-time price alerts
- Add mobile app support
- Include cryptocurrency support
Built with โค๏ธ for financial analysis enthusiasts