fix(ledger): 修复 portfolio 接口组装时 avgCost 变量未定义的 ReferenceError

This commit is contained in:
2026-05-01 04:25:06 +08:00
parent 9ce398efb1
commit f537dcf303
2 changed files with 14 additions and 3 deletions
+6 -2
View File
@@ -24,6 +24,8 @@ interface Position {
realizedPnlCny: string;
avgCost: string;
dilutedCost: string;
floatingPnl: string;
accumulatedPnl: string;
holdingDays: number;
exchange: string;
accumulatedDividendsCny: string;
@@ -366,8 +368,10 @@ export async function getPortfolioPositions(): Promise<Position[]> {
totalBuyCost: holding.totalBuyCostCny.toString(),
totalBuyQuantity: holding.totalBuyQuantity.toString(),
realizedPnlCny: holding.realizedPnlCny.toString(),
avgCost: avgCost.toString(),
dilutedCost: dilutedCost.toString(),
avgCost: metrics.averageCost,
dilutedCost: metrics.dilutedCost,
floatingPnl: metrics.floatingPnl,
accumulatedPnl: metrics.accumulatedPnl,
holdingDays,
exchange: holding.exchange,
accumulatedDividendsCny: holding.accumulatedDividendsCny.toString(),