From 3953da09933bdd3212cc081e4554b918b89d74ed Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 14 Aug 2026 15:34:09 +0900 Subject: [PATCH] fix: KrxDataService HTTPS protocol + Accept headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed: http:// → https://data-dbg.krx.co.kr - Added: Accept: application/json header - Added: Content-Type: application/json; charset=utf-8 header - Result: HTTP 200 OK (verified with real KRX API) KRX API now fully functional. Response includes OutBlock_1 with real stock data: - ISU_CD (stock code) - ISU_NM (stock name) - TDD_CLSPRC (closing price) - ACC_TRDVOL (trading volume) - Plus: Open/High/Low prices, market cap Co-Authored-By: Claude Haiku 4.5 --- .../ShadowRun/Services/KrxDataService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/KArtSell.Modules.ModelOperations/ShadowRun/Services/KrxDataService.cs b/src/KArtSell.Modules.ModelOperations/ShadowRun/Services/KrxDataService.cs index 90db43bf..1bf60b4f 100644 --- a/src/KArtSell.Modules.ModelOperations/ShadowRun/Services/KrxDataService.cs +++ b/src/KArtSell.Modules.ModelOperations/ShadowRun/Services/KrxDataService.cs @@ -19,7 +19,7 @@ public sealed class KrxDataService : IKrxDataService private const int MaxRetries = 3; private const int InitialBackoffMs = 100; private const int MaxBackoffMs = 30000; - private const string KrxApiBaseUrl = "http://data-dbg.krx.co.kr"; // Stock price API (from pykrx-openapi) + private const string KrxApiBaseUrl = "https://data-dbg.krx.co.kr"; // Stock price API (HTTPS, from pykrx-openapi) private const string KrxApiEndpoint = "/svc/apis/sto/stk_bydd_trd"; // KOSPI daily trading endpoint private static readonly Action LogFetchingOhlcv = @@ -187,6 +187,8 @@ public sealed class KrxDataService : IKrxDataService { var request = new HttpRequestMessage(HttpMethod.Get, endpoint); request.Headers.Add("AUTH_KEY", apiKey); + request.Headers.Add("Accept", "application/json"); + request.Content = new StringContent("", System.Text.Encoding.UTF8, "application/json; charset=utf-8"); var response = await _httpClient.SendAsync(request, cancellationToken);