| 123456789101112131415161718192021222324252627282930313233343536 |
- using Domain.Entities.Stocks;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Stocks;
- public sealed class EtpDailyTradeConfiguration : IEntityTypeConfiguration<EtpDailyTrade>
- {
- public void Configure(EntityTypeBuilder<EtpDailyTrade> builder)
- {
- builder.ToTable(nameof(EtpDailyTrade), t => t.HasComment("증권상품(ETF/ETN/ELW) 일별매매 시세 (KRX OpenAPI etp)"));
- builder.HasKey(x => x.ID);
- builder.HasIndex(x => new { x.EtpType, x.Code, x.TradeDate }).IsUnique();
- builder.HasIndex(x => new { x.EtpType, x.TradeDate, x.TradeValue }).IsDescending(false, false, true);
- builder.Property(x => x.EtpType).HasConversion<byte>().IsRequired().HasComment("증권상품 구분 (1=ETF, 2=ETN, 3=ELW)");
- builder.Property(x => x.Code).HasMaxLength(6).IsFixedLength().IsRequired().HasComment("단축코드 (ISU_CD)");
- builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("종목명");
- builder.Property(x => x.Close).HasPrecision(18, 2).HasComment("종가");
- builder.Property(x => x.Open).HasPrecision(18, 2).HasComment("시가");
- builder.Property(x => x.High).HasPrecision(18, 2).HasComment("고가");
- builder.Property(x => x.Low).HasPrecision(18, 2).HasComment("저가");
- builder.Property(x => x.ChangeAmount).HasPrecision(18, 2).HasComment("전일 대비");
- builder.Property(x => x.ChangeRate).HasPrecision(7, 2).HasComment("등락률 % (ELW 는 0)");
- builder.Property(x => x.Volume).HasComment("거래량");
- builder.Property(x => x.TradeValue).HasComment("거래대금 (원)");
- builder.Property(x => x.MarketCap).HasComment("시가총액 (원)");
- builder.Property(x => x.ListedShares).HasComment("상장증권수/상장좌수");
- builder.Property(x => x.Nav).HasPrecision(18, 2).HasComment("ETF NAV / ETN 지표가치(IV)");
- builder.Property(x => x.NetAssetTotal).HasComment("ETF 순자산총액 / ETN 지표가치총액 (원)");
- builder.Property(x => x.BaseIndexName).HasMaxLength(100).HasComment("기초지수명 (ETF/ETN)");
- builder.Property(x => x.BaseIndexClose).HasPrecision(18, 2).HasComment("기초지수 종가 (ETF/ETN)");
- builder.Property(x => x.Underlying).HasMaxLength(100).HasComment("ELW 기초자산명");
- builder.Property(x => x.UnderlyingClose).HasPrecision(18, 2).HasComment("ELW 기초자산 종가");
- }
- }
|