Validation & Infrastructure All Markets

Trading Orchestrator

Paste into Claude, ChatGPT, or any coding agent

This is the master routing skill for CLI Trader. It does not contain deep methodology itself — instead, it detects what the user is trying to do, selects the appropriate specialized skills, enforces the mandatory risk gate, and routes to execution. Every trade workflow flows through this orchestrator.

Quick Reference

Command / RequestWhat It DoesPrimary Skill(s)
“Analyze [stock]“Full equity analysisFundamental Analysis + Technical Analysis
”Analyze [crypto]“Full crypto analysisOnchain Analysis + Technical Analysis + Fundamental Analysis
”Should I buy [asset]?”Trade setup with recommendationAsset-type routing + Risk Management
”Set up a DeFi yield position”Yield farming workflowDeFi Yield + Onchain Analysis
”Market make [pair]“Market making setupMarket Making + Risk Management
”Find an arbitrage opportunity”Cross-exchange/DEX arb scanMEV & Arbitrage + Order Execution
”Backtest [strategy]“Strategy validationBacktesting Validation + Signal Research
”Bet on [prediction market]“Prediction market analysisPrediction Markets + Sentiment Analysis
”Trade [memecoin]“High-risk memecoin workflowMemecoin Trading + Onchain Analysis
”Check my portfolio risk”Portfolio risk analysisPortfolio Management + Risk Management
”Size a position for [trade]“Position sizingRisk Management
”Execute [trade]“Order executionOrder Execution (after risk gate)
“Solana DeFi”Solana-specific DeFiSolana DeFi + DeFi Yield
”Options strategy for [asset]“Options analysisOptions Strategies + Technical Analysis
”What’s the sentiment on [asset]?”Sentiment checkSentiment Analysis
”Find trading signals”Quantitative signal scanSignal Research + Momentum Trading
”Set up agent trading”Autonomous agent configAgent Trading Guardrails + Risk Management
”Help me trade”General intakeThis skill (interview user, then route)

Orchestration Logic

Step 1: Detect Asset Type

INPUT CLASSIFICATION

User mentions stock ticker (AAPL, NVDA, TSLA, etc.)
  → Asset type: EQUITY
  → Primary skills: fundamental-analysis, technical-analysis

User mentions major crypto (BTC, ETH, SOL, etc.)
  → Asset type: CRYPTO_MAJOR
  → Primary skills: technical-analysis, onchain-analysis, fundamental-analysis

User mentions DeFi token (AAVE, UNI, MKR, etc.)
  → Asset type: DEFI_TOKEN
  → Primary skills: fundamental-analysis, onchain-analysis, defi-yield

User mentions memecoin (DOGE, SHIB, PEPE, WIF, BONK, etc.)
  → Asset type: MEMECOIN
  → Primary skills: memecoin-trading, onchain-analysis, sentiment-analysis

User mentions prediction market (Polymarket, election, event)
  → Asset type: PREDICTION_MARKET
  → Primary skills: prediction-markets, sentiment-analysis

User mentions LP / yield / farming
  → Asset type: DEFI_YIELD
  → Primary skills: defi-yield, market-making (if LP), onchain-analysis

User mentions options / calls / puts / Greeks
  → Asset type: OPTIONS
  → Primary skills: options-strategies, technical-analysis

User mentions arbitrage / MEV / price difference
  → Asset type: ARBITRAGE
  → Primary skills: mev-arbitrage, order-execution

User request is unclear
  → Ask clarifying questions (see intake interview below)

Step 2: Standard Analysis Pipeline

Every trade workflow follows this sequence. Steps cannot be skipped.

STANDARD PIPELINE

[1] IDENTIFY    → Classify asset type and user intent
                   (this skill — trading-orchestrator)

[2] ANALYZE     → Run appropriate analysis skills in parallel
                   (varies by asset type — see routing table below)

[3] RISK GATE   → MANDATORY: Pass through risk-management
                   - Position sizing
                   - Stop-loss placement
                   - Portfolio-level checks
                   - Leverage assessment (if applicable)
                   - Agent guardrails (if autonomous)
                   *** TRADE IS BLOCKED IF RISK GATE FAILS ***

[4] EXECUTE     → Route to order-execution
                   - Exchange selection
                   - Order type selection
                   - Slippage estimation
                   - Human confirmation (ALWAYS required)

[5] MONITOR     → Post-execution monitoring
                   - portfolio-management for position tracking
                   - alert-manager for price/event alerts
                   - Trailing stop management

Step 3: Asset-Type Routing Table

