Files
foxhunt/fxt/docs/ML_TRADING_COMMANDS.md
jgrusewski 2da5bafc0e refactor: rename tli→fxt, delete legacy scripts/RunPod/deploy artifacts
- Rename tli/ directory to fxt/, update package + binary name to "fxt"
- Replace all `use tli::` → `use fxt::` across 52 Rust files
- Update build.rs proto paths (tli/proto → fxt/proto) in 6 services
- Update Dockerfiles, CI workflows, deploy.sh for new paths
- Delete ~170 legacy shell scripts (kept 15 essential ones)
- Delete RunPod Python client (runpod/), tests (tests/runpod/)
- Delete foxhunt-deploy crate (RunPod-only deployment tool)
- Delete terraform/runpod/ (moved to Scaleway)
- Delete ML Python hyperopt scripts (replaced by Rust Argmin PSO)
- Delete .gitlab-ci.yml (using GitHub + Gitea)
- Remove foxhunt-deploy from workspace members

504 files changed, -74,355 lines of legacy code removed.
Workspace compiles clean (0 errors, 0 warnings).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:32:21 +01:00

6.7 KiB

TLI ML Trading Commands

Complete guide to using TLI's ML-powered trading commands for automated order submission, prediction history, and model performance monitoring.

Prerequisites

  • TLI installed and authenticated (tli auth login)
  • API Gateway running (port 50051)
  • Trading Service running (port 50052)
  • Valid JWT with trading.submit and trading.view scopes

Commands Overview

tli trade ml submit       # Submit ML-generated orders
tli trade ml predictions  # View prediction history
tli trade ml performance  # View model performance metrics

1. Submit ML Orders

Basic Usage (Ensemble Mode)

tli trade ml submit --symbol ES.FUT --account my_account

Output:

✅ ML order submitted successfully!

Order ID: 550e8400-e29b-41d4-a716-446655440000
Symbol: ES.FUT
Model: Ensemble (4 models)
Predicted Action: BUY
Confidence: 87.2%
Quantity: 1
Account: my_account

Single Model Mode

tli trade ml submit --symbol ES.FUT --account my_account --model DQN

Available Models:

  • DQN - Deep Q-Network (RL agent)
  • MAMBA2 - Mamba-2 State Space Model
  • PPO - Proximal Policy Optimization
  • TFT - Temporal Fusion Transformer
  • TLOB - Temporal Limit Order Book (requires L2 data, pending training)
  • Liquid - Liquid Neural Network (CUDA validation complete, pending training)

Arguments

Argument Required Description
--symbol Trading symbol (ES.FUT, NQ.FUT, etc.)
--account Account ID for order submission
--model Specific model (default: ensemble)

Examples

# Ensemble prediction for ES.FUT
tli trade ml submit --symbol ES.FUT --account prod_account

# MAMBA-2 prediction for NQ.FUT
tli trade ml submit --symbol NQ.FUT --account test_account --model MAMBA2

# PPO prediction for ZN.FUT
tli trade ml submit --symbol ZN.FUT --account rl_account --model PPO

2. View ML Predictions

Basic Usage

tli trade ml predictions --symbol ES.FUT

Output:

ML Predictions for ES.FUT (Last 10)

┌─────────────────────┬────────┬─────────┬────────┬────────────┬─────────┐
│ Timestamp           │ Model  │ Symbol  │ Action │ Confidence │ Outcome │
├─────────────────────┼────────┼─────────┼────────┼────────────┼─────────┤
│ 2025-10-16 07:30:00 │ DQN    │ ES.FUT  │ BUY    │ 87.2%      │ +0.5%   │
│ 2025-10-16 07:25:00 │ MAMBA2 │ ES.FUT  │ HOLD   │ 72.1%      │ N/A     │
│ 2025-10-16 07:20:00 │ PPO    │ ES.FUT  │ SELL   │ 81.3%      │ +0.3%   │
└─────────────────────┴────────┴─────────┴────────┴────────────┴─────────┘

With Filters

# Filter by model
tli trade ml predictions --symbol ES.FUT --model MAMBA2

# Limit results
tli trade ml predictions --symbol ES.FUT --limit 50

# Combined filters
tli trade ml predictions --symbol ES.FUT --model DQN --limit 20

Arguments

Argument Required Description
--symbol Trading symbol to query
--model Filter by specific model
--limit Max results (default: 10, max: 100)

3. View Model Performance

All Models

tli trade ml performance

Output:

ML Model Performance (Last 30 days)

┌────────┬──────────┬──────────────┬──────────────┬───────────┬────────────┐
│ Model  │ Accuracy │ Predictions  │ Sharpe Ratio │ Avg Return│ Max Drawdown│
├────────┼──────────┼──────────────┼──────────────┼───────────┼────────────┤
│ DQN    │ 68.2%    │ 1,243        │ 1.42         │ +2.1%     │ -3.2%      │
│ MAMBA2 │ 72.5%    │ 1,189        │ 1.67         │ +2.8%     │ -2.1%      │
│ PPO    │ 65.3%    │ 1,156        │ 1.18         │ +1.5%     │ -4.5%      │
│ TFT    │ 70.1%    │ 1,221        │ 1.53         │ +2.4%     │ -2.8%      │
└────────┴──────────┴──────────────┴──────────────┴───────────┴────────────┘

Ensemble Confidence Threshold: 0.60
Active Models: 4/6 (TLOB and Liquid NN training pending)

Single Model

tli trade ml performance --model MAMBA2

Arguments

Argument Required Description
--model Filter by specific model (shows all if omitted)

Performance Metrics Explained

  • Accuracy: Percentage of correct predictions (BUY when price goes up, SELL when down)
  • Sharpe Ratio: Risk-adjusted returns (>1.0 is good, >2.0 is excellent)
  • Avg Return: Average profit/loss per trade
  • Max Drawdown: Largest peak-to-trough decline

Ensemble Mode

When no --model is specified, TLI uses ensemble mode:

  1. Queries all active models
  2. Weights predictions by confidence scores
  3. Calculates ensemble vote
  4. Uses weighted average for final decision

Benefits:

  • More robust predictions
  • Reduced single-model bias
  • Higher confidence threshold (0.60 vs 0.50)

Troubleshooting

"Not authenticated"

tli auth login

"Permission denied"

Verify JWT has trading.submit and trading.view scopes:

tli auth token --decode

"Trading Service unavailable"

Check service status:

docker-compose ps trading_service
curl http://localhost:8081/health

"Model not found"

Ensure model is trained and deployed. Check model status:

tli trade ml performance

Best Practices

  1. Start with Ensemble Mode: More reliable than single models
  2. Monitor Performance: Check tli trade ml performance weekly
  3. Use Paper Trading First: Test in simulation before live capital
  4. Set Confidence Thresholds: Only trade when confidence >70%
  5. Diversify Across Models: Don't rely on single model predictions

See Also