Serve live recommendation context on trade setup APIs and alerts
Deploy / lint (push) Successful in 6s
Deploy / test (push) Successful in 1m0s
Deploy / deploy (push) Successful in 32s

Stored TradeSetup rows are point-in-time snapshots from the RR scan, so
the ticker page could show stale confidence/reasoning/composite (e.g.
sentiment=neutral in the setup card while the sentiment panel showed
bullish). Overlay current score/sentiment context onto the API payload
for GET /trades and GET /trades/{symbol}, gate and format Telegram
qualified-setup alerts on the same live values, and apply the
min_confidence/recommended_action filters after the overlay so they
judge what the caller actually sees. Stored setups stay frozen for
outcome analysis and backtests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 09:17:27 +02:00
parent 2b0068ae08
commit ac51e23949
5 changed files with 348 additions and 34 deletions
+7 -1
View File
@@ -34,6 +34,7 @@ async def list_trade_setups(
direction=direction,
min_confidence=min_confidence,
recommended_action=recommended_action,
live_recommendation=True,
)
data = []
@@ -92,7 +93,12 @@ async def get_ticker_trade_setups(
_user=Depends(require_access),
db: AsyncSession = Depends(get_db),
) -> APIEnvelope:
rows = await get_trade_setups(db, symbol=symbol)
rows = await get_trade_setups(
db,
symbol=symbol,
live_recommendation=True,
recompute_scores=True,
)
data = []
for row in rows:
summary = RecommendationSummaryResponse(