Do the things the news talks about move the things the market prices?
This project joins four years of New York Times article metadata to daily prices for 20+ assets — equities, commodities and crypto — over June 2019 → June 2023, and builds an interactive view for exploring whether coverage and price movement line up.
▶ Final visualisation: https://observablehq.com/d/eac52a8d2fa130d8
The word cloud there is clickable: selecting a keyword filters the price series, so you can see what the market did around the dates a term spiked in coverage.
Coursework for Advanced Interactive Visualization, JKU Linz.
- Load and window. NYT metadata (
nyt-metadata.csv) and a stock-market dataset are each parsed to real dates and clipped to 2019-06-01 → 2023-06-01. - Outer-join on date. Keeping all dates from both sides rather than only their intersection — a day with news but no trading (weekends, holidays) still exists in the timeline.
- Forward-fill prices. Markets close; news does not. Price and volume
columns are forward-filled across non-trading days so every article sits
against the last known price. Text columns get empty strings rather than
NaN. - Extract keywords. Article keywords and abstracts are tokenised, filtered
against
sklearn's English stop-word list, and counted per month. - Publish. Aggregates are exported for Observable and Power BI.
Assets covered include Natural Gas, Crude Oil, Copper, Platinum, Silver, Gold, Bitcoin, Ethereum, S&P 500, Nasdaq 100, Apple, Tesla, Microsoft, Google, Nvidia, Berkshire, Netflix, Amazon and Meta.
| Path | Contents |
|---|---|
VisualAnalytics.ipynb |
The full pipeline — load, window, merge, clean, aggregate, export (52 cells) |
feb_last_ultraclean_v2_final.csv |
Cleaned keyword frequencies, February (word,count, 564 terms) |
march_last_ultraclean.csv |
Cleaned keyword frequencies, March (word,count, 512 terms) |
Links.txt |
Link to the published Observable notebook |
pip install pandas matplotlib numpy wordcloud scikit-learn dash plotly
jupyter notebook VisualAnalytics.ipynbThe two input datasets are not committed — nyt-metadata.csv in
particular is far past GitHub's file limit. The merged dataset is available
here:
https://drive.google.com/file/d/1VD45Cian1Lbf8_tuqWn2vaeYu0K-Gy1y/view?usp=sharing
Place nyt-metadata.csv and Stock_Market _Dataset _2.csv next to the
notebook to re-run from scratch. Only the derived keyword CSVs are in the
repository.
- The cell order matters —
mergedis assigned partway through and a couple of earlier cells reference it before that point. Run top to bottom. - The Observable notebook is the finished artefact; the Python here is the preparation pipeline behind it.