S
All projects
Machine Learning2024·Architect & Engineer

Trading AI Platform

Real-Time Signal & Fundamental Intelligence Engine

A FastAPI platform that fuses real-time price, macro and news data into an ensemble prediction pipeline, a CALLS/PUTS decision engine, EDGAR XBRL fundamental analysis, automated thesis generation, backtesting and scheduled retraining.

Real-time prediction pipeline Ensemble ML models Feature engineering Decision engine Options signal logic Assistive advisor EDGAR XBRL ingestion Fundamental analysis Automated thesis generation Backtesting & feedback loops Scheduled automation

Real-time

Prediction

Ensemble

Models

10-year

Fundamentals

Walk-forward

Backtesting

Business challenge

Market signals are buried in noisy, high-volume, multi-source data — prices, macro indicators, news and financial filings. Turning that into disciplined, testable trade signals requires a real pipeline, not a notebook.

What I built

I built a FastAPI /predict pipeline that ingests price data (yfinance), macro data (FRED) and news sentiment, engineers features, runs an ensemble model, and passes results to a decision engine that emits CALLS/PUTS signals with an assistive advisor. A separate EDGAR XBRL pipeline ingests 10 years of financial statements, computes ratios and forecasts, and generates thesis reports. Signals are persisted, outcomes tracked, and models retrained on a schedule.

Why it matters

A credible trading-intelligence tool has to combine short-horizon technical signals with long-horizon fundamentals, and it has to be honest about performance. That means rigorous backtesting, persistence of every signal, and feedback loops that track real outcomes — otherwise it's just a demo.

How it's designed

01Ingestion
yfinanceFRED MacroNews SentimentEDGAR XBRL
02Features
Feature EngineeringAlignment
03ML
Ensemble PredictionDecision EngineScheduled Retraining
04Fundamentals
RatiosForecastsThesis Generation
05Serving
FastAPI /predictStreamlit DashboardSQLAlchemy

Interface

Screenshot placeholder — drop product UI here

How the intelligence flows

  1. 01Ingest — yfinance prices, FRED macro series, and news sentiment.
  2. 02Feature engineering — technical, macro and sentiment features.
  3. 03Ensemble prediction — combine models for a robust signal.
  4. 04Decision engine — translate predictions into CALLS/PUTS with an assistive advisor.
  5. 05Fundamentals — EDGAR XBRL ingestion, 10-year statements, ratio calculations and forecasts.
  6. 06Thesis — automated thesis report generation per ticker.
  7. 07Feedback — persist signals, track trade outcomes, retrain on schedule.

How data is modeled

  • SQLAlchemy models for signals, predictions, features and trade outcomes.
  • Fundamentals store: filings, line items, computed ratios and forecasts.
  • Signal persistence with timestamps for backtesting and outcome tracking.
  • Versioned model + dataset references for reproducibility.

Key endpoints

POST/predictRun the real-time ensemble pipeline and return a CALLS/PUTS signal.
GET/fundamentals/{ticker}EDGAR XBRL statements, ratios and forecasts.
GET/thesis/{ticker}Automated investment thesis report.
GET/signalsPersisted signals with tracked trade outcomes.
POST/retrainTrigger scheduled model retraining.

Technologies

PythonFastAPISQLAlchemyscikit-learnyfinanceFREDStreamlitDocker

Key features

  • Real-time /predict pipeline with ensemble models.
  • CALLS/PUTS decision engine with an assistive advisor.
  • EDGAR XBRL ingestion with 10-year statements and ratios.
  • Forecasting and automated thesis reports.
  • Backtesting harness with feedback loops.
  • Scheduled retraining automation.
  • Streamlit dashboard for exploration.

Challenges & trade-offs

Avoiding overfitting

Walk-forward, out-of-sample backtesting kept results honest and prevented curve-fitting to history.

Fusing multi-source data

Prices, macro series, news and XBRL filings arrive on different cadences and shapes — the feature layer had to align them cleanly.

Closing the loop

Persisting signals and tracking real trade outcomes made scheduled retraining meaningful rather than cosmetic.

Code snippet

Prediction → decision enginepython
@app.post("/predict")
async def predict(req: PredictRequest) -> Signal:
    prices = yfinance.history(req.ticker)
    macro  = fred.series(MACRO_SERIES)
    news   = sentiment.score(req.ticker)

    features = engineer(prices, macro, news)
    proba    = ensemble.predict_proba(features)      # multiple models

    signal = decision_engine(proba)                  # CALLS / PUTS / HOLD
    db.persist(Signal(ticker=req.ticker, **signal))  # tracked for outcomes
    return signal

How it ships

  • Containerized FastAPI service with reproducible environments.
  • Scheduled jobs for ingestion, retraining and thesis generation.
  • Streamlit dashboard for interactive analysis.

Security

  • Isolated research environment with access-controlled data.
  • Read-only market/data credentials scoped to ingestion.

Scalability

  • Vectorized batch processing for large historical datasets.
  • Decoupled ingestion, training and serving paths.
  • Signal persistence enables reprocessing without re-ingesting.

Future roadmap

Real-time streaming inference.
Portfolio-level risk analytics.
Broader options-strategy modeling.

Lessons learned

In quantitative ML the backtesting discipline matters more than the model — rigor beats cleverness.
Persisting signals and tracking outcomes is what makes retraining actually improve the system.