Prompt: fix method vs kind confusion causing 11/15 validation failures
The 12:11:39 run shows the model using {"method":"position_quantity"} for
every sell rule despite the existing CRITICAL note. Root cause: a contradictory
anti-pattern ("Never use an expression object for quantity") was fighting the
correct guidance, and the method/kind distinction wasn't emphatic enough.
- Expand the CRITICAL note to explicitly contrast: buy uses SizingMethod
("method"), sell uses Expr ("kind") — they are different object types.
- Remove the contradictory "never use an expression object" anti-pattern
which conflicted with position_quantity and SizingMethod objects.
- Add a final anti-pattern bullet as a second reminder of the same mistake.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -110,10 +110,13 @@ Buy a fixed number of base units (semantic alias for a decimal string):
|
|||||||
Alternatively, `"9999"` works for exits: sell quantities are automatically capped to the open
|
Alternatively, `"9999"` works for exits: sell quantities are automatically capped to the open
|
||||||
position size, so a large fixed number is equivalent to `position_quantity`.
|
position size, so a large fixed number is equivalent to `position_quantity`.
|
||||||
|
|
||||||
CRITICAL mistakes to never make:
|
CRITICAL — the `"method"` vs `"kind"` distinction:
|
||||||
- `{{"method":"position_quantity"}}` is WRONG — `position_quantity` is an Expr, not a SizingMethod.
|
- `"method"` belongs ONLY to the three declarative sizing objects: `fixed_sum`, `percent_of_balance`, `fixed_units`.
|
||||||
CORRECT: `{{"kind":"position_quantity"}}`. The `"method"` field belongs ONLY to the three
|
- `"kind"` belongs to Expr objects: `position_quantity`, `bin_op`, `func`, `field`, `literal`, etc.
|
||||||
declarative sizing objects (`fixed_sum`, `percent_of_balance`, `fixed_units`).
|
- `{{"method":"position_quantity"}}` is ALWAYS WRONG. It will be rejected every time.
|
||||||
|
CORRECT: `{{"kind":"position_quantity"}}`.
|
||||||
|
- If you used `{{"method":"percent_of_balance",...}}` for the buy, use `{{"kind":"position_quantity"}}` for the sell.
|
||||||
|
These are different object types — buy uses a SizingMethod (`method`), sell uses an Expr (`kind`).
|
||||||
- `{{"method":"fixed_sum","amount":"100","multiplier":"2.0"}}` is WRONG — `fixed_sum` has no
|
- `{{"method":"fixed_sum","amount":"100","multiplier":"2.0"}}` is WRONG — `fixed_sum` has no
|
||||||
`multiplier` field. Only `amount` is accepted alongside `method`.
|
`multiplier` field. Only `amount` is accepted alongside `method`.
|
||||||
- NEVER add extra fields to SizingMethod objects — they use `additionalProperties: false`.
|
- NEVER add extra fields to SizingMethod objects — they use `additionalProperties: false`.
|
||||||
@@ -483,8 +486,8 @@ CRITICAL: `apply_func` uses `"input"`, not `"expr"`. Writing `"expr":` will be r
|
|||||||
- Don't ignore fees — a strategy needs to overcome 0.1% per round trip
|
- 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"
|
- 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 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.01"`
|
- Never use a placeholder string for `quantity` — `"ATR_SIZED"`, `"FULL_BALANCE"`, `"dynamic"`, etc. are all invalid and will be rejected.
|
||||||
- Never use a placeholder string for `quantity` — `"ATR_SIZED"`, `"FULL_BALANCE"`, `"dynamic"`, etc. are all invalid and will be rejected. Use `"0.01"` or similar.
|
- `{{"method":"position_quantity"}}` is WRONG for exit rules — use `{{"kind":"position_quantity"}}` (see Quantity section above).
|
||||||
"##
|
"##
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user