Initial project structure: MarketScanner - Fear-to-Fortune Trading Intelligence
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
This commit is contained in:
48
backend/app/models/panic.py
Normal file
48
backend/app/models/panic.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""Panic event 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 PanicEvent(Base):
|
||||
"""Panic event table model."""
|
||||
|
||||
__tablename__ = "panic_events"
|
||||
|
||||
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, index=True)
|
||||
|
||||
# Event timing
|
||||
start_time = Column(DateTime(timezone=True), nullable=False, index=True)
|
||||
peak_time = Column(DateTime(timezone=True))
|
||||
end_time = Column(DateTime(timezone=True))
|
||||
|
||||
# Price impact
|
||||
price_at_start = Column(Numeric(15, 4), nullable=False)
|
||||
price_at_peak_panic = Column(Numeric(15, 4))
|
||||
price_at_end = Column(Numeric(15, 4))
|
||||
max_drawdown_percent = Column(Numeric(8, 4), index=True)
|
||||
|
||||
# Sentiment
|
||||
avg_sentiment_score = Column(Numeric(5, 2))
|
||||
min_sentiment_score = Column(Numeric(5, 2))
|
||||
news_volume = Column(Integer)
|
||||
|
||||
# Recovery metrics
|
||||
recovery_time_days = Column(Integer)
|
||||
recovery_percent = Column(Numeric(8, 4))
|
||||
|
||||
# Classification
|
||||
event_type = Column(String(100), index=True) # earnings_miss, scandal, lawsuit, macro, etc.
|
||||
event_category = Column(String(50)) # company_specific, sector_wide, market_wide
|
||||
|
||||
# Analysis
|
||||
is_complete = Column(Boolean, default=False)
|
||||
notes = Column(Text)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
Reference in New Issue
Block a user