77from datetime import datetime , timezone
88from typing import Any
99
10+ from quant_platform_kit .strategy_contracts import build_execution_timing_metadata
1011from runtime_logging import RuntimeLogContext
1112
1213
@@ -33,6 +34,7 @@ class IBKRRuntimeReportingAdapters:
3334 strategy_display_name : str = ""
3435 strategy_display_name_localized : str = ""
3536 dry_run : bool = False
37+ signal_effective_after_trading_days : int | None = None
3638 strategy_config_source : str | None = None
3739 ib_gateway_host_resolver : Callable [[], str ] | None = None
3840 ib_gateway_port : int = 0
@@ -84,6 +86,11 @@ def build_log_context(self, *, trace_header: str | None = None) -> RuntimeLogCon
8486 )
8587
8688 def build_report (self , log_context : RuntimeLogContext ) -> dict [str , Any ]:
89+ started_at = self .clock ()
90+ timing_summary = build_execution_timing_metadata (
91+ signal_date = started_at ,
92+ signal_effective_after_trading_days = self .signal_effective_after_trading_days ,
93+ )
8794 return self .report_builder (
8895 platform = log_context .platform ,
8996 deploy_target = log_context .deploy_target ,
@@ -95,7 +102,7 @@ def build_report(self, log_context: RuntimeLogContext) -> dict[str, Any]:
95102 run_id = log_context .run_id ,
96103 run_source = "cloud_run" ,
97104 dry_run = self .dry_run ,
98- started_at = self . clock () ,
105+ started_at = started_at ,
99106 summary = {
100107 "account_ids" : list (self .extra_context_fields .get ("account_ids" ) or ()),
101108 "managed_symbols" : list (self .managed_symbols ),
@@ -104,6 +111,7 @@ def build_report(self, log_context: RuntimeLogContext) -> dict[str, Any]:
104111 "safe_haven" : self .safe_haven ,
105112 "strategy_display_name" : self .strategy_display_name ,
106113 "strategy_display_name_localized" : self .strategy_display_name_localized ,
114+ ** timing_summary ,
107115 },
108116 diagnostics = {
109117 "strategy_config_source" : self .strategy_config_source ,
@@ -165,6 +173,7 @@ def build_runtime_reporting_adapters(
165173 strategy_display_name : str ,
166174 strategy_display_name_localized : str ,
167175 dry_run : bool ,
176+ signal_effective_after_trading_days : int | None ,
168177 strategy_config_source : str | None ,
169178 ib_gateway_host_resolver : Callable [[], str ],
170179 ib_gateway_port : int ,
@@ -204,6 +213,7 @@ def build_runtime_reporting_adapters(
204213 strategy_display_name = str (strategy_display_name or "" ),
205214 strategy_display_name_localized = str (strategy_display_name_localized or "" ),
206215 dry_run = bool (dry_run ),
216+ signal_effective_after_trading_days = signal_effective_after_trading_days ,
207217 strategy_config_source = strategy_config_source ,
208218 ib_gateway_host_resolver = ib_gateway_host_resolver ,
209219 ib_gateway_port = int (ib_gateway_port ),
0 commit comments