Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News-Powered-Stock-Market-Analysis

FNSPID Starter Kit — News Sentiment → Stock Prediction (Daily)

This repo helps you get up and running quickly with the FNSPID Financial News & Stock Price Integration Dataset.

What you’ll do

  1. Download the dataset from Hugging Face (non-commercial use) and/or the authors' GitHub.
  2. Ingest news & prices, align by time (avoid leakage), map to tickers.
  3. Score sentiment (FinBERT baseline), add engineered features.
  4. Train baseline models (Ridge, XGBoost) with Time Series Forecasting Models (LSTM, Chronos Transformer)
  5. Evaluate predictions and a simple long–short backtest.
  6. 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.


Setup

1. Clone the Repository

git clone https://github.com/fuseai-fellowship/News-Powered-Stock-Market-Analysis.git

Note: Setup of environment may take time. So for a quickstart, you can follow quickstart.ipynb

2. Create a virtual environment and Install Dependencies:

Create a virtual environment and activate it:

On Linux/macOS:

python -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
venv\Scripts\activate

Install Dependencies:

pip install -r requirements.txt

3) Run the pipeline

Note: 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

Project Structure

.
├── 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

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages