feat: display five GLB PnL series with distinct colors
Deploy production / deploy (push) Successful in 56s
Deploy production / deploy (push) Successful in 56s
This commit is contained in:
@@ -10,7 +10,7 @@ from uuid import uuid4
|
||||
from fastapi import HTTPException
|
||||
from sqlalchemy import delete, func, select, update
|
||||
|
||||
from .alphas import list_statement, sorted_statement, submission_condition, summary
|
||||
from .alphas import glb_pnl_series, list_statement, sorted_statement, submission_condition, summary
|
||||
from .jobs import ACTIVE
|
||||
from .models import Account, Alpha, Job, JobItem, Pnl, Research, ResearchTag, SelfCorrelation, now
|
||||
from .research.provenance import alpha_sources, source_kinds
|
||||
@@ -140,12 +140,14 @@ class Business:
|
||||
).model_dump(mode="json")
|
||||
|
||||
async def get_alpha_pnl(self, alpha_id):
|
||||
if not await self.db.get(Alpha, alpha_id):
|
||||
alpha = await self.db.get(Alpha, alpha_id)
|
||||
if not alpha:
|
||||
raise HTTPException(404, "Alpha 尚未同步")
|
||||
row = await self.db.get(Pnl, alpha_id)
|
||||
return {
|
||||
"cached": row is not None,
|
||||
"points": row.points if row else [],
|
||||
"series": glb_pnl_series(row.raw, row.points) if row and alpha.region == "GLB" else [],
|
||||
"fetched_at": row.fetched_at.isoformat() if row else None,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user