fix(pmm_mister): declare candles_config field required by backtest engine#149
fix(pmm_mister): declare candles_config field required by backtest engine#149gordonkoehn wants to merge 1 commit intohummingbot:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes backtesting failures for the pmm_mister generic controller by adding the missing candles_config field to PMMisterConfig, matching the schema pattern used by other generic controllers.
Changes:
- Import
CandlesConfiginpmm_mister.py - Add
candles_config: List[CandlesConfig] = []toPMMisterConfigso the backtest engine can safely accessconfig.candles_config
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…gine
PMMisterConfig is the only controller config under bots/controllers/generic/
that doesn't declare `candles_config: List[CandlesConfig] = []`. Every
sibling (pmm.py, pmm_adjusted.py, pmm_dynamic.py, quantum_grid_allocator.py,
etc.) declares it.
The HB backtest engine accesses `self.controller.config.candles_config`
unconditionally in BacktestingEngineBase.initialize_backtesting_data_provider
(hummingbot/strategy_v2/backtesting/backtesting_engine_base.py ~L117), so
calling POST /backtesting/run-backtesting with any pmm_mister config crashes
with:
'PMMisterConfig' object has no attribute 'candles_config'
Attempting to pass `candles_config: []` in the request body is rejected by
Pydantic's `extra="forbid"` — the model has to declare the field itself.
This patch mirrors the exact placement used by pmm.py:23.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
f8d3474 to
1694058
Compare
|
hey @gordonkoehn I think that the new version that I uploaded was working can you verify? |
|
Hey @cardosofede, yes thanks for the heads up – just tested with main (8da18c2) without this patch. WORKS :) /backtesting/run with a pmm_mister config now returns 200 OK. I see you made a new controller.get_candles_config() path with ControllerBase's default makes this unnecessary. Closing #149 as obsolete. Thank you for ppm_mister and continuously improving it all! |
Summary
PMMisterConfigis missing thecandles_configfield. The backtest engine readsself.controller.config.candles_configunconditionally, soPOST /backtesting/run-backtestingon anypmm_misterconfig fails with:Injecting the field via the request payload is rejected by
extra="forbid", so the fix must live on the config class. Every other controller underbots/controllers/generic/already declares this field (pmm.py:23,pmm_adjusted.py:23,lp_rebalancer.py:26) —pmm_mister.pyis the anomaly.Change
Two lines: import
CandlesConfig, addcandles_config: List[CandlesConfig] = []toPMMisterConfig, mirroringpmm.py:23.Suggestion (happy to adjust on feedback)
Since every generic controller declares this field with an identical empty-default, this is arguably better lifted to
ControllerConfigBaseso subclasses can't forget it — the current pattern is a footgun that this bug demonstrates. I scoped this PR to the minimal fix to keep it easy to merge, but happy to open a follow-up refactoringControllerConfigBaseif that approach is preferred.Repro (pure Python, no network)
On
main:AttributeError: 'PMMisterConfig' object has no attribute 'candles_config'. On this branch:OK: candles_config = [].Test plan
main, passes on this branchPOST /backtesting/run-backtestingwith a realpmm_misterconfig + 44h window returns HTTP 200 on this branch; crashes onmainRelated
Splits #(fork PR) into two upstream PRs. This PR is the config-schema fix; the companion PR addresses an independent
KeyErrorinshould_effectivize_executor.🤖 Generated with Claude Code