fix: 增强批量获取价格日志级别
- LogWarning → LogError(价格获取失败是严重问题) - 记录具体错误信息 - 记录 AssetType 用于排查数据源选择问题
This commit is contained in:
parent
8022731b34
commit
89c6ca5397
@ -197,12 +197,14 @@ public class PortfolioService : IPortfolioService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var pos = allPositions.First(p => p.StockCode == code);
|
var pos = allPositions.First(p => p.StockCode == code);
|
||||||
var price = await _marketDataService.GetPriceAsync(code, pos.AssetType ?? "Stock");
|
var assetType = pos.AssetType ?? "Stock";
|
||||||
|
_logger.LogDebug("批量获取价格: {Code}, AssetType={AssetType}", code, assetType);
|
||||||
|
var price = await _marketDataService.GetPriceAsync(code, assetType);
|
||||||
return (code, price);
|
return (code, price);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogWarning(ex, "批量获取价格失败: {Code}", code);
|
_logger.LogError(ex, "批量获取价格失败: {Code}, 错误详情: {Message}", code, ex.Message);
|
||||||
return (code, null);
|
return (code, null);
|
||||||
}
|
}
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user