거래 빠르게 안티에서 병신만든거 커서로

feat: Implement backtest source management and enhance candle data handling

Changes:
- Introduced a new function `_apply_backtest_source_env_from_request` to manage the environment variables for candle, tick, and order book sources based on incoming requests.
- Added a teardown function `_teardown_backtest_source_env` to ensure that environment variables do not persist between requests, enhancing the stability of the backtesting environment.
- Refactored existing code to utilize the new source management functions, improving code readability and maintainability.
- Added new utility functions in `bt_candle_source.py` for fetching and managing candle data, ensuring consistency with live trading data sources.

Impact:
- These changes improve the flexibility and reliability of the backtesting framework, allowing for better management of data sources and reducing the risk of cross-request contamination.
This commit is contained in:
Your Name
2026-08-13 16:03:40 +09:00
parent c6bd62a25f
commit 2c7ad867f4
53 changed files with 15251 additions and 637 deletions

View File

@@ -400,6 +400,13 @@ def _summarize_result_json(path: Optional[str]) -> Optional[Dict[str, Any]]:
"top5_stable": top5_stable,
"mode_combo_note": mc.get("note"),
"daily_trail_recommend": trail_rec,
# 후처리 추천 (탐색 trial 아님) — 웹 Optuna 탭 표용. STOP_OB 합의는 아직 없음.
"orderbook_recommend": data.get("orderbook_recommend")
if isinstance(data.get("orderbook_recommend"), dict)
else (mc.get("orderbook_recommend") if isinstance(mc.get("orderbook_recommend"), dict) else None),
"whipsaw_recommend": data.get("whipsaw_recommend")
if isinstance(data.get("whipsaw_recommend"), dict)
else (mc.get("whipsaw_recommend") if isinstance(mc.get("whipsaw_recommend"), dict) else None),
"apply_ready": bool(gate0) and float(gate0.get("total_pnl") or 0) > 0,
"apply_stable_ready": bool(stab0) and float(stab0.get("total_pnl") or 0) > 0,
"briefing_md": briefing,