Back to Portfolio

LLM Advisor

An autonomous trading agent that combines statistical mean reversion with LLM-based sentiment analysis for risk management.

PythonGemini APIAlpacaPandasBacktesting
USER: Analyze SPY sentiment
AGENT: Volatility high. Reducing position size.

Key Performance Indicators

Agentic Workflow

1. Sentiment Analysis

Every 15 minutes, the system feeds headlines and market context into Gemini 1.5 Flash. The LLM outputs a market-state score and risk multipliers used by execution guards.

2. Statistical Execution

The core engine calculates Z-scores on price action. If the Z-score exceeds the dynamically adjusted threshold, it executes mean reversion trades via Alpaca.

Live Monitoring Dashboard

This section is now backed by a real telemetry API using Supabase storage with local artifact fallback.

Data source: No telemetry
Last generated: N/A
Anchor date: N/A
Loading telemetry...
Last Price Update

N/A

N/A

P/L Windows

N/A (7d)

1d: N/A | 30d: N/A

Recent Trades

0

Count in last 7 days of sample window.

Success Rate

N/A

0 trades available.

Risk/Reward

N/A

Avg win: N/A | Avg loss: N/A

Agent State

NO FEED

Loop: N/A | Symbols: N/A

Recent Trades

No trades found in telemetry yet.

Model Visuals

Feature-importance plots from current training artifacts.

SPY feature importances

SPY feature importance

QQQ feature importances

QQQ feature importance

IWM feature importances

IWM feature importance

Automated Risk Manager

Safety logic includes hard-coded circuit breakers that override AI decisions at configured drawdown thresholds.

risk_manager.py
def check_risk_parameters(current_pnl, max_drawdown_limit):
    """
    Hard stop if we exceed daily loss limit.
    """
    if current_pnl < -max_drawdown_limit:
        logger.critical(f"Daily stop loss hit: {current_pnl}")
        return {
            "can_trade": False,
            "action": "LIQUIDATE_ALL",
            "reason": "MAX_DRAWDOWN_HIT"
        }

    # ... other checks (exposure, volatility) ...
    return {"can_trade": True}

Data Caveat

Current metrics are sourced from backtest artifacts and live-loop telemetry. Once real broker fills are persisted into the same schema, the dashboard will reflect true production P/L instead of backtest-only trade outcomes.