Files
Mutual_Fund/repositories/portfolio_benchmark.py
T

27 lines
831 B
Python
Raw Normal View History

2026-09-12 20:42:33 +08:00
"""portfolio_benchmark 组合基准仓储(工作台只读:标准策略库展示)。"""
from __future__ import annotations
from sqlalchemy import select
from model.portfolio_benchmark import PortfolioBenchmark
from repositories.base import BaseRepository
# 启用态(DDL:status 启用/停用)
_ACTIVE_STATUS = "启用"
class PortfolioBenchmarkRepo(BaseRepository):
model = PortfolioBenchmark
async def list_enabled(self) -> list[PortfolioBenchmark]:
"""取全部启用态基准(标准化策略库,投顾只读不可改)。"""
return list(
(
await self.db.scalars(
select(PortfolioBenchmark).where(
PortfolioBenchmark.status == _ACTIVE_STATUS
)
)
).all()
)