25 lines
1001 B
Python
25 lines
1001 B
Python
"""基金业绩指标缓存 ORM 模型。"""
|
|
from __future__ import annotations
|
|
|
|
from datetime import date, datetime
|
|
from decimal import Decimal
|
|
|
|
from sqlalchemy import BigInteger, Date, DateTime, Numeric, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from model.base import Base
|
|
|
|
|
|
class FundPerformance(Base):
|
|
__tablename__ = "fund_performance"
|
|
|
|
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
|
|
product_id: Mapped[int] = mapped_column(BigInteger, index=True)
|
|
period: Mapped[str] = mapped_column(String(16))
|
|
return_rate: Mapped[Decimal | None] = mapped_column(Numeric(10, 4))
|
|
annual_volatility: Mapped[Decimal | None] = mapped_column(Numeric(10, 4))
|
|
max_drawdown: Mapped[Decimal | None] = mapped_column(Numeric(10, 4))
|
|
sharpe: Mapped[Decimal | None] = mapped_column(Numeric(10, 4))
|
|
calc_date: Mapped[date] = mapped_column(Date)
|
|
create_time: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|