feat: Add category performance, update WebUI and OpenRouter integration, fix bugs
This commit is contained in:
@@ -18,6 +18,7 @@ public class AppDbContext : DbContext
|
||||
public DbSet<MarketAnalytics> MarketAnalytics => Set<MarketAnalytics>();
|
||||
public DbSet<TraderPosition> TraderPositions => Set<TraderPosition>();
|
||||
public DbSet<MarketOutcomePriceSnapshot> MarketOutcomePriceSnapshots => Set<MarketOutcomePriceSnapshot>();
|
||||
public DbSet<TraderCategoryPerformance> TraderCategoryPerformances => Set<TraderCategoryPerformance>();
|
||||
|
||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
||||
|
||||
@@ -54,7 +55,7 @@ public class AppDbContext : DbContext
|
||||
// Outcome: labels can be long (e.g. anime titles or sports match descriptions)
|
||||
e.Property(t => t.Outcome).HasMaxLength(128);
|
||||
// Price: 0.00–1.00 on prediction markets, 6 decimals sufficient
|
||||
e.Property(t => t.Price).HasPrecision(10, 6);
|
||||
e.Property(t => t.Price).HasPrecision(18, 6);
|
||||
// Size: number of shares, needs more integer digits
|
||||
e.Property(t => t.Size).HasPrecision(14, 6);
|
||||
e.Property(t => t.Amount).HasPrecision(18, 4);
|
||||
@@ -92,7 +93,8 @@ public class AppDbContext : DbContext
|
||||
e.Property(m => m.Question).HasMaxLength(1024);
|
||||
e.Property(m => m.Description).HasMaxLength(4096);
|
||||
e.Property(m => m.ImageUrl).HasMaxLength(1024);
|
||||
e.Property(m => m.Category).HasMaxLength(128);
|
||||
e.Property(m => m.Category).HasConversion<string>().HasMaxLength(64);
|
||||
e.Property(m => m.Subcategory).HasMaxLength(128);
|
||||
e.Property(m => m.Volume).HasPrecision(18, 4);
|
||||
e.Property(m => m.Volume24h).HasPrecision(18, 4);
|
||||
e.Property(m => m.Liquidity).HasPrecision(18, 4);
|
||||
@@ -142,6 +144,17 @@ public class AppDbContext : DbContext
|
||||
e.HasOne(a => a.Trader).WithMany().HasForeignKey(a => a.TraderId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
// TraderCategoryPerformance
|
||||
mb.Entity<TraderCategoryPerformance>(e =>
|
||||
{
|
||||
e.HasKey(tcp => tcp.Id);
|
||||
e.HasOne(tcp => tcp.Trader).WithMany().HasForeignKey(tcp => tcp.TraderId).OnDelete(DeleteBehavior.Cascade);
|
||||
e.Property(tcp => tcp.Category).HasConversion<string>().HasMaxLength(64);
|
||||
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();
|
||||
});
|
||||
|
||||
// PlatformConfig
|
||||
mb.Entity<PlatformConfig>(e =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user