Serve live recommendation context on trade setup APIs and alerts
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:
@@ -254,7 +254,9 @@ async def _watchlist_tickers(db: AsyncSession) -> list[tuple[int, str]]:
|
||||
|
||||
|
||||
async def _qualified_setups(db: AsyncSession) -> list[dict]:
|
||||
setups = await get_trade_setups(db)
|
||||
# live_recommendation: gate and format on current score/sentiment context,
|
||||
# not the values frozen into the setup at scan time.
|
||||
setups = await get_trade_setups(db, live_recommendation=True)
|
||||
config = await get_activation_config(db)
|
||||
return [s for s in setups if setup_qualifies(SimpleNamespace(**s), config)]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user