Truth Social-driven quant backtest in R testing whether posting volume, sentiment, risk, and de-escalation language predict next-day returns in GLD and SPY. Finds limited signal for gold, but stronger risk-adjusted results for equities, where several text-based strategies outperformed Buy and Hold.
The analysis focuses on two liquid ETFs:
- GLD — SPDR Gold Shares ETF
- SPY — SPDR S&P 500 ETF
Rather than relying only on traditional price data, this project explores whether alternative data from Donald Trump’s Truth Social activity contains market-relevant information.
Signals tested:
- Posting Volume
- Sentiment Score
- Risk Word Frequency
- Net Risk Language
- De-escalation Language
Sample period:
2025-01-20 to 2026-04-18
(Trump in-office period used for backtesting)
Can Truth Social activity generate useful trading signals?
More specifically:
- Does unusually high posting activity predict next-day returns?
- Does post language matter more than raw activity?
- Do defensive assets and equities react differently?
- Can any signals outperform Buy and Hold on a risk-adjusted basis?
- Yahoo Finance price data via the
quantmodpackage
- Historical Truth Social posts sourced from the public GitHub repository:
stiles/trump-truth-social-archive
https://github.com/stiles/trump-truth-social-archive
This repository maintains an archive of Donald Trump’s Truth Social posts in CSV and JSON formats and was used as the primary alternative-data source for this project.
Note: public data availability may change over time depending on updates to the archive.
Signals are built using information available on day t and applied to returns on day t+1.
Strategies are compared with Buy and Hold using:
- Average return
- Volatility
- Annualized Sharpe ratio
- Cumulative return paths
- Statistical testing
This helps distinguish meaningful signals from noisy backtest results.
Measures whether daily post count is unusually high relative to recent history.
Uses positive and negative word counts from a sentiment lexicon.
Counts words associated with uncertainty or geopolitical stress.
Examples:
war, attack, tariff, inflation, conflict
Counts words associated with easing tension.
Examples:
deal, peace, pause, resolution, solve
Combines opposing word groups:
- Net Risk = Risk Words − De-escalation Words
- Net De-escalation = De-escalation Words − Risk Words
Truth Social signals were not stronger than Buy and Hold on a risk-adjusted basis over the full sample.
- Posting Volume underperformed Buy and Hold
- Sentiment Strategy had lower Sharpe than Buy and Hold
- Risk Word Strategy had lower Sharpe than Buy and Hold
- Net Risk Strategy had lower Sharpe than Buy and Hold
Although full-period Sharpe ratios were weaker, both:
- Sentiment Strategy
- Risk Word Strategy
generated cumulative returns above Buy and Hold during parts of:
- 2025 Q1
- 2025 Q2
- 2025 Q3
Truth Social language may contain short-lived tactical signals for gold during periods of uncertainty, but those signals were not persistent enough to outperform Buy and Hold across the full sample.
Truth Social signals were materially more useful for SPY than for GLD.
- Sharpe: 0.911
- Buy and Hold Sharpe: 0.867
High posting activity often acted as a useful risk-off filter.
(Positive sentiment interpreted contrarily / risk filter)
- Sharpe: 1.63
This was one of the strongest signals in the project.
- Sharpe: 1.10
Language associated with easing tension aligned with stronger equity performance.
(De-escalation − Risk)
This signal performed poorly and was not robust.
For equities, market reaction appeared more sensitive to communication intensity and tone than for gold. Filtering exposure based on posting behavior improved risk-adjusted performance in several cases.
Social media activity may contain usable market information.
The same signal can behave differently across asset classes.
- Weak for GLD
- Stronger for SPY
For SPY, sentiment and de-escalation signals outperformed simple posting counts.
Some strategies worked strongly, while others failed completely. Backtests should be judged across the full sample, not only short winning windows.
Potential next steps:
- Add transaction costs and slippage
- Out-of-sample validation
- Multi-factor combinations
- Regression / probability models
- More advanced NLP models
- Intraday event-time analysis
- Additional assets (rates, FX, sectors)
- R
- tidyverse
- quantmod
- xts
- zoo
- tidytext
- lubridate
truth-social-market-backtest/
│
├── README.md
├── analysis/
│ └── truth_social_market_model.R
├── output/
│ ├── figures/
│ └── tables/
└── .gitignore
install.packages(c( "tidyverse", "quantmod", "xts", "zoo", "tidytext", "lubridate" ))
source("analysis/truth_social_market_model.R")
This project is for educational and research purposes only. It is not investment advice.
Sara Liu