fix: flatten strategy config schema (backtesting broken) #35

Merged
shoko merged 1 commits from fix/issue-25 into main 2026-04-09 09:32:50 +02:00
Owner

Summary

  • LLM was outputting nested params structure but backtest/simulate engines expect flat fields
  • This caused backtesting and simulation to never trigger any trades since conditions never matched

Changes

  • llm_connector.py: Updated prompt to output flat condition structure (token, threshold directly on condition)
  • crew.py StrategyValidator: Updated to validate flat structure instead of nested params.token, params.threshold_percent
  • crew.py StrategyExplainer: Updated to read flat structure

Target Schema

{
  "conditions": [
    {
      "type": "price_drop",
      "token": "PEPE",
      "chain": "bsc",
      "threshold": 5,
      "timeframe": "1h"
    }
  ],
  "actions": [...]
}

Fixes #25

## Summary - LLM was outputting nested `params` structure but backtest/simulate engines expect flat fields - This caused backtesting and simulation to never trigger any trades since conditions never matched ## Changes - **llm_connector.py**: Updated prompt to output flat condition structure (`token`, `threshold` directly on condition) - **crew.py StrategyValidator**: Updated to validate flat structure instead of nested `params.token`, `params.threshold_percent` - **crew.py StrategyExplainer**: Updated to read flat structure ## Target Schema ```json { "conditions": [ { "type": "price_drop", "token": "PEPE", "chain": "bsc", "threshold": 5, "timeframe": "1h" } ], "actions": [...] } ``` Fixes #25
shoko added 1 commit 2026-04-09 09:32:43 +02:00
LLM was outputting nested params structure but engines expect flat fields.
This caused backtesting and simulation to never trigger any trades.

Changes:
- llm_connector.py: Update prompt to output flat condition structure
- crew.py: Update StrategyValidator to validate flat structure
- crew.py: Update StrategyExplainer to read flat structure

Fixes #25
shoko merged commit 8d33ea9a44 into main 2026-04-09 09:32:50 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/randebu#35