|
|
@@ -71,9 +71,13 @@ internal sealed class Handler(IAppDbContext db) : IQueryHandler<Query, Response>
|
|
|
await AddIndexAsync(rows, "kospi", MarketIndexSeries.KOSPI, "코스피", indexDate, breadthByMarket, StockMarket.KOSPI, ct);
|
|
|
// 코스닥
|
|
|
await AddIndexAsync(rows, "kosdaq", MarketIndexSeries.KOSDAQ, "코스닥", indexDate, breadthByMarket, StockMarket.KOSDAQ, ct);
|
|
|
- // KOSPI200 (KOSPI 계열 내 "200" 포함 지수) — 등락종목수 없음, 베이시스는 Phase 2
|
|
|
+ // KOSPI200 (KOSPI 계열 내 "200" 포함 지수) — 등락종목수 없음
|
|
|
await AddKospi200Async(rows, indexDate, ct);
|
|
|
|
|
|
+ // 글로벌 벤치마크 — WorldIndexSnapshot 심볼로 조회 + 표시명 오버라이드 (등락종목수 없음)
|
|
|
+ await AddGlobalAsync(rows, "sp500", "^gspc", "S&P 500", ct);
|
|
|
+ await AddGlobalAsync(rows, "nasdaq", "^ixic", "나스닥", ct);
|
|
|
+
|
|
|
return new Response { List = rows };
|
|
|
}
|
|
|
|
|
|
@@ -139,6 +143,29 @@ internal sealed class Handler(IAppDbContext db) : IQueryHandler<Query, Response>
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private async Task AddGlobalAsync(List<Response.Row> rows, string key, string symbol, string name, CancellationToken ct)
|
|
|
+ {
|
|
|
+ var idx = await db.WorldIndexSnapshot.AsNoTracking()
|
|
|
+ .Where(c => c.Symbol == symbol)
|
|
|
+ .Select(c => new { c.Close, c.ChangeVal, c.FlucRateBp, c.TradeDate })
|
|
|
+ .FirstOrDefaultAsync(ct);
|
|
|
+
|
|
|
+ if (idx is null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ rows.Add(new Response.Row
|
|
|
+ {
|
|
|
+ Key = key,
|
|
|
+ Name = name,
|
|
|
+ Close = idx.Close,
|
|
|
+ ChangeVal = idx.ChangeVal,
|
|
|
+ FlucRateBp = idx.FlucRateBp,
|
|
|
+ TradeDate = idx.TradeDate.ToString("yyyy-MM-dd")
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
private sealed class BreadthRow
|
|
|
{
|
|
|
public StockMarket Market { get; init; }
|