27 lines
831 B
Python
27 lines
831 B
Python
"""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()
|
||
)
|