- factor_definition 表(migration b7f2a5e81c33,MySQL 已应用):name 主键 + 元数据 (formula/brief/frequency/lookback/direction/requires JSON/version)+ FactorDefinition entity(from_registry_def 由代码注册表构造) - FactorRepository Protocol + SQLAlchemy 实现(幂等 upsert/list/get) - /api/factors 改读 DB;目录为空自动 seed 注册表(幂等)—— 保留自定义因子登记能力 (计算仍须代码注册,引用未注册因子照常 FactorError,防伪因子) - tests/test_factor_catalog.py(repo 幂等/roundtrip/registry seed、API seed+字段齐全); test_api 的 client fixture 补 tmp sqlite session(factors 读库);全量 pytest 通过
26 lines
761 B
Python
26 lines
761 B
Python
"""ORM 模型目录。
|
|
|
|
新增表流程(AGENT.md §12):Model → Alembic Migration → Test。
|
|
模型统一继承 infra.persistence.sqlalchemy.base.Base。
|
|
"""
|
|
|
|
from app.infrastructure.persistence.sqlalchemy.models.factor import ( # noqa: F401
|
|
FactorDefinitionModel,
|
|
)
|
|
from app.infrastructure.persistence.sqlalchemy.models.jobs import ( # noqa: F401
|
|
ExperimentModel,
|
|
JobModel,
|
|
)
|
|
from app.infrastructure.persistence.sqlalchemy.models.market import ( # noqa: F401
|
|
AdjustFactorModel,
|
|
FinancialIndicatorModel,
|
|
StockDailyModel,
|
|
StockModel,
|
|
SyncLogModel,
|
|
TradingCalendarModel,
|
|
)
|
|
from app.infrastructure.persistence.sqlalchemy.models.selection import ( # noqa: F401
|
|
SelectionResultModel,
|
|
SelectionSnapshotModel,
|
|
)
|