Inspiration

The inspiration for this project is based on current world events involving the war between the US, Israel and Iran. Tweets from Donald Trump, ranging from threats to diplomatic signals, can trigger immediate swings in stocks and energy prices. I was interested to know if there is

What it does

The Attention Shockwave Model correlates 56,571 presidential tweets with Google search behaviour across 6 topics from 2016–2021. I invented the Attention Elasticity Index (AEI) which is a metric that measures how much public attention a tweet generates per unit of intensity. Weights are learned via Ridge regression, not arbitrary guesses. I also model attention as a decaying stochastic process with every tweet triggers a spike that fades with a measurable half-life before returning to baseline. The dashboard lets you explore any keyword, see the shockwave in real time, and type your own tweet to get a predicted attention score.

How we built it

I ran TextBlob sentiment analysis across all 56,571 tweets, then engineered features including CAPS ratio, exclamation intensity, named entity detection, and topic classification across four categories. I trained a Ridge regression model with train/test split to learn AEI weights, and used walk-forward time-series validation for the search spike predictor. The market backtest uses a volatility-targeted strategy with a ±5% sentiment threshold and 5bps transaction costs, backtested against the S&P 500. The whole thing runs as an interactive Dash dashboard with four tabs.

Challenges we ran into

Google Trends only returns weekly data for long date ranges, which required careful resampling to align with individual tweet timestamps. The bigger challenge was if the correlation between tweet volume and search interest was real but not causal. I had to be deliberate about framing this as a behavioural signal model, not causal inference. The hardest reframe was the Sharpe ratio of 0.07 which I initially felt like a failure, until I recognised it as a rigorous proof of market efficiency, proving alphas absence.

Accomplishments that we're proud of

Inventing the Attention Elasticity Index from scratch, a metric that didn't exist before today, with weights learned from real data rather than guessed and building a ML pipeline in a single day, from raw tweet data through NLP, Ridge regression, walk-forward validation, and a live interactive dashboard.

What we learned

High-AEI tweets generate 15x larger search spikes than low-intensity tweets. Attention has a measurable half-life of around 4 days before decaying to baseline which is consistent with a stochastic decay model. Most importantly, tweets function as leading indicators of public attention shifts, not causes. The signal precedes the spike. In a world where a single post can move oil prices by double digits, that distinction matters.

Built With

Share this project:

Updates