fix: Position.Currency 赋值修正
创建组合时,持仓币种应使用 stock.Currency(持仓本身币种), 而非 request.Currency(组合本位币)。 例如: - 组合本位币 CNY - 持仓 UPRO 币种 USD - Position.Currency 应为 USD
This commit is contained in:
parent
64c1fe60e7
commit
42d3fc91c4
@ -128,7 +128,7 @@ public class PortfolioService : IPortfolioService
|
|||||||
Shares = (decimal)stock.Amount,
|
Shares = (decimal)stock.Amount,
|
||||||
AvgPrice = (decimal)stock.Price,
|
AvgPrice = (decimal)stock.Price,
|
||||||
TotalCost = (decimal)(stock.Price * stock.Amount), // 初始成本 = 价格 × 数量
|
TotalCost = (decimal)(stock.Price * stock.Amount), // 初始成本 = 价格 × 数量
|
||||||
Currency = request.Currency,
|
Currency = stock.Currency ?? request.Currency, // 使用持仓币种,而非组合本位币
|
||||||
CreatedAt = buyTime,
|
CreatedAt = buyTime,
|
||||||
UpdatedAt = DateTime.Now
|
UpdatedAt = DateTime.Now
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user