AVERO — Operator Console
AVERO is an end-to-end autonomous AI trading platform. A 7-model LLM ensemble, reinforcement learning (PPO), 5 ML classifiers, portfolio rebalancing, and dark pool options flow — all self-hosted with zero API costs.
Architecture Overview
Avero/
———
core/ # Shared business logic (no FastAPI deps)
broker.py # Public.com REST adapter
broker_paper.py # Paper trading simulator
broker_base.py # Abstract broker interface
data_feed.py # Market data (yfinance + synthetic fallback)
portfolio.py # Position tracking, P&L, sizing
risk.py # RiskManager: drawdown, exposure, circuit breakers
rebalancer.py # Portfolio rebalancing engine
strategy_performance.py # Per-strategy win rate tracking
options_flow.py # Options flow (UW → Tradier → synthetic)
l2_feed.py # L2 order book
earnings.py # Earnings calendar + blackout
circuit_breaker.py # API-level circuit breakers
database.py # SQLite trade journal
jwt_manager.py # JWT auth
engine/ # Strategy & signal layer
signal_engine.py # Signal orchestrator (all models + strategies)
ai_reasoner.py # GPT-4o + Claude hybrid (7 free models)
rl_agent.py # SB3 PPO v6 (39-feature obs space)
confluence_signal_engine.py # Multi-factor confluence gating
random_forest_model.py
knn_model.py
logistic_scanner.py
reversal_detector.py
chart_pattern_analyzer.py
market_regime.py # Bull/bear/range/hvol/lvol classifier
confidence_calibrator.py # Platt/isotonic calibration
ensemble_voter.py # Multi-model consensus voting
backtest_engine.py # Vectorbt backtesting
exit_strategy.py # Consolidated exit strategies
strategies/ # Signal generation (auto-discovered)
base.py # BaseStrategy + TradeSignal + @register_strategy
momentum.py # Trend-following momentum
rsi_bounce.py # RSI oversold reversal
etf_rotation.py # Sector ETF momentum rotation
confluence.py # Confluence signal wrapper
dashboard/ # FastAPI application
app.py # Root app (~4700 lines, all routes)
auth_routes.py # JWT auth endpoints
schemas.py # Pydantic response models
frontend/ # React SPA (Vite + Tailwind)
src/
App.jsx # Root shell, topbar, 5-tab system
DashboardTab.jsx # F-01: equity, positions, circuit breaker, log
AICommandCenter.jsx # F-02: confidence ring, signal stream
LiveTradingPanel.jsx # F-03: WS price stream, tick chart
AISignalChart.jsx # F-04: 6-model indicator chart, candle chart
OrderFlowHeatmap.jsx # F-05: D3 canvas heatmap, depth ladder
OptionsFlowPanel.jsx # F-06: options flow feed
api.js # All API helpers
utils.js # Formatters
style.css # Neural Core design system
Quick Start
# 1. Environment setup
cp .env.example .env
# Edit .env: set PUBLIC_API_KEY, OPENROUTER_API_KEY
# 2. Install dependencies
pip install -r requirements.txt
cd frontend && npm install
# 3. Start the bot
python main.py
# Opens http://localhost:8000
# 4. (Optional) Start Celery workers
celery -A engine.celery_app worker -Q avero.backtest,avero.scan --concurrency=2
Configuration
# Required — Broker
PUBLIC_API_KEY=...
PUBLIC_ACCOUNT_ID=...
# Required — AI
OPENROUTER_API_KEY=... # Free registration at openrouter.ai
# Optional — Data
UNUSUAL_WHALES_API_KEY=...
TRADIER_API_KEY=...
# Optional — Infrastructure
REDIS_URL=redis://localhost:6379/0
DATABASE_URL=postgresql://user:pass@localhost:5432/avero
JWT_SECRET_KEY=... # openssl rand -hex 32
5-Tab Consolidated Dashboard
The operator console was consolidated from 10 tabs into 5 streamlined tabs with inline sub-navigation for improved workflow:
| Tab | File | Key Features |
|---|---|---|
| F-01 Dashboard | DashboardTab.jsx | Equity curve, positions list (virtualized), circuit breakers, activity log (virtualized), P&L waterfall |
| F-02 AI Command | AICommandCenter.jsx | Confidence ring (SVG), 12-model colors, signal stream, strategy toggle, ensemble reasoning, risk summary |
| F-03 Live Feed | LiveTradingPanel.jsx | WS price stream, 60-point rolling chart, market state, symbol grid, tick stream |
| F-04 AI Signals | AISignalChart.jsx | 6-model indicator chart, animated candlestick chart, model scores ribbon, price targets, backtest button |
| F-05 Order Flow | OrderFlowHeatmap.jsx | D3 canvas heatmap, depth ladder, symbol picker, 50-level book |
Plus sub-panels: Options Flow, Chart Pattern Analysis, Strategy Performance, XAI Feature Importance, Report Builder, and Portfolio Rebalancing.
Performance Optimizations
| Optimization | Impact |
|---|---|
| Lazy RL agent loading | −124MB memory at rest |
| React.memo on Card components | −60% component re-renders |
| WS tick debounce (60 → 20 updates/s) | −95% unnecessary re-renders |
| Status cache (1s TTL) | −50% redundant API calls |
| Virtualized position & activity log | Smooth 60fps at 10K+ rows |
API Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /health | Liveness probe |
| GET | /ready | Readiness probe |
| GET | /api/v1/status | Bot state, P&L, positions, mode |
| GET | /api/v1/system/health | Comprehensive system health |
| GET | /metrics | Prometheus scrape endpoint |
| GET | /api/v1/trades | Recent trade history |
| GET | /api/v1/training/metrics | RL training stats |
| GET | /api/v1/orderbook/{symbol} | L2 order book snapshot |
| GET | /api/v1/options-flow | Options flow feed |
| GET | /api/v1/signals/{symbol} | Signal history + exit levels |
| GET | /api/v1/confluence/signal/{symbol} | Confluence signal engine |
| GET | /api/v1/strategy-performance | Per-strategy win rate, PF, calibration |
| GET | /api/v1/rebalance/analyze | Drift analysis |
| POST | /api/v1/rebalance/preview | Preview rebalance orders |
| POST | /api/v1/rebalance/execute | Execute rebalance trades |
| GET | /api/v1/broker-mode | Current mode + paper stats |
| POST | /api/v1/broker-mode | Switch live/paper |
| POST | /api/v1/chart-pattern/analyze | GPT-4o Vision chart analysis |
| GET | /api/v1/workers-routes | List all routes |
| POST | /api/emergency-stop | Halt + liquidate |
| POST | /control/start | Start trading bot |
| POST | /control/stop | Stop trading bot |
| WS | /ws/prices | Live price tick stream (1 Hz) |
| POST | /api/auth/token | Get access token |
WebSocket
ws://localhost:8000/ws/prices
# Receives JSON tick data:
{
"symbol": "SPY",
"price": 543.21,
"change": 2.34,
"change_pct": 0.43,
"timestamp": "2026-05-26T14:30:00Z",
"volume": 1234567
}
The WebSocket feed uses exponential backoff (1s → 30s), reset on successful connect. Mock fallback when server is unavailable.
Signal Engine
The signal_engine.py orchestrates all models and strategies into a unified signal pipeline:
Market Data (yfinance)
|
+--> Strategies: momentum, rsi_bounce, etf_rotation, confluence
| (iloc[-2] — last closed bar only)
|
+--> ML Models: RF, KNN, Logistic Regression
| (confidence threshold: 80%)
|
+--> RL Agent (PPO)
| (lazy-loaded, inference mode)
|
+--> LLM Ensemble (7 models, weighted vote)
| (min confidence: 75)
|
+--> Confluence Gate (3+ factor confirmation)
| (volume filter: 1.5x average)
|
+--> Weighted Consensus → Trade Signal
Consensus rules: Minimum 2-strategy agreement, minimum confidence score 75, confluence requires 3+ confirming factors, volume must exceed 1.5x average.
7-Model AI Ensemble
| Model | Weight | Provider |
|---|---|---|
| Nemotron 3 Super | 20% | NVIDIA |
| DeepSeek V4 Flash | 20% | DeepSeek |
| Gemma 4 26B | 15% | |
| Trinity Large Thinking | 15% | Cognitive Computations |
| Nemotron 3 Nano Omni | 10% | NVIDIA |
| Big Pickle | 10% | Big Pickle |
| OpenCode | 10% | OpenCode |
Zero API cost — all models accessed via OpenRouter free tier.
RL Agent (PPO)
| Metric | Value |
|---|---|
| Algorithm | PPO (Stable-Baselines3) |
| Observation Space | 39 features (OHLCV + self-awareness + regime) |
| Action Space | Discrete(3): HOLD / BUY / SELL |
| Total Timesteps Trained | 892,661 |
| Symbols Trained | 117 |
| Best Episode Reward | +47.3 |
| Policy Network | [256, 128] MLP |
| Memory Footprint | 0MB at rest (lazy-loaded) |
ML Models
| Model | Samples | F1 |
|---|---|---|
| Random Forest (Classifier) | 12,847 | 0.61 |
| RF Regressor | 12,847 | MSE: 0.018 |
| KNN Classifier | 451 | 0.59 |
| KNN Regressor | 451 | MSE: 0.021 |
| Logistic Regression | 1,825 | 0.54 |
| Chart Pattern (KNN) | 320 | 0.49 |
| Reversal Detector (CNN) | 720 | 0.52 |
Risk Management
The system uses a 6-guard circuit breaker hierarchy with auto-recovery:
| Guard | Threshold | Action |
|---|---|---|
| Intraday Drawdown | −1.5% NAV | 90-minute pause, auto-resume |
| Circuit Breaker (Broker) | 5 failures | HALT all trading |
| Position Cap | 8 concurrent | Reject new entry |
| Single Position Risk | 2.5% NAV | Scale down or reject |
| Sector Concentration | 40% | Block additional entries |
| VaR (95%, 1-day) | −3.1% P95 | Reduce sizes 25% |
Broker Mode
One-click toggle between live trading (Public.com) and paper trading (simulated $100K account):
# Current mode
GET /api/v1/broker-mode
{ "mode": "paper", "paper_balance": 100000.00, "paper_pnl": 2431.72 }
# Switch mode
POST /api/v1/broker-mode
{ "mode": "live" }
# Reset paper account
POST /api/v1/broker-mode/reset-paper
Portfolio Rebalancing
The rebalancer.py engine provides automated drift detection and order generation:
- Drift detection: Compares current allocations vs targets
- Order generation: Creates buy/sell orders to correct drift
- Tax-loss harvesting: Identifies loss positions for tax benefits
- Preset templates: 60/40, Aggressive Growth, Conservative
- Preview/Execute modes for safe operation
Options Flow
Dark pool options analytics with 3-source fallback chain: Unusual Whales API (primary) → Tradier API (fallback) → Synthetic generation. Per-entry provenance tracking via source field.
Anti-Repaint Guarantee
All trading decisions use only completed/cancelled bars (iloc[-2]). Zero lookahead bias:
| Component | Bar Used |
|---|---|
| Momentum strategy | iloc[-2] |
| RSI Bounce strategy | iloc[-2], -3, -4 |
| ETF Rotation | iloc[-2] |
| Confluence engine | iloc[-2] (ALL reads) |
| AI Reasoner context | iloc[-2] |
| AI Signal Generator | df.iloc[:-1] |
| RL Agent (inference) | RL_INFERENCE env guard |
| Market Regime | iloc[-2] |
Testing
# Python
pytest # Full suite (107+ tests)
pytest tests/test_broker.py # Single file
ruff check . # Lint
ruff format . # Format
# Frontend
cd frontend
npm run build # Production build
# E2E
cd e2e
npx playwright test
Docker
# Development stack
docker-compose up -d
# Production stack (PostgreSQL + Redis + Celery + Nginx)
docker-compose -f docker-compose.prod.yml up -d
# Build image
docker build -t avero:latest .