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
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""News article model."""
|
|
|
|
from sqlalchemy import Column, String, Text, Boolean, DateTime, Numeric
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.sql import func
|
|
import uuid
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class NewsArticle(Base):
|
|
"""News article table model."""
|
|
|
|
__tablename__ = "news_articles"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
title = Column(Text, nullable=False)
|
|
content = Column(Text)
|
|
summary = Column(Text)
|
|
url = Column(Text, unique=True, nullable=False)
|
|
source = Column(String(100), nullable=False, index=True)
|
|
author = Column(String(255))
|
|
published_at = Column(DateTime(timezone=True), nullable=False, index=True)
|
|
fetched_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
image_url = Column(Text)
|
|
|
|
# Sentiment analysis results
|
|
sentiment_score = Column(Numeric(5, 2), index=True) # -100 to +100
|
|
sentiment_label = Column(String(20)) # negative, neutral, positive
|
|
sentiment_confidence = Column(Numeric(5, 4))
|
|
|
|
# Processing status
|
|
is_processed = Column(Boolean, default=False)
|
|
processing_error = Column(Text)
|