# Paper Trading Quick Start **Last Updated**: 2025-10-14 **Status**: ✅ READY FOR DEPLOYMENT **Time Required**: 15 minutes total --- ## Prerequisites (2 minutes) ```bash # All services must be running docker-compose ps | grep "Up.*healthy" # Expected: 6 services healthy (API Gateway, Trading, PostgreSQL, Redis, Prometheus, Grafana) ``` --- ## Deployment Steps (15 minutes) ### Step 1: Fix Database Tables (5 min) ```bash # Drop incomplete table psql postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt -c "DROP TABLE IF EXISTS ensemble_predictions CASCADE;" # Create fixed version psql postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt << 'SQL' CREATE TABLE ensemble_predictions ( id UUID DEFAULT gen_random_uuid(), timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW(), symbol VARCHAR(20) NOT NULL, ensemble_action VARCHAR(10) NOT NULL, ensemble_signal DOUBLE PRECISION NOT NULL, ensemble_confidence DOUBLE PRECISION NOT NULL, disagreement_rate DOUBLE PRECISION NOT NULL, dqn_signal DOUBLE PRECISION, ppo_signal DOUBLE PRECISION, pnl BIGINT, PRIMARY KEY (id, timestamp) ); CREATE INDEX idx_ensemble_predictions_timestamp ON ensemble_predictions (timestamp DESC); CREATE INDEX idx_ensemble_predictions_symbol ON ensemble_predictions (symbol, timestamp DESC); SELECT create_hypertable('ensemble_predictions', 'timestamp', if_not_exists => TRUE); SQL # Verify tables psql postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt -c "\dt ensemble*" # Expected: ensemble_predictions table ``` ### Step 2: Verify Checkpoints (2 min) ```bash ls -lh ml/trained_models/production/dqn/dqn_epoch_30.safetensors ls -lh ml/trained_models/production/ppo/ppo_*_epoch_{130,420}.safetensors # Expected: 5 files (DQN + 2x PPO actor/critic) ``` ### Step 3: Run Smoke Test (3 min) ```bash bash tests/paper_trading_smoke_test.sh # Expected: Tests Passed: 10/10 ✅ ALL TESTS PASSED ``` ### Step 4: Deploy (5 min) ```bash bash scripts/deploy_paper_trading.sh # Expected: 🎉 Paper trading deployment completed successfully! ``` --- ## Verify Deployment (2 minutes) ```bash # Check Trading Service logs docker logs foxhunt-trading-service --tail 50 | grep -i ensemble # Expected: "Loaded 3 ensemble models" or "Ensemble coordinator initialized" # Check predictions (wait 5-10 minutes for first predictions) psql postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt -c "SELECT COUNT(*) FROM ensemble_predictions WHERE timestamp > NOW() - INTERVAL '1 hour'" # Expected: Count > 0 (after market data flows) # Check Grafana dashboard open http://localhost:3000/d/ensemble-ml-prod # Expected: Dashboard loads with 8 panels ``` --- ## Monitoring (Daily, 5 min) **Grafana**: http://localhost:3000/d/ensemble-ml-prod - Panel 1: Confidence ~0.6-0.8, Disagreement <0.4 - Panel 4: Latency P99 <50μs **PostgreSQL**: ```sql SELECT symbol, COUNT(*) AS predictions, SUM(pnl)/100.0 AS pnl_dollars FROM ensemble_predictions WHERE timestamp > NOW() - INTERVAL '24 hours' GROUP BY symbol; ``` --- ## Success Criteria (7 days) | Metric | Target | Status | |--------|--------|--------| | Sharpe Ratio | >1.5 | Check after 7 days | | Win Rate | >52% | Check daily | | Max Drawdown | <10% | Check daily | | Simulated P&L | >$10,000 | Check daily | | Latency P99 | <50μs | Check real-time | --- ## Emergency Stop ```bash # If something goes wrong docker-compose restart foxhunt-trading-service # If critical failure docker-compose stop foxhunt-trading-service docker logs foxhunt-trading-service > failure_logs.txt # Contact: ml-team@foxhunt.trading ``` --- ## Full Documentation - **Comprehensive Guide**: `PAPER_TRADING_DEPLOYMENT_GUIDE.md` (900 lines) - **5-Phase Checklist**: `PAPER_TRADING_DEPLOYMENT_CHECKLIST.md` (850 lines) - **Configuration**: `config/paper_trading_config.yaml` (150 lines) - **Readiness Report**: `PAPER_TRADING_DEPLOYMENT_READINESS_REPORT.md` (500 lines) --- **Questions?** See FAQ in `PAPER_TRADING_DEPLOYMENT_GUIDE.md` or contact ml-team@foxhunt.trading