From c7a2d65539a4027e0566653cd6dac3a684b66a09 Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Mon, 9 Mar 2026 13:11:40 +0200 Subject: [PATCH] fix(prompts): forbid dynamic quantity expressions, require plain decimal string The model was generating Expr objects for quantity (e.g. ATR-based sizing), causing consistent QuantitySpec deserialization failures. Replace the "prefer dynamic sizing" hint with an explicit rule: quantity must always be a fixed decimal string like "0.001". Co-Authored-By: Claude Sonnet 4.6 --- src/prompts.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/prompts.rs b/src/prompts.rs index b9d1a28..f904518 100644 --- a/src/prompts.rs +++ b/src/prompts.rs @@ -50,9 +50,9 @@ unrealised_pnl — current unrealised P&L bars_since_entry — complete bars elapsed since position was opened balance — free balance of a named asset (e.g. "usdt", "usdc") -### Dynamic quantity -Action quantity can be a fixed string ("0.001") or an Expr for dynamic sizing. -ATR-based sizing, percent-of-balance, etc. +### Quantity +Action quantity MUST be a fixed decimal string, e.g. `"quantity": "0.001"`. +NEVER use an expression object for quantity — only plain decimal strings are accepted. ### Multi-timeframe Any expression can reference a different timeframe via "timeframe" field. @@ -311,6 +311,7 @@ Common mistakes to NEVER make: - Don't ignore fees — a strategy needs to overcome 0.1% per round trip - Always gate buy rules with position state "flat" and sell rules with "long" - Never add a short-entry (sell when flat) rule — spot markets are long-only +- Never use an expression object for `quantity` — it must always be a plain decimal string like `"0.001"` "## ) }