# LLM Trading Prompt Research - 2026-05-27

## Sources Checked

- TradingAgents paper and repository: multi-agent analyst/researcher/trader/risk/portfolio architecture, structured output, memory log.
- FinMem paper: LLM trading agent needs profiling, layered memory, and a decision module, not only one prompt.
- TradingGroup paper: self-reflection on past successes/failures and dynamic risk management improve decision quality.
- ATLAS paper: adaptive prompt optimization outperformed fixed prompts; outputs should live in an executable order-aware action space.
- ai-hedge-fund repository: deterministic risk manager calculates limits; portfolio LLM receives compact signals and allowed actions only.

## Key Lessons For Our Hyperliquid Bot

1. Single-prompt "pick a trade" is fragile.
   Good systems split roles: market analyst, bull/bear or long/short critic, trader, risk manager, final portfolio/execution manager.

2. The LLM should receive validated features, not raw noise only.
   Useful payload:
   - side-specific trigger state
   - long and short alignment magnitude
   - recent OHLC by timeframe
   - stop/target candidate levels with distance and noise-R
   - spread/freshness/volatility
   - recent similar outcome memory
   - current open exposure and allowed actions

3. Direction needs adversarial comparison.
   Before ENTER, require:
   - long thesis
   - short thesis
   - critical weaknesses of chosen side
   - why the opposite side is not better
   - verdict: chosen_valid / opposite_better / wait_no_clean_side

4. Execution must be order-aware.
   The final LLM output should not be abstract "short looks good". It must be executable:
   - exact entry mode
   - stop invalidation
   - target destination
   - R/R after live fill and fees
   - what condition proves the thesis wrong

5. Memory should be outcome-based, compact, and specific.
   Good memory is not "we lost on NEAR". Good memory is:
   - direction correct?
   - MFE/MAE before exit?
   - which thesis field failed?
   - one rule for similar setups.

6. Reflection alone is not enough.
   ATLAS found adaptive prompt optimization can beat fixed prompts, while plain reflection is not reliably enough. For us this means: log reflections, but replay them against actual OHLC before promoting them into prompt rules.

7. Deterministic risk is still needed.
   ai-hedge-fund style: calculate allowed actions and max size outside the LLM. The LLM chooses only among valid actions. For our bot that means DeepSeek should see `allowed_actions` and should not be able to create an order that violates tick size, stop noise, or account exposure.

## Concrete Changes This Suggests

- Add `side_arbitration` JSON field to the prompt and parser.
- Reject ENTER if `side_arbitration.direction_verdict` says opposite_better or wait_no_clean_side.
- Save `side_arbitration` in journal for every LLM decision/submit/reject.
- Add a second-stage "risk/portfolio judge" later if one-call DeepSeek still ignores weaknesses.
- Build replay tests that compare chosen side vs opposite side over future OHLC using identical risk.

## Current Overnight Mapping

- WLD short: direction was initially right; +1.95R MFE hit a realistic 1.5R target. Failure was target/exit selection: runner target too far against 4h-up context.
- NEAR short: direction/entry quality was weak; chosen side had 15m chop, MACD not bearish, weak sell tape, and no clean >1R continuation before SL.

## Sources

- https://arxiv.org/abs/2412.20138
- https://github.com/TauricResearch/TradingAgents
- https://arxiv.org/abs/2311.13743
- https://arxiv.org/abs/2508.17565
- https://arxiv.org/abs/2510.15949
- https://github.com/virattt/ai-hedge-fund
