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:
41
backend/app/schemas/stock.py
Normal file
41
backend/app/schemas/stock.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""Stock schemas."""
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class StockBase(BaseModel):
|
||||
"""Base stock schema."""
|
||||
symbol: str = Field(..., min_length=1, max_length=20)
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
sector: Optional[str] = None
|
||||
industry: Optional[str] = None
|
||||
exchange: Optional[str] = None
|
||||
country: str = "USA"
|
||||
|
||||
|
||||
class StockCreate(StockBase):
|
||||
"""Schema for creating a stock."""
|
||||
pass
|
||||
|
||||
|
||||
class StockResponse(StockBase):
|
||||
"""Schema for stock response."""
|
||||
id: UUID
|
||||
market_cap: Optional[int] = None
|
||||
is_active: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class StockWithPrice(StockResponse):
|
||||
"""Stock response with latest price data."""
|
||||
latest_price: Optional[float] = None
|
||||
price_change_24h: Optional[float] = None
|
||||
price_change_percent_24h: Optional[float] = None
|
||||
volume_24h: Optional[int] = None
|
||||
Reference in New Issue
Block a user