From 647fde9219b36489ee2594319f71f2a78a0c1572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=BE=E7=90=83?= Date: Fri, 6 Mar 2026 08:36:09 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=92=8C=E7=A4=BA=E4=BE=8B=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E4=B8=80=E8=87=B4=EF=BC=88=E7=A7=BB=E9=99=A4=20resampleFreq?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/MarketDataService.cs | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/AssetManager.Infrastructure/Services/MarketDataService.cs b/AssetManager.Infrastructure/Services/MarketDataService.cs index 497e4b3..afa7af3 100644 --- a/AssetManager.Infrastructure/Services/MarketDataService.cs +++ b/AssetManager.Infrastructure/Services/MarketDataService.cs @@ -118,10 +118,9 @@ public class MarketDataService : IMarketDataService var endDate = DateTime.UtcNow; var startDate = CalculateStartDate(endDate, timeframe, limit); - var resampleFreq = GetTiingoResampleFreq(timeframe); - // Tiingo 历史数据端点 - var url = $"https://api.tiingo.com/tiingo/daily/{symbol}/prices?startDate={startDate:yyyy-MM-dd}&endDate={endDate:yyyy-MM-dd}&resampleFreq={resampleFreq}&token={_tiingoApiKey}"; + // Tiingo 历史数据端点(和示例一致) + var url = $"https://api.tiingo.com/tiingo/daily/{symbol}/prices?startDate={startDate:yyyy-MM-dd}&endDate={endDate:yyyy-MM-dd}&token={_tiingoApiKey}"; var response = await _httpClient.GetFromJsonAsync>(url); if (response == null) @@ -209,24 +208,6 @@ public class MarketDataService : IMarketDataService } } - /// - /// 转换为 Tiingo 的 resampleFreq - /// - private string GetTiingoResampleFreq(string timeframe) - { - return timeframe.ToLower() switch - { - "1min" => "1min", - "5min" => "5min", - "15min" => "15min", - "1h" => "1hour", - "1d" => "daily", - "1w" => "weekly", - "1m" => "monthly", - _ => "daily" - }; - } - /// /// 计算开始日期 ///