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

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

@@ -772,7 +772,7 @@ def main() -> None:
parser.add_argument(
"--candle-source", default="", choices=["", "kis", "kiwoom"],
dest="candle_source",
help="캔들 소스 필터 (기본 빈문자열 = kis)",
help="캔들 소스: 빈값=실매 LIVE_TICK_PROVIDER 우선 병합, kis|kiwoom=단일 소스",
)
parser.add_argument(
"--tick-source", default="", choices=["", "kis", "kiwoom"],
@@ -802,6 +802,13 @@ def main() -> None:
)
args = parser.parse_args()
if getattr(args, "candle_source", ""):
os.environ["CANDLE_SOURCE"] = str(args.candle_source).strip().lower()
if getattr(args, "tick_source", ""):
os.environ["TICK_SOURCE"] = str(args.tick_source).strip().lower()
if getattr(args, "ob_source", ""):
os.environ["OB_SOURCE"] = str(args.ob_source).strip().lower()
n_trials = args.trials
if n_trials is None:
n_trials = get_env_int("PARAM_SEARCH_OPTUNA_N_TRIALS", 200)