Features: - FastAPI backend with stocks, news, signals, watchlist, analytics endpoints - React frontend with TailwindCSS dark mode trading dashboard - Celery workers for news fetching, sentiment analysis, pattern detection - TimescaleDB schema for time-series stock data - Docker Compose setup for all services - OpenAI integration for sentiment analysis
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""Watchlist model."""
|
|
|
|
from sqlalchemy import Column, String, Text, Boolean, DateTime, Numeric, Integer, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.sql import func
|
|
import uuid
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Watchlist(Base):
|
|
"""Watchlist table model."""
|
|
|
|
__tablename__ = "watchlist"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
stock_id = Column(UUID(as_uuid=True), ForeignKey("stocks.id", ondelete="CASCADE"), nullable=False, unique=True)
|
|
|
|
# Alert thresholds
|
|
panic_alert_threshold = Column(Numeric(5, 2), default=-50)
|
|
price_alert_low = Column(Numeric(15, 4))
|
|
price_alert_high = Column(Numeric(15, 4))
|
|
|
|
# Preferences
|
|
priority = Column(Integer, default=1, index=True) # 1 = high, 2 = medium, 3 = low
|
|
notes = Column(Text)
|
|
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|