Update README.md
Browse files
README.md
CHANGED
|
@@ -1,116 +1,32 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
> **Hackathon Project** | Built in 48 hours
|
| 4 |
-
|
| 5 |
-
##π€ Elevator Pitch (30 seconds)
|
| 6 |
-
|
| 7 |
-
*"StockSense AI uses deep learning and NLP to predict stock prices 5 days ahead.
|
| 8 |
Enter any ticker β our LSTM model analyzes 2 years of market data and technical
|
| 9 |
indicators, while FinBERT reads the latest financial news to gauge market
|
| 10 |
sentiment. You get an interactive chart with predictions, a confidence score,
|
| 11 |
-
a risk level, and a clear sentiment breakdown β all in seconds."
|
| 12 |
-
|
| 13 |
-
---
|
| 14 |
-
|
| 15 |
-
## π Quick Start
|
| 16 |
-
|
| 17 |
-
### Prerequisites
|
| 18 |
-
- Python 3.10+
|
| 19 |
-
- Node.js (optional β only if you want a dev server for frontend)
|
| 20 |
-
- ~2 GB disk for FinBERT model weights (auto-downloaded)
|
| 21 |
-
|
| 22 |
-
### 1. Backend Setup
|
| 23 |
-
|
| 24 |
-
```bash
|
| 25 |
-
cd backend
|
| 26 |
python -m venv venv
|
| 27 |
source venv/bin/activate # Windows: venv\Scripts\activate
|
| 28 |
pip install -r requirements.txt
|
| 29 |
uvicorn app:app --reload --port 8000
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
The API will be live at **http://localhost:8000**.
|
| 33 |
-
|
| 34 |
-
### 2. Frontend Setup
|
| 35 |
-
|
| 36 |
-
Simply open `frontend/index.html` in your browser, **or** serve it:
|
| 37 |
-
|
| 38 |
-
```bash
|
| 39 |
-
cd frontend
|
| 40 |
python -m http.server 3000
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
Then visit **http://localhost:3000**.
|
| 44 |
-
|
| 45 |
-
---
|
| 46 |
-
|
| 47 |
-
## π API Endpoints
|
| 48 |
-
|
| 49 |
-
| Method | Endpoint | Description |
|
| 50 |
-
|--------|----------------------------|------------------------------------|
|
| 51 |
-
| GET | `/api/stock/{ticker}` | Historical data + indicators |
|
| 52 |
-
| GET | `/api/predict/{ticker}` | LSTM 5-day price prediction |
|
| 53 |
-
| GET | `/api/sentiment/{ticker}` | FinBERT news sentiment analysis |
|
| 54 |
-
| GET | `/api/summary/{ticker}` | Combined analysis (all of above) |
|
| 55 |
-
|
| 56 |
-
---
|
| 57 |
-
|
| 58 |
-
## ποΈ Architecture
|
| 59 |
-
|
| 60 |
-
```
|
| 61 |
-
User β React/HTML Frontend β FastAPI Backend
|
| 62 |
βββ yfinance (stock data)
|
| 63 |
βββ ta (technical indicators)
|
| 64 |
βββ PyTorch LSTM (price prediction)
|
| 65 |
βββ FinBERT (sentiment analysis)
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
## π§ ML Pipeline
|
| 71 |
-
|
| 72 |
-
1. **Data**: 2 years of daily OHLCV via Yahoo Finance
|
| 73 |
-
2. **Features**: Close price (normalized via MinMaxScaler)
|
| 74 |
-
3. **Model**: 2-layer LSTM (64 hidden units) β FC β 5-day output
|
| 75 |
-
4. **Training**: 30 epochs, Adam optimizer, MSE loss, 85/15 train/test split
|
| 76 |
-
5. **Inference**: Last 60-day window β next 5 closing prices
|
| 77 |
-
|
| 78 |
-
---
|
| 79 |
-
|
| 80 |
-
## βοΈ Deployment (Optional)
|
| 81 |
-
|
| 82 |
-
### Docker
|
| 83 |
-
|
| 84 |
-
```dockerfile
|
| 85 |
-
FROM python:3.11-slim
|
| 86 |
WORKDIR /app
|
| 87 |
COPY backend/ .
|
| 88 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 89 |
EXPOSE 8000
|
| 90 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
```bash
|
| 94 |
-
docker build -t stocksense-ai .
|
| 95 |
docker run -p 8000:8000 stocksense-ai
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
### Cloud (Render / Railway / Fly.io)
|
| 99 |
-
1. Push to GitHub
|
| 100 |
-
2. Connect repo on Render β set build command: `pip install -r requirements.txt`
|
| 101 |
-
3. Set start command: `uvicorn app:app --host 0.0.0.0 --port 8000`
|
| 102 |
-
|
| 103 |
-
---
|
| 104 |
-
|
| 105 |
-
## β οΈ Disclaimer
|
| 106 |
-
|
| 107 |
-
This project is for **educational and hackathon demonstration purposes only**.
|
| 108 |
-
Stock market predictions generated by this tool are **not financial advice**.
|
| 109 |
-
Past performance does not guarantee future results. Always consult a qualified
|
| 110 |
-
financial advisor before making investment decisions.
|
| 111 |
|
| 112 |
---
|
| 113 |
|
| 114 |
## π License
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
| 1 |
+
π StockSense AI β AI-Powered Stock Market PredictionHackathon Project | Built in 48 hoursπ€ Elevator Pitch (30 seconds)"StockSense AI uses deep learning and NLP to predict stock prices 5 days ahead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
Enter any ticker β our LSTM model analyzes 2 years of market data and technical
|
| 3 |
indicators, while FinBERT reads the latest financial news to gauge market
|
| 4 |
sentiment. You get an interactive chart with predictions, a confidence score,
|
| 5 |
+
a risk level, and a clear sentiment breakdown β all in seconds."π Quick StartPrerequisitesPython 3.10+Node.js (optional β only if you want a dev server for frontend)~2 GB disk for FinBERT model weights (auto-downloaded)1. Backend SetupBashcd backend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
python -m venv venv
|
| 7 |
source venv/bin/activate # Windows: venv\Scripts\activate
|
| 8 |
pip install -r requirements.txt
|
| 9 |
uvicorn app:app --reload --port 8000
|
| 10 |
+
The API will be live at http://localhost:8000.2. Frontend SetupSimply open frontend/index.html in your browser, or serve it:Bashcd frontend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
python -m http.server 3000
|
| 12 |
+
Then visit http://localhost:3000.π API EndpointsMethodEndpointDescriptionGET/api/stock/{ticker}Historical data + indicatorsGET/api/predict/{ticker}LSTM 5-day price predictionGET/api/sentiment/{ticker}FinBERT news sentiment analysisGET/api/summary/{ticker}Combined analysis (all of above)ποΈ ArchitecturePlaintextUser β React/HTML Frontend β FastAPI Backend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
βββ yfinance (stock data)
|
| 14 |
βββ ta (technical indicators)
|
| 15 |
βββ PyTorch LSTM (price prediction)
|
| 16 |
βββ FinBERT (sentiment analysis)
|
| 17 |
+
π§ ML PipelineData: 2 years of daily OHLCV via Yahoo Finance.Features: Close price (normalized via MinMaxScaler).Model: 2-layer LSTM (64 hidden units) β FC β 5-day output.Training: 30 epochs, Adam optimizer, MSE loss, 85/15 train/test split.Inference: Last 60-day window β next 5 closing prices.βοΈ Deployment (Optional)DockerDockerfileFROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
WORKDIR /app
|
| 19 |
COPY backend/ .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
EXPOSE 8000
|
| 22 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 23 |
+
Bashdocker build -t stocksense-ai .
|
|
|
|
|
|
|
|
|
|
| 24 |
docker run -p 8000:8000 stocksense-ai
|
| 25 |
+
Cloud (Render / Railway / Fly.io)Push to GitHub.Connect repo on Render β set build command: pip install -r requirements.txtSet start command: uvicorn app:app --host 0.0.0.0 --port 8000β οΈ DisclaimerThis project is for educational and hackathon demonstration purposes only.Stock market predictions generated by this tool are not financial advice.Past performance does not guarantee future results. Always consult a qualifiedfinancial advisor before making investment decisions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
---
|
| 28 |
|
| 29 |
## π License
|
| 30 |
|
| 31 |
+
|
| 32 |
+
MIT β feel free to fork and improve!
|