ROUTING: Asset Type → Analysis Skills (run in parallel where possible)

EQUITY
  ├── fundamental-analysis  (valuation, earnings, DCF)
  ├── technical-analysis    (chart patterns, indicators, entry/exit)
  ├── sentiment-analysis    (news sentiment, analyst consensus)
  └── THEN → risk-management → order-execution

CRYPTO_MAJOR (BTC, ETH, SOL, etc.)
  ├── technical-analysis    (chart analysis, momentum indicators)
  ├── onchain-analysis      (whale flows, exchange balances, network activity)
  ├── fundamental-analysis  (tokenomics, protocol metrics)
  ├── sentiment-analysis    (social media, funding rates)
  └── THEN → risk-management → order-execution

DEFI_TOKEN
  ├── fundamental-analysis  (protocol revenue, TVL, P/F ratio)
  ├── onchain-analysis      (whale wallets, smart money, contract analysis)
  ├── defi-yield            (if yield opportunity exists)
  ├── technical-analysis    (chart levels, liquidity zones)
  └── THEN → risk-management → order-execution

MEMECOIN
  ├── memecoin-trading      (rug pull checks, holder analysis, social signals)
  ├── onchain-analysis      (contract audit, whale concentration, LP lock)
  ├── sentiment-analysis    (social momentum, influencer activity)
  ├── *** EXTRA RISK WARNINGS APPLIED ***
  └── THEN → risk-management (with memecoin risk overrides) → order-execution

PREDICTION_MARKET
  ├── prediction-markets    (market analysis, probability assessment)
  ├── sentiment-analysis    (news, polls, data sources)
  ├── fundamental-analysis  (event fundamentals, base rates)
  └── THEN → risk-management → order-execution

DEFI_YIELD
  ├── defi-yield            (yield analysis, IL estimation, protocol risk)
  ├── onchain-analysis      (TVL trends, smart contract risk)
  ├── market-making         (if concentrated LP position)
  └── THEN → risk-management → order-execution

OPTIONS
  ├── options-strategies    (strategy selection, Greeks, max loss)
  ├── technical-analysis    (underlying chart, support/resistance)
  ├── fundamental-analysis  (earnings proximity, IV rank)
  └── THEN → risk-management → order-execution

ARBITRAGE
  ├── mev-arbitrage         (opportunity identification, profitability analysis)
  ├── onchain-analysis      (gas estimation, DEX liquidity depth)
  └── THEN → risk-management → order-execution

SOLANA_SPECIFIC
  ├── solana-defi           (Solana ecosystem specifics)
  ├── defi-yield            (yield comparison)
  ├── onchain-analysis      (Solana on-chain metrics)
  └── THEN → risk-management → order-execution

Step 4: Risk Gate Enforcement

The risk gate is NON-NEGOTIABLE. Every workflow passes through risk-management.

RISK GATE REQUIREMENTS

Before ANY trade reaches order-execution:

  [x] Position size calculated (method documented)
  [x] Stop-loss defined (level and method)
  [x] Risk/reward ratio meets minimum for strategy type
  [x] Portfolio heat check passed
  [x] Concentration check passed
  [x] Correlation check passed
  [x] Liquidity check passed
  [x] If leveraged: liquidation distance verified
  [x] If agent mode: agent-trading-guardrails checks passed

RISK GATE OUTCOMES:
  APPROVED        → Proceed to order-execution
  APPROVED w/WARN → Proceed but flag warnings to user
  BLOCKED         → Trade cannot execute, explain why
  REDUCED         → Trade approved at smaller size, explain adjustment

Step 5: Agent Mode (Autonomous Trading)

When operating as an autonomous agent, apply additional guardrails:

AGENT MODE PIPELINE

Standard pipeline PLUS:
  - agent-trading-guardrails loaded before any execution
  - Per-trade limit: 0.5% of portfolio (not 1-2%)
  - Daily loss limit: 2% → auto-pause
  - Max trades/day: 10
  - New asset: requires human approval
  - Leverage > 2x: requires human approval
  - Every decision logged with full reasoning

AGENT KILL SWITCHES:
  - 3 consecutive losses → 1-hour pause
  - Daily drawdown > 5% → session halt
  - API error → immediate halt
  - Market volatility spike (>3 std dev) → pause and notify

Step 6: Intake Interview (When Request is Unclear)

If the user’s request does not clearly map to an asset type or workflow, conduct a brief intake:

