From cd037e6c4e3027ebaf9ea308cbd926ae745a79a8 Mon Sep 17 00:00:00 2001 From: AdrianoDev Date: Sat, 9 May 2026 20:38:47 +0200 Subject: [PATCH] feat(scripts): smoke run with mock LLM and synthetic OHLCV Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/smoke_run.py | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 scripts/smoke_run.py diff --git a/scripts/smoke_run.py b/scripts/smoke_run.py new file mode 100644 index 0000000..c0ed0e8 --- /dev/null +++ b/scripts/smoke_run.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +from pathlib import Path + +import numpy as np +import pandas as pd + +from multi_swarm.genome.hypothesis import HypothesisAgentGenome, ModelTier +from multi_swarm.llm.client import CompletionResult +from multi_swarm.orchestrator.run import RunConfig, run_phase1 + + +class MockLLMClient: + def complete( + self, genome: HypothesisAgentGenome, system: str, user: str, + max_tokens: int = 2000, + ) -> CompletionResult: + text = ( + "```lisp\n" + "(strategy" + " (when (gt (indicator rsi 14) 70.0) (entry-short))" + " (when (lt (indicator rsi 14) 30.0) (entry-long)))\n" + "```" + ) + return CompletionResult( + text=text, input_tokens=120, output_tokens=60, + tier=genome.model_tier, model="mock", + ) + + +def main() -> None: + idx = pd.date_range("2024-01-01", periods=1000, freq="1h", tz="UTC") + close = 100 + np.cumsum(np.random.RandomState(0).normal(0.01, 1.0, 1000)) + ohlcv = pd.DataFrame( + {"open": close, "high": close + 0.5, "low": close - 0.5, "close": close, "volume": 1.0}, + index=idx, + ) + cfg = RunConfig( + run_name="smoke", + population_size=3, + n_generations=1, + elite_k=1, + tournament_k=2, + p_crossover=0.5, + seed=0, + model_tier=ModelTier.C, + db_path=Path("./runs.db"), + ) + run_id = run_phase1(cfg, ohlcv=ohlcv, llm=MockLLMClient()) # type: ignore[arg-type] + print(f"Smoke run completed: {run_id}") + + +if __name__ == "__main__": + main()