|
11 | 11 | from application.runtime_reporting_adapters import build_runtime_reporting_adapters |
12 | 12 | from quant_platform_kit.common.runtime_assembly import build_runtime_assembly |
13 | 13 | from quant_platform_kit.common.runtime_target import build_runtime_context_fields |
14 | | -from quant_platform_kit.common.port_adapters import CallablePortfolioPort |
| 14 | +from quant_platform_kit.common.port_adapters import CallableNotificationPort, CallablePortfolioPort |
15 | 15 | from quant_platform_kit.common.runtime_target import RuntimeTarget |
16 | 16 |
|
17 | 17 |
|
@@ -124,16 +124,21 @@ def build_reporting_adapters(self): |
124 | 124 | printer=lambda line: self.printer(line, flush=True), |
125 | 125 | ) |
126 | 126 |
|
127 | | - def build_rebalance_runtime(self): |
| 127 | + def build_rebalance_runtime(self, *, silent_cycle_notifications: bool = False): |
128 | 128 | notification_adapters = self.build_notification_adapters() |
| 129 | + notifications = ( |
| 130 | + CallableNotificationPort(lambda _message: None) |
| 131 | + if silent_cycle_notifications |
| 132 | + else notification_adapters.notification_port |
| 133 | + ) |
129 | 134 | return IBKRRebalanceRuntime( |
130 | 135 | connect_ib=self.connect_ib_fn, |
131 | 136 | portfolio_port_factory=lambda ib: CallablePortfolioPort( |
132 | 137 | lambda: self.build_portfolio_snapshot_fn(ib) |
133 | 138 | ), |
134 | 139 | compute_signals=self.compute_signals_fn, |
135 | 140 | execute_rebalance=self.execute_rebalance_fn, |
136 | | - notifications=notification_adapters.notification_port, |
| 141 | + notifications=notifications, |
137 | 142 | ) |
138 | 143 |
|
139 | 144 | def build_rebalance_config(self, *, extra_notification_lines=()): |
|
0 commit comments