INTAKE QUESTIONS (ask only what's needed)

1. What asset or market are you interested in?
   → Routes to asset type classification

2. What is your goal?
   a) Analyze for potential trade → analysis pipeline
   b) Execute a specific trade → risk gate + execution
   c) Manage existing position → portfolio-management
   d) Set up automated strategy → agent mode
   e) Learn / research → educational mode (analysis without execution)

3. What is your time horizon?
   a) Scalp (minutes to hours) → technical-analysis focus
   b) Swing (days to weeks) → technical + fundamental
   c) Position (weeks to months) → fundamental focus
   d) Long-term hold (months+) → fundamental + portfolio-management

4. What is your risk tolerance?
   → Maps to conservative/moderate/aggressive in risk-management

Cross-Reference Architecture

How all 20 skills connect:

                        ┌──────────────────────┐
                        │  trading-orchestrator │  ← YOU ARE HERE
                        │  (master router)      │
                        └──────────┬───────────┘

              ┌────────────────────┼────────────────────┐
              │                    │                     │
     ┌────────▼────────┐  ┌───────▼───────┐  ┌─────────▼────────┐
     │  ANALYSIS LAYER │  │  RISK LAYER   │  │ EXECUTION LAYER  │
     │                 │  │               │  │                  │
     │ technical-      │  │ risk-         │  │ order-execution  │
     │   analysis      │  │   management  │  │                  │
     │ fundamental-    │  │ portfolio-    │  │ agent-trading-   │
     │   analysis      │  │   management  │  │   guardrails     │
     │ onchain-        │  │               │  │                  │
     │   analysis      │  └───────────────┘  └──────────────────┘
     │ sentiment-      │
     │   analysis      │     *** MANDATORY ***
     │ signal-research │     Every workflow passes
     └────────┬────────┘     through risk layer

     ┌────────▼────────────────────────────┐
     │          STRATEGY LAYER             │
     │                                     │
     │ momentum-trading   mean-reversion   │
     │ options-strategies market-making    │
     │ defi-yield         solana-defi      │
     │ prediction-markets mev-arbitrage    │
     │ memecoin-trading                    │
     └────────┬────────────────────────────┘

     ┌────────▼────────┐
     │ VALIDATION LAYER│
     │                 │
     │ backtesting-    │
     │   validation    │
     └─────────────────┘

Sub-Skills

This orchestrator routes to all 19 other trading skills:

#SkillRole
1Technical AnalysisChart patterns, indicators, support/resistance
2Momentum TradingTrend-following and momentum strategies
3Mean ReversionMean-reversion setups and statistical arbitrage
4Options StrategiesOptions strategy selection and Greeks analysis
5Market MakingAutomated market making and LP strategies
6Onchain AnalysisBlockchain data, whale tracking, contract analysis
7Sentiment AnalysisNews, social media, and market sentiment
8Fundamental AnalysisValuation, earnings, tokenomics, macro
9Signal ResearchQuantitative signal generation and testing
10Risk ManagementPosition sizing, stop-losses, portfolio risk (MANDATORY)
11Order ExecutionOrder types, execution algorithms, slippage
12Portfolio ManagementAllocation, rebalancing, performance attribution
13DeFi YieldDeFi yield farming, lending, LP optimization
14Solana DeFiSolana-specific DeFi protocols and strategies
15Prediction MarketsPolymarket, event contracts, probability analysis
16MEV & ArbitrageArbitrage identification and MEV awareness
17Memecoin TradingHigh-risk memecoin trading with safety checks
18Backtesting ValidationStrategy backtesting and validation
19Agent Trading GuardrailsAutonomous agent safety limits and kill switches

Quality Gates

Hard rules that apply across ALL workflows:

UNIVERSAL RULES

1. RISK GATE IS MANDATORY
   No trade reaches execution without passing risk-management validation.
   No exceptions. No overrides.

2. HUMAN CONFIRMATION REQUIRED
   Even in agent mode, order-execution requires human confirmation
   for trades above threshold (default: 1% of portfolio).

3. NEVER SKIP ANALYSIS
   "Just buy it" is not a valid workflow. Minimum analysis:
   - Technical: current trend direction + key levels
   - Risk: position size + stop-loss

4. DOCUMENT REASONING
   Every trade recommendation includes:
   - Why this trade (thesis)
   - Entry, stop, target
   - Position size and risk amount
   - What would invalidate the thesis

5. MEMECOIN / HIGH-RISK ASSETS
   Automatically trigger additional warnings:
   - Max 1-2% of portfolio
   - Must pass rug pull checks
   - Time-limited exposure (set exit deadline)