refactor(bot): update paper trading models, broker integration, background services, and test project

This commit is contained in:
2026-08-24 21:37:10 +02:00
parent 5c95dd182c
commit 7060f0f7b1
32 changed files with 1904 additions and 1477 deletions
@@ -22,160 +22,131 @@ namespace FinlyticBot.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FinlyticBot.Entities.BotAuditLogEntity", b =>
modelBuilder.Entity("FinlyticBot.Database.Entities.BotPortfolioSnapshotEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal?>("AccountEquity")
b.Property<decimal>("CashEur")
.HasColumnType("decimal(18,4)");
b.Property<string>("Action")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal?>("CalculatedSize")
.HasColumnType("decimal(18,4)");
b.Property<bool>("IsAccepted")
.HasColumnType("boolean");
b.Property<string>("Reason")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<string>("Symbol")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<DateTime>("Timestamp")
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("timestamp with time zone");
b.Property<string>("TradeId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<decimal>("DailyRealizedPnlEur")
.HasColumnType("decimal(18,4)");
b.Property<int>("OpenPositionsCount")
.HasColumnType("integer");
b.Property<DateTime>("SnapshotDateUtc")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("TotalEquityEur")
.HasColumnType("decimal(18,4)");
b.Property<decimal>("TotalUnrealizedPnlEur")
.HasColumnType("decimal(18,4)");
b.Property<decimal?>("WinRatePercent")
.HasColumnType("decimal(6,2)");
b.HasKey("Id");
b.HasIndex("Action");
b.HasIndex("SnapshotDateUtc");
b.HasIndex("Symbol");
b.HasIndex("Timestamp");
b.HasIndex("TradeId");
b.ToTable("BotAuditLogs");
b.ToTable("bot_portfolio_snapshots");
});
modelBuilder.Entity("FinlyticBot.Entities.ExecutedPaperTradeEntity", b =>
modelBuilder.Entity("FinlyticBot.Database.Entities.BotPositionEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal?>("ActualFillPrice")
b.Property<string>("AlpacaOrderId")
.HasMaxLength(60)
.HasColumnType("character varying(60)");
b.Property<decimal>("AverageBuyIn")
.HasColumnType("decimal(18,4)");
b.Property<Guid?>("AlpacaOrderId")
.HasColumnType("uuid");
b.Property<string>("ClientOrderId")
.HasMaxLength(60)
.HasColumnType("character varying(60)");
b.Property<decimal>("CalculatedCrv")
.HasColumnType("decimal(18,4)");
b.Property<DateTime?>("ClosedAt")
b.Property<DateTime?>("ClosedAtUtc")
.HasColumnType("timestamp with time zone");
b.Property<string>("CompanyName")
b.Property<decimal>("CurrentPrice")
.HasColumnType("decimal(18,4)");
b.Property<decimal>("CurrentStopLoss")
.HasColumnType("decimal(18,4)");
b.Property<int>("Direction")
.HasColumnType("integer");
b.Property<decimal>("EntryPrice")
.HasColumnType("decimal(18,4)");
b.Property<string>("ExitPlan")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
.HasColumnType("jsonb");
b.Property<DateTime?>("FilledAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("InitialStopLoss")
.HasColumnType("decimal(18,4)");
b.Property<string>("Isin")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<DateTime>("PlacedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("Quantity")
.HasColumnType("decimal(18,4)");
b.Property<decimal>("RealizedPnl")
.HasColumnType("decimal(18,4)");
b.Property<decimal?>("RealizedPnlPercent")
.HasColumnType("decimal(18,4)");
b.Property<string>("RejectReason")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("Side")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<decimal>("SignalEntryPrice")
b.Property<DateTime>("LastSyncAtUtc")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("OpenedAtUtc")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("ProposalId")
.HasColumnType("uuid");
b.Property<decimal>("Quantity")
.HasColumnType("decimal(18,4)");
b.Property<decimal?>("SlippagePercent")
b.Property<decimal>("RealizedPnlEur")
.HasColumnType("decimal(18,4)");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal>("StopLossPrice")
.HasColumnType("decimal(18,4)");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<string>("Symbol")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal>("TakeProfitPrice1")
b.Property<decimal>("TakeProfit1")
.HasColumnType("decimal(18,4)");
b.Property<decimal?>("TakeProfitPrice2")
b.Property<decimal>("TakeProfit2")
.HasColumnType("decimal(18,4)");
b.Property<string>("TradeId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<decimal>("TotalFeesEur")
.HasColumnType("decimal(18,4)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<double>("WinRate")
.HasColumnType("double precision");
b.Property<int>("Venue")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AlpacaOrderId");
b.HasIndex("OpenedAtUtc");
b.HasIndex("Isin");
b.HasIndex("ProposalId");
b.HasIndex("PlacedAt");
b.HasIndex("Status", "Venue");
b.HasIndex("Status");
b.HasIndex("Symbol");
b.HasIndex("TradeId")
.IsUnique();
b.ToTable("ExecutedPaperTrades");
b.ToTable("bot_positions");
});
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>