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
27 lines
930 B
Python
27 lines
930 B
Python
"""Stock model."""
|
|
|
|
from sqlalchemy import Column, String, BigInteger, Boolean, DateTime
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.sql import func
|
|
import uuid
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Stock(Base):
|
|
"""Stock table model."""
|
|
|
|
__tablename__ = "stocks"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
symbol = Column(String(20), unique=True, nullable=False, index=True)
|
|
name = Column(String(255), nullable=False)
|
|
sector = Column(String(100), index=True)
|
|
industry = Column(String(100), index=True)
|
|
market_cap = Column(BigInteger)
|
|
exchange = Column(String(50))
|
|
country = Column(String(100), default="USA")
|
|
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())
|