This repo helps you get up and running quickly with the FNSPID Financial News & Stock Price Integration Dataset.
- Download the dataset from Hugging Face (non-commercial use) and/or the authors' GitHub.
- Ingest news & prices, align by time (avoid leakage), map to tickers.
- Score sentiment (FinBERT baseline), add engineered features.
- Train baseline models (Ridge, XGBoost) with Time Series Forecasting Models (LSTM, Chronos Transformer)
- Evaluate predictions and a simple long–short backtest.
- Run a demo app for simulation of market prediction using test dataset
⚠️ Licensing: FNSPID is CC BY-NC (non-commercial). Review license before using outside research/education.
git clone https://github.com/fuseai-fellowship/News-Powered-Stock-Market-Analysis.gitNote: Setup of environment may take time. So for a quickstart, you can follow
quickstart.ipynb
Create a virtual environment and activate it:
On Linux/macOS:
python -m venv venv
source venv/bin/activateOn Windows:
python -m venv venv
venv\Scripts\activateInstall Dependencies:
pip install -r requirements.txtNote: The first 3 steps may take some time to be exectued. So you can directly skip to step 4 using the dataset already provided in the repository
# 1) Download the data
python scripts/download_data.py
# 2) Ingest the data
python scripts/ingest.py
# 3) Compute sentiment (FinBERT) & aggregate features per ticker-day
python scripts/sentiment_features.py
# 4) Train & evaluate models
python scripts/train.py --model {modelName(options: xgb, ridge, lstm, chronos)}
python scripts/eval_model.py -- model {modelName(options: xgb, ridge, lstm, chronos)}
# 5) Run the simulation
python scripts/demo_app/server.py.
├── README.md
├── requirements.txt
├── config.yaml
├── data/
│ ├── features/
│ │ └── daily_sentiment_features.csv
│ ├── processed/
│ │ ├── news_processed.csv
│ │ └── prices_processed.csv
│ └── results/
│ ├── chronos/
│ │ ├── test_predictions_chronos_noSentiment.csv
│ │ └── test_predictions_chronos.csv
│ ├── lstm/
│ │ ├── test_predictions_lstm_noSentiment.csv
│ │ └── test_predictions_lstm.csv
│ ├── ridge/
│ │ ├── test_predictions_ridge_noSentiment.csv
│ │ └── test_predictions_ridge.csv
│ └── xgb/
│ ├── test_predictions_xgb_direction_noSentiment.csv
│ ├── test_predictions_xgb_direction.csv
│ ├── test_predictions_xgb_noSentiment.csv
│ └── test_predictions_xgb.csv
├── demo_app/
│ ├── app.js
│ ├── index.html
│ ├── server.py
│ └── styles.css
├── models/
│ ├── chronos_model.py
│ ├── lstm_model.py
│ ├── ridge_model.py
│ ├── xgb_model.py
│ └── saved/
│ ├── chronos/
│ │ ├── config.json
│ │ ├── generation_config.json
│ │ ├── model.safetensors
│ │ └── training_info.json
│ ├── lstm/
│ │ ├── lstm_model_saved_noSentiment.joblib
│ │ ├── lstm_model_saved_noSentiment.keras
│ │ ├── lstm_model_saved.joblib
│ │ └── lstm_model_saved.keras
│ ├── ridge/
│ │ ├── ridge_model_saved_noSentiment.joblib
│ │ └── ridge_model_saved.joblib
│ └── xgb/
│ ├── xgb_model_saved_noSentiment.joblib
│ └── xgb_model_saved.joblib
├── notebooks/
│ └── quickstart.ipynb
└── scripts/
├── add_features.py
├── download_data.py
├── eval_model.py
├── ingest.py
├── sentiment_analysis.py
├── train.py