Fix Runtime by adding TotalRuntimeInSeconds

This commit is contained in:
2025-10-05 20:51:46 +07:00
parent 976c1a6580
commit f67ee330b3
18 changed files with 3142 additions and 50 deletions

View File

@@ -21,6 +21,12 @@ public class BotEntity
public DateTime CreateDate { get; set; }
public DateTime UpdatedAt { get; set; }
public DateTime StartupTime { get; set; }
// Runtime tracking fields
public DateTime? LastStartTime { get; set; }
public DateTime? LastStopTime { get; set; }
public long AccumulatedRunTimeSeconds { get; set; }
public int TradeWins { get; set; }
public int TradeLosses { get; set; }
public decimal Pnl { get; set; }

View File

@@ -445,6 +445,10 @@ public class ManagingDbContext : DbContext
entity.Property(e => e.Status).IsRequired().HasConversion<string>();
entity.Property(e => e.CreateDate).IsRequired();
entity.Property(e => e.StartupTime).IsRequired();
// Runtime tracking fields
entity.Property(e => e.LastStartTime);
entity.Property(e => e.LastStopTime);
entity.Property(e => e.AccumulatedRunTimeSeconds);
entity.Property(e => e.TradeWins).IsRequired();
entity.Property(e => e.TradeLosses).IsRequired();
entity.Property(e => e.Pnl).HasPrecision(18, 8);

View File

@@ -692,6 +692,9 @@ public static class PostgreSqlMappers
Name = entity.Name,
Ticker = entity.Ticker,
StartupTime = entity.StartupTime,
LastStartTime = entity.LastStartTime,
LastStopTime = entity.LastStopTime,
AccumulatedRunTimeSeconds = entity.AccumulatedRunTimeSeconds,
TradeWins = entity.TradeWins,
TradeLosses = entity.TradeLosses,
Pnl = entity.Pnl,
@@ -719,6 +722,9 @@ public static class PostgreSqlMappers
Name = bot.Name,
Ticker = bot.Ticker,
StartupTime = bot.StartupTime,
LastStartTime = bot.LastStartTime,
LastStopTime = bot.LastStopTime,
AccumulatedRunTimeSeconds = bot.AccumulatedRunTimeSeconds,
TradeWins = bot.TradeWins,
TradeLosses = bot.TradeLosses,
Pnl = bot.Pnl,