Trading bot grain (#33)

* Trading bot Grain

* Fix a bit more of the trading bot

* Advance on the tradingbot grain

* Fix build

* Fix db script

* Fix user login

* Fix a bit backtest

* Fix cooldown and backtest

* start fixing bot start

* Fix startup

* Setup local db

* Fix build and update candles and scenario

* Add bot registry

* Add reminder

* Updateing the grains

* fix bootstraping

* Save stats on tick

* Save bot data every tick

* Fix serialization

* fix save bot stats

* Fix get candles

* use dict instead of list for position

* Switch hashset to dict

* Fix a bit

* Fix bot launch and bot view

* add migrations

* Remove the tolist

* Add agent grain

* Save agent summary

* clean

* Add save bot

* Update get bots

* Add get bots

* Fix stop/restart

* fix Update config

* Update scanner table on new backtest saved

* Fix backtestRowDetails.tsx

* Fix agentIndex

* Update agentIndex

* Fix more things

* Update user cache

* Fix

* Fix account load/start/restart/run
This commit is contained in:
Oda
2025-08-04 23:07:06 +02:00
committed by GitHub
parent cd378587aa
commit 082ae8714b
215 changed files with 9562 additions and 14028 deletions

View File

@@ -66,6 +66,64 @@ namespace Managing.Infrastructure.Databases.Migrations
b.ToTable("Accounts");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.AgentSummaryEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ActiveStrategiesCount")
.HasColumnType("integer");
b.Property<string>("AgentName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("Losses")
.HasColumnType("integer");
b.Property<DateTime?>("Runtime")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("TotalPnL")
.HasColumnType("decimal(18,8)");
b.Property<decimal>("TotalROI")
.HasColumnType("decimal(18,8)");
b.Property<decimal>("TotalVolume")
.HasPrecision(18, 8)
.HasColumnType("numeric(18,8)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("UserId")
.HasColumnType("integer");
b.Property<int>("Wins")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AgentName");
b.HasIndex("TotalPnL");
b.HasIndex("UpdatedAt");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("AgentSummaries");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BacktestEntity", b =>
{
b.Property<int>("Id")
@@ -174,55 +232,71 @@ namespace Managing.Infrastructure.Databases.Migrations
b.ToTable("Backtests");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BotBackupEntity", b =>
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BotEntity", b =>
{
b.Property<int>("Id")
b.Property<Guid>("Identifier")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
.HasMaxLength(255)
.HasColumnType("uuid");
b.Property<DateTime>("CreateDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<decimal>("Fees")
.HasPrecision(18, 8)
.HasColumnType("numeric(18,8)");
b.Property<string>("Identifier")
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("LastStatus")
b.Property<decimal>("Pnl")
.HasPrecision(18, 8)
.HasColumnType("numeric(18,8)");
b.Property<decimal>("Roi")
.HasPrecision(18, 8)
.HasColumnType("numeric(18,8)");
b.Property<DateTime>("StartupTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Ticker")
.HasColumnType("integer");
b.Property<int>("TradeLosses")
.HasColumnType("integer");
b.Property<int>("TradeWins")
.HasColumnType("integer");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int?>("UserId")
b.Property<int>("UserId")
.HasColumnType("integer");
b.Property<string>("UserName")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<decimal>("Volume")
.HasPrecision(18, 8)
.HasColumnType("numeric(18,8)");
b.HasKey("Id");
b.HasKey("Identifier");
b.HasIndex("CreateDate");
b.HasIndex("Identifier")
.IsUnique();
b.HasIndex("LastStatus");
b.HasIndex("Status");
b.HasIndex("UserId");
b.HasIndex("UserName");
b.HasIndex("UserName", "CreateDate");
b.ToTable("BotBackups");
b.ToTable("Bots");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BundleBacktestRequestEntity", b =>
@@ -616,11 +690,9 @@ namespace Managing.Infrastructure.Databases.Migrations
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.PositionEntity", b =>
{
b.Property<int>("Id")
b.Property<Guid>("Identifier")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
.HasColumnType("uuid");
b.Property<string>("AccountName")
.IsRequired()
@@ -633,11 +705,6 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<DateTime>("Date")
.HasColumnType("timestamp with time zone");
b.Property<string>("Identifier")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("Initiator")
.IsRequired()
.HasColumnType("text");
@@ -684,7 +751,7 @@ namespace Managing.Infrastructure.Databases.Migrations
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.HasKey("Id");
b.HasKey("Identifier");
b.HasIndex("CreatedAt");
@@ -1248,12 +1315,24 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BotBackupEntity", b =>
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.AgentSummaryEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BotEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull)
.IsRequired();
b.Navigation("User");
});