emmanuelakbi commited on
Commit
2c5d02a
·
1 Parent(s): eb4ef03

Simplify Strategist prompt: concrete example instead of rule-chain

Browse files

The previous prompt enumerated so many constraints that Qwen3-14B
loaded them into its deliberation loop and never actually produced
the final structured line, causing parse failures. This version shows
one concrete filled example (AAPL BUY 75% $289 $283 $298) and tells
the model to substitute; the literal example also primes it to emit
concrete numbers in the same shape instead of the 'ACTION / XX%'
placeholders it was echoing back.

The sanity-fix in the parser still corrects runaway numbers if they
slip through.

Files changed (1) hide show
  1. crew/tasks.py +15 -27
crew/tasks.py CHANGED
@@ -91,34 +91,22 @@ def create_strategy_task(agent: Agent, ticker: str, context: list) -> Task:
91
  return Task(
92
  description=(
93
  f"Synthesize all analysis for {ticker} into a final trading signal. "
94
- f"Consider the market conditions, fundamental valuation, technical signals, "
95
- f"and risk parameters. Produce a clear BUY, SELL, or HOLD recommendation "
96
- f"with a confidence percentage.\n\n"
97
- f"CRITICAL PRICE RULEScheck each value before you output it:\n"
98
- f" * Use the CURRENT PRICE reported by the Market Scanner's "
99
- f" get_price_change tool as the basis for Entry. Do NOT invent a "
100
- f" price from memory.\n"
101
- f" * For a BUY recommendation: Stop Loss < Entry < Target. "
102
- f" Target should be at least 3% ABOVE Entry; Stop Loss should be "
103
- f" 1-3% BELOW Entry. If these inequalities do not hold, re-derive "
104
- f" the numbers before returning.\n"
105
- f" * For a SELL recommendation: Target < Entry < Stop Loss. "
106
- f" Target should be at least 3% BELOW Entry; Stop Loss should be "
107
- f" 1-3% ABOVE Entry (to cap loss if the short moves against you).\n"
108
- f" * For a HOLD recommendation: Entry = current price, and Stop Loss / "
109
- f" Target can be left at approximate boundaries of the current range.\n"
110
- f" * The Risk Manager provides ATR-based stop-loss suggestions — "
111
- f" honor them when they satisfy the BUY/SELL inequality above.\n\n"
112
- f"Your output MUST follow this exact format:\n"
113
- f"{ticker} — ACTION (Confidence: XX%)\n"
114
- f"Entry: $XX.XX\n"
115
- f"Stop Loss: $XX.XX\n"
116
- f"Target: $XX.XX\n"
117
  f"Reasoning:\n"
118
- f"- Market: [summary]\n"
119
- f"- Fundamental: [summary]\n"
120
- f"- Technical: [summary]\n"
121
- f"- Risk: [summary]"
 
 
122
  ),
123
  expected_output=(
124
  f"A trading signal in the format: "
 
91
  return Task(
92
  description=(
93
  f"Synthesize all analysis for {ticker} into a final trading signal. "
94
+ f"Use the current price reported by get_price_change as Entry. "
95
+ f"For BUY: Stop Loss below Entry, Target above Entry (within 5%). "
96
+ f"For SELL: Stop Loss above Entry, Target below Entry (within 5%). "
97
+ f"Keep the response concise do not deliberate at length.\n\n"
98
+ f"Output EXACTLY this format on its own lines, with NO extra prose:\n"
99
+ f"{ticker} BUY (Confidence: 75%)\n"
100
+ f"Entry: $289.00\n"
101
+ f"Stop Loss: $283.00\n"
102
+ f"Target: $298.00\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  f"Reasoning:\n"
104
+ f"- Market: [one line]\n"
105
+ f"- Fundamental: [one line]\n"
106
+ f"- Technical: [one line]\n"
107
+ f"- Risk: [one line]\n\n"
108
+ f"(Substitute the real action, confidence, prices, and reasoning; "
109
+ f"keep every line on its own line; do not echo these instructions.)"
110
  ),
111
  expected_output=(
112
  f"A trading signal in the format: "