feat: add TradeContext, Subcategory and LastAnalyzedAt
This commit is contained in:
@@ -19,6 +19,7 @@ public class AppDbContext : DbContext
|
||||
public DbSet<TraderPosition> TraderPositions => Set<TraderPosition>();
|
||||
public DbSet<MarketOutcomePriceSnapshot> MarketOutcomePriceSnapshots => Set<MarketOutcomePriceSnapshot>();
|
||||
public DbSet<TraderCategoryPerformance> TraderCategoryPerformances => Set<TraderCategoryPerformance>();
|
||||
public DbSet<TradeContext> TradeContexts => Set<TradeContext>();
|
||||
|
||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
||||
|
||||
@@ -150,9 +151,21 @@ public class AppDbContext : DbContext
|
||||
e.HasKey(tcp => tcp.Id);
|
||||
e.HasOne(tcp => tcp.Trader).WithMany(t => t.CategoryPerformances).HasForeignKey(tcp => tcp.TraderId).OnDelete(DeleteBehavior.Cascade);
|
||||
e.Property(tcp => tcp.Category).HasConversion<string>().HasMaxLength(64);
|
||||
e.Property(tcp => tcp.Subcategory).HasMaxLength(128);
|
||||
e.Property(tcp => tcp.TotalVolume).HasPrecision(18, 4);
|
||||
e.Property(tcp => tcp.TotalPnL).HasPrecision(18, 4);
|
||||
e.HasIndex(tcp => new { tcp.TraderId, tcp.Category }).IsUnique();
|
||||
e.HasIndex(tcp => new { tcp.TraderId, tcp.Category, tcp.Subcategory }).IsUnique();
|
||||
});
|
||||
|
||||
// TradeContext
|
||||
mb.Entity<TradeContext>(e =>
|
||||
{
|
||||
e.HasKey(tc => tc.Id);
|
||||
e.HasOne(tc => tc.Trade).WithOne(t => t.Context).HasForeignKey<TradeContext>(tc => tc.TradeId).OnDelete(DeleteBehavior.Cascade);
|
||||
e.Property(tc => tc.PriceBefore1m).HasPrecision(18, 4);
|
||||
e.Property(tc => tc.PriceAfter1m).HasPrecision(18, 4);
|
||||
e.Property(tc => tc.EstimatedSlippage).HasPrecision(18, 4);
|
||||
e.Property(tc => tc.EstimatedOrderType).HasConversion<string>().HasMaxLength(32);
|
||||
});
|
||||
|
||||
// PlatformConfig
|
||||
|
||||
Reference in New Issue
Block a user