refactor: comprehensive skill rewrite with professional analyst perspective
All checks were successful
continuous-integration/drone/push Build is passing

Coverage: 19% → 67% of API endpoints (88/131)

market-analysis: 5 → 15 endpoints (all 14 technical indicators + historical)
- Added: ADX, Stochastic, Keltner, Donchian, Aroon, CCI, Fib, A/D, Cones, VWAP
- Added confluence/divergence analysis guidance

fundamental-analysis: 5 → 12 endpoints
- Added: summary (all-in-one), CAPM, Sortino, Omega, estimates,
  share-statistics, institutional, dividends, calendar/earnings
- Added institutional ownership and earnings catalyst flagging

sentiment-analysis: 5 → 16 endpoints
- Added: reddit-sentiment, social-sentiment, shorts/ftd, darkpool/otc,
  share-statistics, institutional, congress/trades
- Restructured as smart money vs retail noise hierarchy

macro-analysis: 6 → 23 endpoints
- Added: treasury-rates, effr, sofr, spreads, hqm, tips-yields,
  pce, gdp, unemployment, money-measures, cli, sloos,
  nonfarm-payrolls, empire-state, central-bank-holdings,
  fomc-documents, sp500-multiples
- Added business cycle positioning framework

trade-analyze: updated data collection to use /summary endpoint

AGENTS.md (all 4 debate agents): updated for sessions_spawn protocol
SOUL.md (all 4): removed unavailable memory_search, REPLY_SKIP refs
deploy.sh: fixed nvm loading for SSH
This commit is contained in:
Yaojia Wang
2026-03-21 19:11:33 +01:00
parent 5be9385c9f
commit 880f830741
5 changed files with 393 additions and 165 deletions

View File

@@ -1,6 +1,6 @@
---
name: trade-analyze
description: "Deep trading analysis with multi-agent debate. Use sessions_spawn to delegate to invest-bull, invest-bear, invest-hawk, invest-dove. Triggered by /trade-analyze or deep analysis requests."
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"] } } }
---
@@ -9,68 +9,93 @@ metadata: { "openclaw": { "emoji": "⚖️", "requires": { "bins": ["curl"] } }
**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). sessions_send will timeout due to gateway architecture.**
**IMPORTANT: Use `sessions_spawn` (NOT sessions_send — it will timeout).**
## Step 1: Collect Data
Run these curl commands using the `exec` tool:
Run these curl commands using `exec`. Combine into one command for speed:
```bash
curl -sk "https://invest-api.k8s.home/api/v1/stock/{TICKER}/technical"
curl -sk "https://invest-api.k8s.home/api/v1/stock/{TICKER}/metrics"
curl -sk "https://invest-api.k8s.home/api/v1/stock/{TICKER}/sentiment"
curl -sk "https://invest-api.k8s.home/api/v1/macro/overview"
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 (under 500 words).
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 the `sessions_spawn` tool:
Use `sessions_spawn`:
```json
{
"task": "You are the Bull Researcher. Based on the following data for {TICKER}, build your bullish investment thesis with 3-5 specific data-backed arguments. Keep under 400 words.\n\nData:\n{data summary}",
"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}"
}
```
sessions_spawn returns immediately with `{ status: "accepted", runId }`. The result will be announced back to you automatically when Bull finishes. **Wait for the announce before proceeding.**
**Wait for announce before proceeding.**
## Step 3: Bear Case
After receiving Bull's result, use `sessions_spawn`:
```json
{
"task": "You are the Bear Researcher. For {TICKER}, Bull argued:\n\n{Bull's argument}\n\nBuild your bearish counter-argument with 3-5 specific data-backed points. Keep under 400 words.",
"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 Bear's announce.
**Wait for announce.**
## Step 4: Bull Rebuttal (FINAL)
```json
{
"task": "You are the Bull Researcher. Bear responded:\n\n{Bear's argument}\n\nThis is your FINAL rebuttal. Counter Bear's strongest point. Keep under 300 words.",
"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 debate after this. Maximum 3 spawns for Bull/Bear.**
**STOP Bull/Bear after this. Maximum 3 spawns.**
## Step 5: Hawk Risk
Formulate a trading proposal, then:
Formulate a preliminary trading proposal based on the debate, then:
```json
{
"task": "You are the Hawk (aggressive) Risk Analyst. Evaluate this {TICKER} trading proposal. Propose position size, entry, stop-loss with specific numbers.\n\nProposal: {direction, entry, stop, target}",
"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}"
}
@@ -80,15 +105,15 @@ Formulate a trading proposal, then:
```json
{
"task": "You are the Dove (conservative) Risk Analyst. Hawk proposed:\n\n{Hawk response}\n\nEvaluate from capital preservation perspective. Propose safer sizing.\n\nKeep under 300 words.",
"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 (ONLY output to Discord)
## Step 7: Final Verdict
After all spawns complete, synthesize and output:
After ALL 5 spawns complete, synthesize and output this **single message** to Discord:
```
# ⚖️ Trading Verdict: {TICKER}
@@ -97,7 +122,18 @@ After all spawns complete, synthesize and output:
## Confidence: {1-10}/10
### Summary
{2-3 sentences}
{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 |
@@ -107,34 +143,42 @@ After all spawns complete, synthesize and output:
| Stop-loss | ${price} ({%} risk) |
| Target | ${price} ({%} upside) |
| Position | {%} of portfolio |
| Timeframe | {weeks/months} |
| Risk:Reward | {ratio} |
### 🐂 Bull Case
1. {point}
2. {point}
3. {point}
1. {strongest data-backed point}
2. {second point}
3. {third point}
### 🐻 Bear Case
1. {point}
2. {point}
3. {point}
1. {strongest data-backed point}
2. {second point}
3. {third point}
### Risk Assessment
| Analyst | Position | Stop | View |
|---------|----------|------|------|
| 🦅 Hawk | {%} | ${} | {line} |
| 🕊️ Dove | {%} | ${} | {line} |
| **Final** | **{%}** | **${}** | **{why}** |
| 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 to today's memory log.
Write decision summary to today's memory log.
## Rules
1. **Use `sessions_spawn`** with `agentId` — NOT sessions_send (it will timeout)
2. **Wait for each announce** before spawning the next agent
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 spawns**: Bull(2) + Bear(1) + Hawk(1) + Dove(1) = 5 total
5. If spawn times out, skip and continue
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