Inspiration

In a world of 24/7 financial news and high-frequency trading, investors are often paralyzed by "market noise"—daily fluctuations that trigger emotional, rather than logical, decisions. I wanted to build a tool that strips away this volatility to reveal the underlying trend, providing a psychological anchor for disciplined investing.

What it does

Market Logic AI is a decision-grade financial terminal that identifies market regimes using a 20-day Simple Moving Average (SMA) crossover strategy. The application ingests institutional-grade data, calculates trend signals, and presents a clean, interactive dashboard that tells the user one of two things: is the market in a sustained "BUY" phase or a "SELL" phase?

How I built it

The project utilizes a robust three-tier cloud architecture:

Data Tier: Automated ingestion of 2,495 days of historical S&P 500 data from the Federal Reserve (FRED) API.

Logic Tier (The Brain): A FastAPI backend deployed on Zerve that handles all data sanitization, SMA calculations, and signal generation.

Presentation Tier: An interactive Streamlit dashboard using Altair for precision charting. We implemented a "melted" data architecture to ensure both price and SMA lines are perfectly synchronized and scaled for readability.

Challenges we ran into

The primary challenge was Data Fidelity and Scaling. When plotting nearly 10 years of data, standard charts often "squash" the price lines at the top of the axis, making trend crossovers invisible. We overcame this by moving beyond basic charting presets and implementing custom Altair configurations with zero=False scaling to ensure the price action remains the focal point.

Accomplishments that we're proud of

I am particularly proud of the API-first design. By hosting the logic on Zerve/FastAPI, the backend is decoupled from the frontend. This means the signal logic is stable, reusable, and provides a "single source of truth" for the dashboard metrics and the historical win-rate analysis.

What we learned

Building this project reinforced the importance of Tidy Data. We learned that "melting" wide dataframes into long-form structures is essential for complex visualizations in Altair. We also gained deep experience in deploying a full-stack AI application where the "intelligence" isn't just in the model, but in the reliability of the data pipeline itself.

What's next for Market Logic AI

The next phase involves expanding the engine to support multi-asset comparison (e.g., Bitcoin vs. S&P 500) and integrating automated alerts via Discord or Email. I also plan to implement more complex technical indicators, such as the RSI or MACD, to provide a "Confluence Score" for even higher-conviction signals.

Built With

  • altair-(declarative-visualization)
  • api
  • fred
  • github
  • languages:-python-3.10+-frameworks-&-libraries:-fastapi-(backend-api)
  • pandas-(data-engineering)
  • pip
  • pydantic-(data-validation).-platforms-&-cloud-services:-zerve-(deployment-&-intelligence-layer)
  • streamlit-(frontend-ui)
Share this project:

Updates