Fix Runtime by adding TotalRuntimeInSeconds
This commit is contained in:
1467
src/Managing.Infrastructure.Database/Migrations/20251005132435_AddBotRuntimeTracking.Designer.cs
generated
Normal file
1467
src/Managing.Infrastructure.Database/Migrations/20251005132435_AddBotRuntimeTracking.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Managing.Infrastructure.Databases.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddBotRuntimeTracking : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "AccumulatedRunTimeSeconds",
|
||||
table: "Bots",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "LastStartTime",
|
||||
table: "Bots",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "LastStopTime",
|
||||
table: "Bots",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AccumulatedRunTimeSeconds",
|
||||
table: "Bots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LastStartTime",
|
||||
table: "Bots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LastStopTime",
|
||||
table: "Bots");
|
||||
}
|
||||
}
|
||||
}
|
||||
1467
src/Managing.Infrastructure.Database/Migrations/20251005133552_ConfigureBotRuntimeFields.Designer.cs
generated
Normal file
1467
src/Managing.Infrastructure.Database/Migrations/20251005133552_ConfigureBotRuntimeFields.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Managing.Infrastructure.Databases.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ConfigureBotRuntimeFields : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,9 @@ namespace Managing.Infrastructure.Databases.Migrations
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("AccumulatedRunTimeSeconds")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("CreateDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
@@ -251,6 +254,12 @@ namespace Managing.Infrastructure.Databases.Migrations
|
||||
.HasPrecision(18, 8)
|
||||
.HasColumnType("numeric(18,8)");
|
||||
|
||||
b.Property<DateTime?>("LastStartTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("LastStopTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("LongPositionCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user