151 lines
5.9 KiB
Markdown
151 lines
5.9 KiB
Markdown
<p align="center">
|
|
<h1 align="center">π FinanceIQ</h1>
|
|
<p align="center">
|
|
<strong>Real-time Financial Analytics & Portfolio Simulation Platform</strong>
|
|
</p>
|
|
<p align="center">
|
|
<img src="https://img.shields.io/badge/python-3.10+-blue?style=flat-square&logo=python" alt="Python">
|
|
<img src="https://img.shields.io/badge/flask-3.x-green?style=flat-square&logo=flask" alt="Flask">
|
|
<img src="https://img.shields.io/badge/version-5.2-purple?style=flat-square" alt="Version">
|
|
<img src="https://img.shields.io/badge/license-MIT-yellow?style=flat-square" alt="License">
|
|
</p>
|
|
</p>
|
|
|
|
---
|
|
|
|
A full-stack financial analytics web application built with **Flask**, **yfinance**, and **Google Gemini AI**. Features interactive charting, professional-grade portfolio simulation, options pricing, backtesting, AI-driven advisory, and a live market dashboard β all in a sleek, responsive single-page dashboard.
|
|
|
|
## β¨ Features
|
|
|
|
### π Market Analysis
|
|
- **Interactive Candlestick Charts** β powered by TradingView Lightweight Charts
|
|
- **Technical Indicators** β RSI, MACD, Bollinger Bands, SMA/EMA, ATR, Stochastic
|
|
- **Candlestick Pattern Recognition** β Doji, Hammer, Engulfing, Morning Star, and more
|
|
- **Key Financial Metrics** β P/E, ROE, D/E, Quick Ratio, Dividend Yield
|
|
- **Sector Peer Comparison** β heatmap of competitors across 7 sectors
|
|
- **Valuation Models** β DCF, Graham Number, PEG Ratio, DDM
|
|
|
|
### πΌ Portfolio Simulation
|
|
- **$100K Paper Trading** β buy/sell with real-time prices from Yahoo Finance
|
|
- **Advanced Order Types** β Market, Limit, and Stop orders
|
|
- **Short Selling** β open and cover short positions with margin tracking
|
|
- **Slippage & Commission Modeling** β realistic IBKR-style execution costs
|
|
- **Equity Curve** β track portfolio value over time with interactive charts
|
|
- **Performance Analytics** β Sharpe, Sortino, Calmar ratios, profit factor, max drawdown
|
|
|
|
### π― Options Pricing
|
|
- **Black-Scholes Model** β call/put pricing with real-time IV
|
|
- **Greeks Dashboard** β Delta, Gamma, Theta, Vega, Rho
|
|
- **Monte Carlo Simulation** β 10,000-path price projections
|
|
- **Interactive Payoff Charts** β visualize P&L at expiration
|
|
|
|
### π€ AI-Powered Advisory
|
|
- **Gemini AI Integration** β personalized investment analysis
|
|
- **Macro Dashboard** β Fed rates, Treasury yields, VIX, DXY, oil, gold
|
|
- **Risk Assessment** β automated risk scoring with traffic-light indicators
|
|
- **Natural Language Insights** β ask questions about any stock
|
|
|
|
### π° News & Sentiment
|
|
- **Real-time News Feed** β latest headlines for any ticker
|
|
- **AI Sentiment Analysis** β bullish/bearish/neutral classification
|
|
- **Currency Converter** β 150+ currency pairs with live rates
|
|
|
|
### π¬ Backtesting Engine
|
|
- **Strategy Backtester** β SMA crossover, RSI, MACD, Bollinger Band strategies
|
|
- **Bi-directional Trading** β long and short strategy support
|
|
- **Performance Metrics** β Sharpe ratio, win rate, max drawdown, trade log
|
|
|
|
### π Market Dashboard
|
|
- **Global Indices** β S&P 500, NASDAQ, Dow, FTSE, Nikkei, DAX
|
|
- **Commodities** β Gold, Silver, Crude Oil, Natural Gas
|
|
- **Currency Pairs** β EUR/USD, GBP/USD, USD/JPY, and more
|
|
- **Live Pulse** β auto-refreshing with animated counters
|
|
|
|
## π Quick Start
|
|
|
|
### Prerequisites
|
|
- Python 3.10+
|
|
- Google Gemini API key ([Get one here](https://makersuite.google.com/app/apikey))
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Clone the repo
|
|
git clone https://github.com/vanshshah10002-prog/FinanceIQ.git
|
|
cd FinanceIQ
|
|
|
|
# Install dependencies
|
|
pip install -r requirements.txt
|
|
|
|
# Set up environment variables
|
|
cp .env.example .env
|
|
# Edit .env and add your GEMINI_API_KEY
|
|
|
|
# Run the application
|
|
python app.py
|
|
```
|
|
|
|
Then open `http://localhost:5000` in your browser.
|
|
|
|
## π Project Structure
|
|
|
|
```
|
|
FinanceIQ/
|
|
βββ app.py # Flask server & API routes
|
|
βββ portfolio_engine.py # Portfolio simulation engine (SQLite-backed)
|
|
βββ options_engine.py # Black-Scholes, Greeks, Monte Carlo
|
|
βββ backtester.py # Strategy backtesting engine
|
|
βββ advisor.py # Gemini AI financial advisory
|
|
βββ technical_analyzer.py # Technical indicators & patterns
|
|
βββ news_analyzer.py # News fetching & sentiment analysis
|
|
βββ requirements.txt # Python dependencies
|
|
βββ .env.example # Environment variable template
|
|
βββ templates/
|
|
β βββ index.html # Single-page dashboard UI
|
|
βββ static/
|
|
βββ script.js # Frontend logic & chart rendering
|
|
βββ style.css # Glassmorphism UI design system
|
|
```
|
|
|
|
## π οΈ Tech Stack
|
|
|
|
| Layer | Technology |
|
|
|-------|-----------|
|
|
| **Backend** | Flask, Python 3.10+ |
|
|
| **Data** | yfinance, Yahoo Finance API |
|
|
| **AI** | Google Gemini 2.0 Flash |
|
|
| **Database** | SQLite (WAL mode) |
|
|
| **Charts** | TradingView Lightweight Charts |
|
|
| **Frontend** | Vanilla JS, CSS (Glassmorphism) |
|
|
|
|
## π API Endpoints
|
|
|
|
| Endpoint | Method | Description |
|
|
|----------|--------|-------------|
|
|
| `/api/analyze` | POST | Full stock analysis |
|
|
| `/api/suggest` | GET | Ticker autocomplete |
|
|
| `/api/portfolio` | GET | Portfolio summary |
|
|
| `/api/portfolio/buy` | POST | Buy long |
|
|
| `/api/portfolio/sell` | POST | Sell long |
|
|
| `/api/portfolio/short` | POST | Short sell |
|
|
| `/api/portfolio/cover` | POST | Cover short |
|
|
| `/api/portfolio/limit-order` | POST | Place limit order |
|
|
| `/api/portfolio/stop-order` | POST | Place stop order |
|
|
| `/api/portfolio/analytics` | GET | Performance metrics |
|
|
| `/api/portfolio/equity-curve` | GET | Equity curve data |
|
|
| `/api/market-summary` | GET | Market dashboard data |
|
|
| `/api/options/price` | POST | Options pricing |
|
|
| `/api/backtest` | POST | Run backtests |
|
|
| `/api/advisor/analyze` | POST | AI advisory |
|
|
| `/api/news` | GET | News & sentiment |
|
|
|
|
## π License
|
|
|
|
This project is for educational purposes. Built as part of a university finance course.
|
|
|
|
---
|
|
|
|
<p align="center">
|
|
Built with β€οΈ using Flask & yfinance
|
|
</p>
|