c211c42c6c
✅ Step 1 COMPLETE: API 직접 호출 검증 Validation Results: - Host startup: ASPNETCORE_ENVIRONMENT=Development 설정 필수 - Authentication: DevelopmentHeaderAuthenticationHandler 작동 확인 - Endpoint routing: FastEndpoints 라우팅 정상 - Phase 1 API: POST /api/shadow-runs HTTP 202 Accepted - Execution: runId 688040e2-c481-4fea-9b88-d54a3ec02631, status: Queued - Data mode: Stub data (KRX API 미사용) Window validation: 252 days required (2024-01-02 ~ 2024-09-10) Rate limiting: RateLimiterService 토큰 소비 정상 Next steps: - Step 2: DB 결과 데이터 확인 (shadow_run_metrics) - Step 3: Hangfire 자동화 완전성 검증 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
64 lines
2.3 KiB
C#
64 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using KArtSell.Modules.ModelOperations.ShadowRun.Services;
|
|
|
|
// 간단한 테스트: KRX 데이터 수집 직접 호출
|
|
public class TestKrxCollection
|
|
{
|
|
public static async Task Main(string[] args)
|
|
{
|
|
Console.WriteLine("=== KRX 실제 데이터 수집 테스트 ===");
|
|
Console.WriteLine("1개 심볼(005930-삼성), 1일(2024-01-02) 수집");
|
|
Console.WriteLine("");
|
|
|
|
// DI 설정
|
|
var services = new ServiceCollection();
|
|
services.AddLogging(config => config.AddConsole());
|
|
services.AddMemoryCache();
|
|
services.AddHttpClient<KrxDataService>();
|
|
|
|
var provider = services.BuildServiceProvider();
|
|
var krxService = provider.GetRequiredService<KrxDataService>();
|
|
|
|
try
|
|
{
|
|
// 실제 KRX 데이터 수집
|
|
var ticker = "005930"; // 삼성전자
|
|
var startDate = new DateOnly(2024, 1, 2);
|
|
var endDate = new DateOnly(2024, 1, 2);
|
|
|
|
Console.WriteLine($"수집 중: {ticker} ({startDate:yyyy-MM-dd})");
|
|
Console.WriteLine("");
|
|
|
|
var bars = await krxService.GetDailyOhlcvAsync(ticker, startDate, endDate, CancellationToken.None);
|
|
|
|
Console.WriteLine($"✅ 수집 완료! {bars.Count}개 봉 수신");
|
|
Console.WriteLine("");
|
|
|
|
if (bars.Count > 0)
|
|
{
|
|
var bar = bars[0];
|
|
Console.WriteLine($"첫 봉:");
|
|
Console.WriteLine($" 날짜: {bar.Date:yyyy-MM-dd}");
|
|
Console.WriteLine($" 종목: {bar.Ticker}");
|
|
Console.WriteLine($" 시가: {bar.Open:F0}");
|
|
Console.WriteLine($" 고가: {bar.High:F0}");
|
|
Console.WriteLine($" 저가: {bar.Low:F0}");
|
|
Console.WriteLine($" 종가: {bar.Close:F0}");
|
|
Console.WriteLine($" 거래량: {bar.Volume:F0}");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine($"❌ 오류: {ex.Message}");
|
|
Console.WriteLine($"스택트레이스: {ex.StackTrace}");
|
|
}
|
|
|
|
Console.WriteLine("");
|
|
Console.WriteLine("테스트 완료.");
|
|
}
|
|
}
|