first commit
This commit is contained in:
24
app/models/fundamental.py
Normal file
24
app/models/fundamental.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, Float, ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class FundamentalData(Base):
|
||||
__tablename__ = "fundamental_data"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
ticker_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("tickers.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
pe_ratio: Mapped[float | None] = mapped_column(Float, nullable=True)
|
||||
revenue_growth: Mapped[float | None] = mapped_column(Float, nullable=True)
|
||||
earnings_surprise: Mapped[float | None] = mapped_column(Float, nullable=True)
|
||||
market_cap: Mapped[float | None] = mapped_column(Float, nullable=True)
|
||||
fetched_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False
|
||||
)
|
||||
|
||||
ticker = relationship("Ticker", back_populates="fundamental_data")
|
||||
Reference in New Issue
Block a user