But here’s the thing: some of the most successful traders in history, from W.D. Gann to the mysterious “Astrologer to Wall Street” Evangeline Adams, swore by astrological methods. And in algorithmic trading, where we’re constantly searching for edge in unconventional places, why not test whether the cosmos might have something to say about market movements?
The Concept: Financial Astrology Meets Modern Trading
Financial astrology operates on the premise that planetary movements correlate with market cycles and price movements. While mainstream finance dismisses this as pseudoscience, there’s an interesting counterargument: if enough traders believe in and act on astrological signals, those beliefs can become self-fulfilling prophecies in market behavior.
My implementation takes this centuries-old practice and brings it into the 21st century by:
1. Calculating planetary transits programmatically using precise astronomical data
2. Storing transit data alongside traditional market indicators in a time-series database
3. Making astrological data available as features for machine learning models or rule-based strategies
The Technical Implementation
The system uses several Python libraries to calculate and track astrological events:
– Skyfield for accurate astronomical calculations using JPL ephemeris data (the same data NASA uses)
– Swiss Ephemeris (swisseph) for traditional astrological calculations
– TimescaleDB for storing time-series astrological data alongside market data
Natal Charts for Companies
One of the most interesting aspects is creating “natal charts” for publicly traded companies. Just as an astrologer would create a birth chart for a person, I calculate charts for companies based on their IPO date and headquarters location.
The `collect_natal_charts.py` script pulls company information—including IPO dates and geographic coordinates—and generates a natal chart showing where each planet was positioned at the moment the company began trading. This becomes the baseline against which we measure transits (current planetary positions).
Real-Time Transit Tracking
The `collect_astrological_transits.py` script continuously calculates current planetary positions and compares them to each company’s natal chart. It looks for significant astrological events:
– Conjunctions: When a transiting planet aligns with a natal planet position
– Oppositions: When planets are 180° apart
– Squares: 90° angles between planets
– Trines: 120° angles (generally considered favorable)
– Sextiles: 60° angles (also considered favorable)
These aspects are calculated for all major planetary bodies and stored with timestamps, making them queryable alongside price data, volume, and traditional technical indicators.
The Data Structure
What makes this implementation particularly interesting is how it integrates with the broader trading infrastructure. Astrological data isn’t stored in isolation—it’s part of the same time-series database that holds:
– OHLCV price data
– Technical indicators (RSI, MACD, Bollinger Bands)
– Sentiment data from reddit
– Earnings calendar information
– SEC filing data
This means I can run queries like: “Show me all instances where Apple experienced a Saturn return while RSI was oversold and Reddit sentiment was negative.” Whether or not planetary positions actually influence markets, having this data structured properly allows for rigorous backtesting.
Does It Actually Work?
Here’s where I have to be completely honest: I don’t know yet.
The point of building this system isn’t to claim that Mercury retrograde crashes the stock market or that Jupiter transits guarantee bull runs. The point is to have the data infrastructure in place to test these theories properly.
Some studies have found statistical correlations between lunar cycles and market returns. Others have found nothing. The key is approaching it scientifically: collect the data, backtest thoroughly, and let the results speak for themselves.
The Practical Value: Alternative Data Sources
Even if you’re skeptical about astrology (and you should be skeptical—always test your assumptions), this implementation demonstrates something valuable for algorithmic traders: the importance of exploring unconventional data sources.
The same infrastructure I built for astrological transits could easily be adapted for:
– Lunar cycles and tidal patterns (which do have documented correlations with some commodity markets)
– Solar activity and geomagnetic storms (which have been linked to market volatility in academic research)
– Seasonal and calendar effects (which are well-documented in financial literature)
The technical challenge—calculating time-based astronomical events and storing them in a queryable format alongside market data—is identical regardless of which celestial phenomena you’re tracking.
The Code Architecture
From an engineering perspective, the astrological data pipeline follows the same patterns as other data collectors in my system:
1. Data Collection: Scripts run on a schedule to calculate current planetary positions
2. Data Storage: Transit information gets inserted into TimescaleDB hypertables optimized for time-series queries
3. Data Access: The same query interfaces that work for price data work for astrological data
4. Feature Engineering: Transit aspects can be converted into numerical features for machine learning models
This modularity means I can easily enable or disable astrological features in my trading strategies without refactoring the entire system.
A Word on Skepticism and Testing
The beauty of algorithmic trading is that we don’t have to rely on belief—we can test everything. If astrological transits provide no predictive value, the backtest results will show it. If they do show correlation (even if by coincidence or as a proxy for some other phenomenon), that’s worth investigating further. The key is maintaining intellectual honesty: track performance metrics, use proper train/test splits, watch for overfitting, and never confuse correlation with causation.
Whether planetary transits actually influence stock prices or not, building this system has been a fascinating exercise in data pipeline engineering, astronomical calculations, and questioning assumptions about what kinds of data might be relevant to market behavior.
At minimum, it makes for an interesting conversation at trading meetups. At best, it might reveal correlations that others have overlooked precisely because the concept seems too unconventional to take seriously.
After all, the market doesn’t care whether your edge comes from a neural network or a natal chart—it only cares whether your predictions are profitable.