Compare commits

...
5 Commits
Author SHA1 Message Date
Celes Renata c43865cc9c ci: verify Woodpecker OAuth reconnection
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/build-2 Pipeline was successful
ci/woodpecker/push/build-3 Pipeline was successful
ci/woodpecker/push/build-1 Pipeline was successful
ci/woodpecker/push/finalize Pipeline was successful
Build and Push / lint-and-test (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Canceled after 0s
Build and Push / build-dashboard (push) Canceled after 0s
Build and Push / build-superset (push) Canceled after 0s
Build and Push / integration-test (push) Canceled after 0s
Build and Push / beta-gate (push) Canceled after 0s
2026-07-21 21:57:45 +00:00
Celes Renata 987b32d2ff fix: reduce correlation window 30d→7d to prevent OOM (132k→~30k rows)
Build and Push / lint-and-test (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Canceled after 0s
Build and Push / build-dashboard (push) Canceled after 0s
Build and Push / build-superset (push) Canceled after 0s
Build and Push / integration-test (push) Canceled after 0s
Build and Push / beta-gate (push) Canceled after 0s
2026-07-21 21:46:54 +00:00
Celes Renata e1d1c70d59 ci: trigger pipeline after Woodpecker OAuth fix
Build and Push / lint-and-test (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Canceled after 0s
Build and Push / build-dashboard (push) Canceled after 0s
Build and Push / build-superset (push) Canceled after 0s
Build and Push / integration-test (push) Canceled after 0s
Build and Push / beta-gate (push) Canceled after 0s
2026-07-21 15:36:17 +00:00
Celes Renata 4f021511fa fix: move correlation matrix to background task — prevents startup timeout/OOM
Build and Push / lint-and-test (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Canceled after 0s
Build and Push / build-dashboard (push) Canceled after 0s
Build and Push / build-superset (push) Canceled after 0s
Build and Push / integration-test (push) Canceled after 0s
Build and Push / beta-gate (push) Canceled after 0s
2026-07-21 15:23:22 +00:00
Celes Renata 6bde9d2726 fix: increase trading-engine memory limit 512Mi→1024Mi (OOMKilled by correlation matrix)
Build and Push / lint-and-test (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Canceled after 0s
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Canceled after 0s
Build and Push / build-dashboard (push) Canceled after 0s
Build and Push / build-superset (push) Canceled after 0s
Build and Push / integration-test (push) Canceled after 0s
Build and Push / beta-gate (push) Canceled after 0s
2026-07-21 15:20:38 +00:00
2 changed files with 14 additions and 5 deletions
+2 -2
View File
@@ -99,8 +99,8 @@ services:
port: 8000
secrets: [stonks-core-secrets, stonks-broker-secrets, stonks-gmail-secrets]
resources:
requests: { cpu: 100m, memory: 256Mi }
limits: { cpu: 500m, memory: 512Mi }
requests: { cpu: 100m, memory: 512Mi }
limits: { cpu: 1000m, memory: 1024Mi }
probes:
readiness: { path: /ready, port: 8000, initialDelay: 5, period: 10 }
liveness: { path: /health, port: 8000, initialDelay: 10, period: 30 }
+12 -3
View File
@@ -159,6 +159,7 @@ class TradingEngine:
asyncio.create_task(self._performance_loop(), name="performance_loop"),
asyncio.create_task(self._risk_tier_scheduler(), name="risk_tier_scheduler"),
asyncio.create_task(self._rebalance_scheduler(), name="rebalance_scheduler"),
asyncio.create_task(self._correlation_startup(), name="correlation_startup"),
]
logger.info("Trading engine started with %d worker tasks", len(self._tasks))
@@ -598,8 +599,9 @@ class TradingEngine:
initial_capital, invested, available, reserve_balance, open_count,
)
# Compute initial correlation matrix from market data
await self._compute_correlation_matrix()
# Compute initial correlation matrix from market data (non-blocking)
# Launched as a background task in start() to avoid blocking uvicorn startup
self._pending_corr_task = True
async def _decision_loop(self) -> None:
"""Poll recommendations and evaluate them in a continuous loop.
@@ -1340,6 +1342,13 @@ class TradingEngine:
# Correlation matrix computation
# ------------------------------------------------------------------
async def _correlation_startup(self) -> None:
"""Compute correlation matrix in background so uvicorn can start serving."""
try:
await self._compute_correlation_matrix()
except Exception:
logger.exception("Background correlation matrix computation failed")
async def _compute_correlation_matrix(self) -> None:
"""Compute pairwise price correlations from market_snapshots and load into self.correlation_matrix.
@@ -1354,7 +1363,7 @@ class TradingEngine:
rows = await self.pool.fetch(
"SELECT ticker, captured_at::date AS dt, (data->>'c')::float AS close "
"FROM market_snapshots "
"WHERE snapshot_type = 'bar' AND captured_at > NOW() - INTERVAL '30 days' "
"WHERE snapshot_type = 'bar' AND captured_at > NOW() - INTERVAL '7 days' "
"ORDER BY ticker, captured_at"
)
except Exception: