| 1234567891011121314151617181920212223242526272829303132333435 |
- using Domain.Entities.Stocks;
- using Domain.Entities.Stocks.ValueObject;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Stocks;
- public sealed class OptionsDailyTradeConfiguration : IEntityTypeConfiguration<OptionsDailyTrade>
- {
- public void Configure(EntityTypeBuilder<OptionsDailyTrade> builder)
- {
- builder.ToTable(nameof(OptionsDailyTrade), t => t.HasComment("옵션(일반/주식유가/주식코스닥) 일별매매 시세 (KRX OpenAPI drv)"));
- builder.HasKey(x => x.ID);
- builder.HasIndex(x => new { x.OptionsKind, x.IsuCode, x.TradeDate, x.Session }).IsUnique();
- builder.HasIndex(x => new { x.OptionsKind, x.TradeDate, x.Session, x.TradeValue }).IsDescending(false, false, false, true);
- builder.Property(x => x.OptionsKind).HasConversion<byte>().IsRequired().HasComment("옵션 상품군 구분 (1=일반옵션, 2=주식옵션유가, 3=주식옵션코스닥)");
- builder.Property(x => x.Session).HasConversion<byte>().IsRequired().HasDefaultValue(MarketSession.Regular).HasComment("매매 세션 (1=정규, 2=야간)");
- 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.RightType).HasConversion<byte>().IsRequired().HasComment("권리유형 (RGHT_TP_NM — 1=Call, 2=Put)");
- builder.Property(x => x.StrikePrice).HasPrecision(18, 2).HasComment("행사가 (ISU_NM 에서 파싱)");
- 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.ImpliedVolatility).HasPrecision(9, 3).HasComment("내재변동성 % (IMP_VOLT)");
- builder.Property(x => x.NextDayBasePrice).HasPrecision(18, 2).HasComment("익일정산가 (NXTDD_BAS_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)");
- }
- }
|