U.S. President Donald Trump is the only person on Earth who can “send a message that causes the global stock market to shake,” making traders and investment institutions highly attentive to his public statements. Taiwanese entrepreneur TK Lin recently open-sourced a project called “Trump Code,” which attempts to analyze the potential relationship between Trump’s posts and financial markets through large-scale data analysis and machine learning, even building a signal system usable for trading strategies.
The system tests 31.55 million prediction models via brute-force search. After validation with training and testing sets, about 50,000 effective models remain. Currently, the system has achieved approximately a 61.3% hit rate in 566 historical prediction cases. The project has been applied to the S&P 500 and can further integrate assets like Bitcoin, gold, and even connect to trading bots.
Analyzing 7,400 posts and generating 31.55 million models
According to the project description, the research team collected and organized over 7,400 posts from Trump on Truth Social and X platforms since he re-entered politics, extracting 316 signal features based on text content, posting time, tone changes, and other aspects.
The system tests 31.55 million prediction models through brute-force search. After validation, about 50,000 effective models remain. In current statistics, the system has a roughly 61.3% accuracy across 566 historical prediction cases.
The core logic of the project is to treat Trump’s posts as “market events” and develop signal models to evaluate their potential impact on markets like the S&P 500. The GitHub page also notes that comparisons with Bitcoin, gold, or oil haven’t been done yet, but it shouldn’t be too difficult.
How to identify multiple “Trump signals”
The research has identified several statistically significant patterns, such as:
Pre-market RELIEF = strongest buy signal: the S&P 500 rises an average of 1.057% on the day
Late-night tariff tweets = inverse indicator: trends tend to reverse
Pure tariff days = most dangerous: the S&P 500 drops an average of 1.12% on those days
Additionally, the study found that days with no posts at all tend to have higher market gains, called “silence signals.”
Time difference between Truth Social and X
Another finding is Trump’s posting strategy across platforms. Data shows that posts on Truth Social usually appear about 6.2 hours earlier than on X. Some messages related to China policies only appear on Truth Social. The research team believes this could provide traders with an “information arbitrage window.”
Open-sourced Trump Code project: welcoming trading bot integration
TK Lin states that the project is fully open-sourced on GitHub, including:
Complete database of Trump’s posts
Signal models and backtesting results
Real-time monitoring system
API and trading strategy framework
The system automatically updates daily with new posts and recalculates signals, encouraging developers to integrate it with trading bots or market prediction tools. Currently, the project also tracks Trump-related markets on prediction platforms like Polymarket, aiming to analyze the interaction between political signals, crowd expectations, and financial markets.
Does this article incorporate Trump into an investment model? Taiwanese entrepreneur open-sources “Trump Code” analyzing US stocks with over 60% accuracy. Originally published on Chain News ABMedia.