Time Series RAG - AI for Traders (prototype)
Can pattern matching embeddings help find similar chart patterns?
Time Series RAG: Applying AI Search to Market Patterns
I spent seven years as a day trader before becoming an AI time series research engineer.
Today I'm sharing a prototype that applies Retrieval Augmented Generation (RAG) techniques to time series data for trading chart analysis.
What This Is (And Isn't)
This is a research prototype demonstrating how AI similarity search can be applied to candlestick patterns.
It is NOT a trading system and will not make money on its own.
Think of it as an exploration of how RAG concepts from language models could work with numerical data.
Technical Architecture
The system consists of three main components:
A data fetcher that pulls candlestick data from Yahoo Finance into TimescaleDB
A processing pipeline that normalizes price data and creates numerical embeddings
A similarity search engine using LanceDB that finds historically similar patterns
Currently, the embedding approach is simple - using min-max scaling on 5-day windows of OHLC data. But this could be extended to more sophisticated embedding methods like auto-encoders or specialized time series foundation models.
Future Potential
Imagine extending this to include:
All historical chart data across markets
Larger window sizes (20, 50, 100+ days)
More sophisticated embedding techniques
Multi-level pattern comparison
For experienced traders, this could be a powerful tool to quickly find relevant historical patterns and inform decision-making based on what happened after similar setups.
What's Next
I'm putting this project on pause as I begin my "30 Days of Time Series AI Research Challenge" - a public learning journey where I'll explore time series AI concepts daily.
This prototype represents just the beginning of what's possible at the intersection of trading, data engineering, and AI.
Want to explore the code or contribute? Find it on GitHub and join the Discord.