using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class FuturesDailyTradeConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(FuturesDailyTrade), t => t.HasComment("선물(일반/주식유가/주식코스닥) 일별매매 시세 (KRX OpenAPI drv)")); builder.HasKey(x => x.ID); builder.HasIndex(x => new { x.FuturesKind, x.IsuCode, x.TradeDate }).IsUnique(); builder.HasIndex(x => new { x.FuturesKind, x.TradeDate, x.TradeValue }).IsDescending(false, false, true); builder.Property(x => x.FuturesKind).HasConversion().IsRequired().HasComment("선물 상품군 구분 (1=일반선물, 2=주식선물유가, 3=주식선물코스닥)"); builder.Property(x => x.IsuCode).HasMaxLength(12).IsRequired().HasComment("종목코드 (ISU_CD) — 8자리 영숫자"); builder.Property(x => x.IsuName).HasMaxLength(100).IsRequired().HasComment("종목명"); builder.Property(x => x.Close).HasPrecision(18, 2).HasComment("종가 (TDD_CLSPRC)"); builder.Property(x => x.Open).HasPrecision(18, 2).HasComment("시가 (TDD_OPNPRC)"); builder.Property(x => x.High).HasPrecision(18, 2).HasComment("고가 (TDD_HGPRC)"); builder.Property(x => x.Low).HasPrecision(18, 2).HasComment("저가 (TDD_LWPRC)"); builder.Property(x => x.ChangeAmount).HasPrecision(18, 2).HasComment("전일 대비 (CMPPREVDD_PRC)"); builder.Property(x => x.SpotPrice).HasPrecision(18, 2).HasComment("현물가 (SPOT_PRC)"); builder.Property(x => x.SettlePrice).HasPrecision(18, 2).HasComment("정산가 (SETL_PRC)"); builder.Property(x => x.Volume).HasComment("거래량 (ACC_TRDVOL)"); builder.Property(x => x.TradeValue).HasComment("거래대금 (ACC_TRDVAL, 원)"); builder.Property(x => x.OpenInterest).HasComment("미결제약정 (ACC_OPNINT_QTY)"); builder.Property(x => x.ProductName).HasMaxLength(100).HasComment("상품구분 (PROD_NM)"); builder.Property(x => x.MarketName).HasMaxLength(20).HasComment("시장구분 (MKT_NM 정규/야간)"); } }