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
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Watchlist schemas."""
|
|
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class WatchlistBase(BaseModel):
|
|
"""Base watchlist schema."""
|
|
panic_alert_threshold: float = -50.0
|
|
price_alert_low: Optional[float] = None
|
|
price_alert_high: Optional[float] = None
|
|
priority: int = Field(1, ge=1, le=3)
|
|
notes: Optional[str] = None
|
|
|
|
|
|
class WatchlistCreate(WatchlistBase):
|
|
"""Schema for creating a watchlist item."""
|
|
symbol: str
|
|
|
|
|
|
class WatchlistUpdate(BaseModel):
|
|
"""Schema for updating a watchlist item."""
|
|
panic_alert_threshold: Optional[float] = None
|
|
price_alert_low: Optional[float] = None
|
|
price_alert_high: Optional[float] = None
|
|
priority: Optional[int] = Field(None, ge=1, le=3)
|
|
notes: Optional[str] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class WatchlistResponse(WatchlistBase):
|
|
"""Schema for watchlist response."""
|
|
id: UUID
|
|
stock_id: UUID
|
|
is_active: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|