--- name: trade-analyze description: "Deep trading analysis with multi-agent debate. Collects comprehensive data, spawns Bull/Bear/Hawk/Dove agents for debate, outputs final verdict. Use when user says /trade-analyze or wants deep analysis." user-invocable: true metadata: { "openclaw": { "emoji": "⚖️", "requires": { "bins": ["curl"] } } } --- # Trade Analysis — Multi-Agent Debate Pipeline **You are the judge. Debate agents work in the background via sessions_spawn. Only YOU post to Discord.** **IMPORTANT: Use `sessions_spawn` (NOT sessions_send — it will timeout).** ## Step 1: Collect Data Run these curl commands using `exec`. Combine into one command for speed: ```bash BASE=https://invest-api.k8s.home # All-in-one summary (quote + profile + metrics + financials) curl -sk "$BASE/api/v1/stock/{TICKER}/summary" # Technical composite (RSI, MACD, SMA, EMA, Bollinger + signals) curl -sk "$BASE/api/v1/stock/{TICKER}/technical" # Composite sentiment (news + analysts + reddit + upgrades) curl -sk "$BASE/api/v1/stock/{TICKER}/sentiment" # Macro overview (Fed rate, yields, CPI, unemployment, GDP, VIX) curl -sk "$BASE/api/v1/macro/overview" # Analyst price targets and recent upgrades/downgrades curl -sk "$BASE/api/v1/stock/{TICKER}/upgrades" # Short selling pressure curl -sk "$BASE/api/v1/stock/{TICKER}/shorts/volume" # CAPM risk decomposition curl -sk "$BASE/api/v1/stock/{TICKER}/capm" # Sortino ratio (downside risk) curl -sk "$BASE/api/v1/stock/{TICKER}/sortino?days=365" ``` Summarize key data points into a concise data package (under 600 words) covering: - Price, PE, ROE, revenue growth, beta - RSI, MACD, SMA alignment, Bollinger position - Sentiment score, insider activity, analyst consensus - Fed rate, yield curve, VIX - Short interest, CAPM alpha - Sortino ratio ## Step 2: Bull Case Use `sessions_spawn`: ```json { "task": "You are the Bull Researcher for {TICKER}. Build your bullish thesis with 3-5 data-backed arguments. Include entry price, target, and timeframe. Under 400 words.\n\nData:\n{data package}", "agentId": "invest-bull", "label": "bull-{TICKER}" } ``` **Wait for announce before proceeding.** ## Step 3: Bear Case ```json { "task": "You are the Bear Researcher for {TICKER}. Bull argued:\n\n{Bull's argument}\n\nCounter with 3-5 data-backed bearish points. Under 400 words.", "agentId": "invest-bear", "label": "bear-{TICKER}" } ``` **Wait for announce.** ## Step 4: Bull Rebuttal (FINAL) ```json { "task": "FINAL rebuttal for {TICKER}. Bear argued:\n\n{Bear's argument}\n\nCounter Bear's strongest point. State your final conviction. Under 300 words.", "agentId": "invest-bull", "label": "bull-final-{TICKER}" } ``` **STOP Bull/Bear after this. Maximum 3 spawns.** ## Step 5: Hawk Risk Formulate a preliminary trading proposal based on the debate, then: ```json { "task": "Aggressive risk assessment for {TICKER}. Propose position size, entry, stop-loss, target with exact numbers.\n\nProposal: {BUY/SELL at $X, stop $Y, target $Z}\nBull case: {summary}\nBear case: {summary}", "agentId": "invest-hawk", "label": "hawk-{TICKER}" } ``` ## Step 6: Dove Risk ```json { "task": "Conservative risk assessment for {TICKER}. Hawk proposed:\n\n{Hawk's response}\n\nPropose safer position sizing and entry strategy. Under 300 words.", "agentId": "invest-dove", "label": "dove-{TICKER}" } ``` ## Step 7: Final Verdict After ALL 5 spawns complete, synthesize and output this **single message** to Discord: ``` # ⚖️ Trading Verdict: {TICKER} ## Decision: [BUY / SELL / HOLD] ## Confidence: {1-10}/10 ### Summary {2-3 sentences — the core thesis} ### 📊 Data Snapshot | Metric | Value | Signal | |--------|-------|--------| | Price | ${} | - | | P/E | {} | {cheap/fair/rich} | | RSI | {} | {OB/OS/neutral} | | MACD | {} | {bull/bear cross} | | Sentiment | {} | {bull/bear/neutral} | | Short Interest | {}% | {low/mod/high} | | VIX | {} | {fear level} | ### Entry Plan | Item | Value | |------|-------| | Action | BUY/SELL/HOLD | | Entry | ${price} | | Stop-loss | ${price} ({%} risk) | | Target | ${price} ({%} upside) | | Position | {%} of portfolio | | Timeframe | {weeks/months} | | Risk:Reward | {ratio} | ### 🐂 Bull Case 1. {strongest data-backed point} 2. {second point} 3. {third point} ### 🐻 Bear Case 1. {strongest data-backed point} 2. {second point} 3. {third point} ### Risk Assessment | Analyst | Position | Stop | Strategy | |---------|----------|------|----------| | 🦅 Hawk | {%} | ${} | {approach} | | 🕊️ Dove | {%} | ${} | {approach} | | **Adopted** | **{%}** | **${}** | **{rationale}** | ### ⚠️ Catalysts & Risks - Upcoming: {earnings date, ex-div date, FOMC meeting if relevant} - Key risk: {single biggest risk} - Key catalyst: {single biggest upside trigger} ``` ## Step 8: Save to Memory Write decision summary to today's memory log. ## Rules 1. **Use `sessions_spawn`** with `agentId` — NOT sessions_send 2. **Wait for each announce** before spawning next 3. **Only YOU post to Discord** — spawn agents are silent 4. **Max 5 spawns**: Bull(2) + Bear(1) + Hawk(1) + Dove(1) 5. If spawn times out, note it and continue 6. **Never use @ mentions** 7. The verdict should be ONE comprehensive message, not multiple