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:
@@ -90,6 +90,11 @@ class BotTrade(Base):
|
||||
opened_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=utcnow)
|
||||
closed_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||
hl_order_id: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
|
||||
# Snapshot of user settings AT TIME OF ENTRY. Required so changes to
|
||||
# Subscription.position_size_usd / leverage after-the-fact don't corrupt
|
||||
# historical PnL or daily-budget accounting.
|
||||
size_usd: Mapped[Optional[float]] = mapped_column(Float, nullable=True)
|
||||
leverage: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
||||
|
||||
trigger_post: Mapped[Optional["Post"]] = relationship("Post", back_populates="trades")
|
||||
|
||||
@@ -110,3 +115,8 @@ class Subscription(Base):
|
||||
take_profit_pct: Mapped[Optional[float]] = mapped_column(Float, nullable=True) # e.g. 2.0 = close at +2%
|
||||
stop_loss_pct: Mapped[Optional[float]] = mapped_column(Float, nullable=True) # e.g. 1.5 = close at -1.5%
|
||||
min_confidence: Mapped[int] = mapped_column(Integer, nullable=False, default=80)
|
||||
daily_budget_usd: Mapped[Optional[float]] = mapped_column(Float, nullable=True) # e.g. 15.0 = max $15 of new positions per UTC day
|
||||
# Optional active window. Both None = always on (when Subscription.active=True).
|
||||
# Both stored as naive-UTC datetimes.
|
||||
active_from: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||
active_until: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||
|
||||
Reference in New Issue
Block a user