添加总资产换算日志,方便排查币种转换问题
This commit is contained in:
parent
9b228e9c05
commit
dcb80d9b85
@ -199,6 +199,7 @@ public class PortfolioService : IPortfolioService
|
|||||||
}
|
}
|
||||||
|
|
||||||
string targetCurrency = user.DefaultCurrency ?? "CNY";
|
string targetCurrency = user.DefaultCurrency ?? "CNY";
|
||||||
|
_logger.LogInformation("用户 {UserId} 默认本位币: {Currency}", userId, targetCurrency);
|
||||||
decimal totalValueInTargetCurrency = 0;
|
decimal totalValueInTargetCurrency = 0;
|
||||||
decimal totalCostInTargetCurrency = 0;
|
decimal totalCostInTargetCurrency = 0;
|
||||||
decimal totalTodayProfitInTargetCurrency = 0;
|
decimal totalTodayProfitInTargetCurrency = 0;
|
||||||
@ -248,6 +249,10 @@ public class PortfolioService : IPortfolioService
|
|||||||
decimal costInTarget = await _exchangeRateService.ConvertAmountAsync(costPositionValue, pos.Currency, targetCurrency);
|
decimal costInTarget = await _exchangeRateService.ConvertAmountAsync(costPositionValue, pos.Currency, targetCurrency);
|
||||||
decimal todayProfitInTarget = await _exchangeRateService.ConvertAmountAsync(todayProfit, pos.Currency, targetCurrency);
|
decimal todayProfitInTarget = await _exchangeRateService.ConvertAmountAsync(todayProfit, pos.Currency, targetCurrency);
|
||||||
|
|
||||||
|
_logger.LogInformation("标的 {StockCode} 换算: {Amount} {From} → {Converted} {To},汇率: {Rate}",
|
||||||
|
pos.StockCode, currentPositionValue, pos.Currency, currentInTarget, targetCurrency,
|
||||||
|
currentPositionValue > 0 ? currentInTarget / currentPositionValue : 0);
|
||||||
|
|
||||||
totalValueInTargetCurrency += currentInTarget;
|
totalValueInTargetCurrency += currentInTarget;
|
||||||
totalCostInTargetCurrency += costInTarget;
|
totalCostInTargetCurrency += costInTarget;
|
||||||
totalTodayProfitInTargetCurrency += todayProfitInTarget;
|
totalTodayProfitInTargetCurrency += todayProfitInTarget;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user