feat: add daily budget, active window, trade snapshots, and price impact monitor
- New migrations for daily_budget, active_window, and bottrade snapshot - Add trumpstruth scraper and price_impact_monitor service - Expand bot_engine, hyperliquid, recovery, and tp_sl_monitor logic - Update API/schemas/models for new features Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,9 @@ class WatchedTrade:
|
||||
# trade_id -> WatchedTrade
|
||||
_watched: Dict[int, WatchedTrade] = {}
|
||||
|
||||
# Strong references to fire-close tasks to prevent GC before completion
|
||||
_background_tasks: set = set()
|
||||
|
||||
|
||||
def register_trade(
|
||||
trade_id: int,
|
||||
@@ -79,7 +82,9 @@ def on_price_tick(asset: str, price: float) -> None:
|
||||
|
||||
for wt, reason in triggered:
|
||||
unregister(wt.trade_id)
|
||||
asyncio.create_task(_fire_close(wt, reason))
|
||||
task = asyncio.create_task(_fire_close(wt, reason))
|
||||
_background_tasks.add(task)
|
||||
task.add_done_callback(_background_tasks.discard)
|
||||
|
||||
|
||||
async def _fire_close(wt: WatchedTrade, reason: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user