FTEC6V96_Report_Rep / README.md
vharshjoshi's picture
Upload README.md
fd98c57 verified
|
Raw History Blame Contribute Delete
3.69 kB
---
license: mit
tags:
- finance
- llm
- research-replication
---
# Research Track: Replicating "Can ChatGPT Forecast Stock Price Movements?"
**Paper:** Alejandro Lopez-Lira and Yuehua Tang, *Can ChatGPT Forecast Stock Price Movements? Return Predictability and Large Language Models*, Journal of Financial Economics (2026). First posted on arXiv as 2304.07619. The paper was approved by the instructor.
**Core idea:** a large language model reads a firm-specific headline and answers YES (good news), NO (bad news) or UNKNOWN. That score predicts the stock's next *tradable* return, beats conventional sentiment scores, and works best for small stocks and bad news.
## Repository layout
```
.
├── README.md
├── requirements.txt
├── paper_review/
│ ├── One_Page_Paper_Review.pdf # one-page review with pseudocode
│ └── Framework_Flowchart_and_Replication_Guide.pdf # flow chart + implementation notes
├── notebooks/
│ └── 01_research_replication.ipynb # real-data replication
├── data/
│ ├── raw/ # headlines.csv, prices.csv (created by the notebook)
│ └── processed/ # llm_scores.csv, scored_events.csv
└── results/ # summary.json, long_short.png
```
## What the replication does
1. Collects timestamped, firm-linked headlines and daily prices for about 100 U.S. stocks, from large to small caps. Prices come from `yfinance`; headlines come from the `ashraq/financial-news` archive on Hugging Face (see Limitations).
2. Scores each headline with the paper's exact prompt using an open LLM (`Qwen/Qwen2.5-3B-Instruct`).
3. Maps each headline to its first tradable return, using the paper's 06:00 / 16:00 ET rule.
4. Estimates a firm/date fixed-effects regression with two-way clustered standard errors.
5. Runs an equal-weight long-short portfolio, before and after costs.
6. Compares against a FinBERT sentiment baseline, including a head-to-head regression.
## How to run
Open `notebooks/01_research_replication.ipynb` in Google Colab with a T4 GPU runtime and run all cells. Adding `OPENAI_API_KEY` as a Colab secret switches scoring to `gpt-4o-mini`.
## Results
Full results are in `results/summary.json`, in notebook Sections 9-11 (hit rates, fixed-effects regressions, long-short returns, and examples where the LLM and FinBERT disagree), and in `results/long_short.png`.
## Limitations
- **Data source:** Yahoo Finance's news API was unavailable from Colab at run time, so headlines come from the `ashraq/financial-news` archive (2020). These predate the model's training cutoff, so memorization of the outcomes can't be ruled out.
- **Sample size:** the LLM scored about 1,460 headlines from a roughly two-month window. That is far smaller and shorter than the paper's multi-year CRSP/RavenPack sample, so the t-statistics are indicative only.
- **Model:** I used a 3B-parameter open model, not the paper's GPT models. The paper finds that smaller models predict returns poorly, so weak results here are consistent with its findings.
- **Filters and costs:** the archive's firm tags replace RavenPack relevance filters. Transaction costs are a flat bps charge, with no slippage or short-borrow costs.
## AI-use disclosure
I used ChatGPT (OpenAI) to help find and verify the paper and to draft an initial code scaffold. I used Claude (Anthropic) to check my submission against the assignment requirements, to tighten the paper review, and to restructure the replication notebook around real data. I selected the paper, checked the prompt and timing rule against the original, and ran and interpreted the replication myself.