@@ -16,6 +16,7 @@ from collections.abc import Callable
|
||||
from datetime import UTC, date, datetime, time, timedelta, timezone
|
||||
|
||||
from trex_core.application.alarm_emitter import AlarmEmitter
|
||||
from trex_core.application.auto_reconcile import AutoReconcileStore
|
||||
from trex_core.application.balance_health import BalanceHealthTracker
|
||||
from trex_core.application.broker_port import BrokerBalanceError, BrokerPort
|
||||
from trex_core.application.portfolio import (
|
||||
@@ -55,6 +56,8 @@ class SnapshotScheduler:
|
||||
warn_store: ReconcileWarningStore | None = None,
|
||||
notification_store: ReconcileNotificationStore | None = None,
|
||||
unmanaged_position_store: UnmanagedPositionStore | None = None,
|
||||
cost_basis_port=None,
|
||||
auto_reconcile_store: AutoReconcileStore | None = None,
|
||||
credential_fetch_enabled: bool = False,
|
||||
kis_reinit_callback: Callable[[BrokerCredentialPayload], None] | None = None,
|
||||
credential_refresh: Callable[[], object] | None = None,
|
||||
@@ -81,6 +84,8 @@ class SnapshotScheduler:
|
||||
# req-0007 / ac-0024: durable notification deduplication store (Optional).
|
||||
self._notification_store = notification_store
|
||||
self._unmanaged_position_store = unmanaged_position_store
|
||||
self._cost_basis_port = cost_basis_port
|
||||
self._auto_reconcile_store = auto_reconcile_store
|
||||
# dcy-036 / REQ-113/114/115: credential fetch opt-in + break-glass detection.
|
||||
# credential_fetch_enabled=False (default) → env-only, no portfolio-hub fetch.
|
||||
self._credential_fetch_enabled: bool = credential_fetch_enabled
|
||||
@@ -332,7 +337,7 @@ class SnapshotScheduler:
|
||||
if self._slot_service is not None:
|
||||
try:
|
||||
# BAT-050 / REQ-103: pass warn_store for B-case durable warning.
|
||||
self._run_core_holding_reconciliation_worker()
|
||||
self._run_core_holding_reconciliation_worker(items)
|
||||
except Exception: # noqa: BLE001
|
||||
_log.exception("core-holding divergence reconcile failed")
|
||||
self._last_fired_date = self._clock()
|
||||
@@ -353,7 +358,7 @@ class SnapshotScheduler:
|
||||
),
|
||||
)
|
||||
|
||||
def _run_core_holding_reconciliation_worker(self) -> None:
|
||||
def _run_core_holding_reconciliation_worker(self, items=None) -> None:
|
||||
from trex_core.application.reconciliation import reconcile_core_holdings
|
||||
|
||||
self._run_balance_worker(
|
||||
@@ -368,6 +373,13 @@ class SnapshotScheduler:
|
||||
warn_store=self._warn_store, # BAT-050 / REQ-103
|
||||
notification_store=self._notification_store, # req-0007 / ac-0024
|
||||
unmanaged_position_store=self._unmanaged_position_store,
|
||||
portfolio_items=(
|
||||
list(items)
|
||||
if items is not None
|
||||
else [asset.item for asset in self._store.list_assets()]
|
||||
),
|
||||
cost_basis_port=self._cost_basis_port,
|
||||
auto_reconcile_store=self._auto_reconcile_store,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user