feat(engine): add FinlyticEngine microservice with trade lifecycle, AI reasoning gate, composite scoring, and unit tests
This commit is contained in:
+334
@@ -0,0 +1,334 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
[Migration("20260819185016_InitialEngineMigration")]
|
||||
partial class InitialEngineMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialEngineMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DynamicSettings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Key = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: false),
|
||||
ValueJson = table.Column<string>(type: "text", nullable: false),
|
||||
ServiceIdentifier = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
LastUpdatedUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DynamicSettings", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "engine_evaluation_snapshots",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Isin = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
Symbol = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
|
||||
TechnicalScore = table.Column<decimal>(type: "numeric(6,2)", nullable: false),
|
||||
SentimentScore = table.Column<decimal>(type: "numeric(6,2)", nullable: false),
|
||||
FundamentalScore = table.Column<decimal>(type: "numeric(6,2)", nullable: false),
|
||||
CompositeOpportunityScore = table.Column<decimal>(type: "numeric(6,2)", nullable: false),
|
||||
PassedEarningsLockout = table.Column<bool>(type: "boolean", nullable: false),
|
||||
DaysToNextEarnings = table.Column<int>(type: "integer", nullable: true),
|
||||
PassedAiValidation = table.Column<bool>(type: "boolean", nullable: false),
|
||||
AiThesisSummary = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
|
||||
EvaluatedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_engine_evaluation_snapshots", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "engine_trade_proposals",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UnderlyingIsin = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
Symbol = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
|
||||
StrategyKey = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
Direction = table.Column<int>(type: "integer", nullable: false),
|
||||
QualityScore = table.Column<decimal>(type: "numeric(6,2)", nullable: false),
|
||||
CompositeScore = table.Column<decimal>(type: "numeric(6,2)", nullable: false),
|
||||
CurrentPrice = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
EntryPrice = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
StopLoss = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
TakeProfit1 = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
RiskRewardRatio = table.Column<decimal>(type: "numeric(8,2)", nullable: false),
|
||||
ExitPlan = table.Column<string>(type: "jsonb", nullable: false),
|
||||
SelectedDerivative = table.Column<string>(type: "jsonb", nullable: true),
|
||||
AiValidation = table.Column<string>(type: "jsonb", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CreatedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ExpiresAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_engine_trade_proposals", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "engine_trades",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ProposalId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UnderlyingIsin = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
Symbol = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
|
||||
DerivativeIsin = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
|
||||
DerivativeWkn = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
|
||||
ExecutionMode = table.Column<int>(type: "integer", nullable: false),
|
||||
InstrumentType = table.Column<int>(type: "integer", nullable: false),
|
||||
Direction = table.Column<int>(type: "integer", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
AverageBuyIn = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
TotalQuantity = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
InitialStopLoss = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
CurrentStopLoss = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
CurrentPrice = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
TakeProfit1 = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
TakeProfit2 = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
TakeProfitRunner = table.Column<decimal>(type: "numeric(18,4)", nullable: true),
|
||||
RealizedPnlEur = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
TotalFeesEur = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
ExitPlan = table.Column<string>(type: "jsonb", nullable: false),
|
||||
ScoreBreakdownJson = table.Column<string>(type: "text", nullable: false),
|
||||
OpenedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ClosedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
LastUpdatedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_engine_trades", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "engine_trade_fills",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
TradeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ExecutedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Price = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
Quantity = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
Fee = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
|
||||
Note = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_engine_trade_fills", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_engine_trade_fills_engine_trades_TradeId",
|
||||
column: x => x.TradeId,
|
||||
principalTable: "engine_trades",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DynamicSettings_Key",
|
||||
table: "DynamicSettings",
|
||||
column: "Key",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_evaluation_snapshots_CompositeOpportunityScore",
|
||||
table: "engine_evaluation_snapshots",
|
||||
column: "CompositeOpportunityScore");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_evaluation_snapshots_Isin_EvaluatedAtUtc",
|
||||
table: "engine_evaluation_snapshots",
|
||||
columns: new[] { "Isin", "EvaluatedAtUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trade_fills_TradeId_ExecutedAtUtc",
|
||||
table: "engine_trade_fills",
|
||||
columns: new[] { "TradeId", "ExecutedAtUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trade_proposals_CompositeScore",
|
||||
table: "engine_trade_proposals",
|
||||
column: "CompositeScore");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trade_proposals_CreatedAtUtc",
|
||||
table: "engine_trade_proposals",
|
||||
column: "CreatedAtUtc");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trade_proposals_UnderlyingIsin_IsActive_ExpiresAtUtc",
|
||||
table: "engine_trade_proposals",
|
||||
columns: new[] { "UnderlyingIsin", "IsActive", "ExpiresAtUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trades_OpenedAtUtc",
|
||||
table: "engine_trades",
|
||||
column: "OpenedAtUtc");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trades_Status_UnderlyingIsin",
|
||||
table: "engine_trades",
|
||||
columns: new[] { "Status", "UnderlyingIsin" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "DynamicSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "engine_trade_fills");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "engine_trade_proposals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "engine_trades");
|
||||
}
|
||||
}
|
||||
}
|
||||
+339
@@ -0,0 +1,339 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
[Migration("20260821164201_AddUserIdToEngineTrades")]
|
||||
partial class AddUserIdToEngineTrades
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUserIdToEngineTrades : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "engine_trades",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trades_UserId_Status",
|
||||
table: "engine_trades",
|
||||
columns: new[] { "UserId", "Status" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_engine_trades_UserId_Status",
|
||||
table: "engine_trades");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "engine_trades");
|
||||
}
|
||||
}
|
||||
}
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
[Migration("20260821165914_AddUniqueIndexUserIdProposalId")]
|
||||
partial class AddUniqueIndexUserIdProposalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.HasIndex("UserId", "ProposalId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"ProposalId\" <> '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUniqueIndexUserIdProposalId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_trades_UserId_ProposalId",
|
||||
table: "engine_trades",
|
||||
columns: new[] { "UserId", "ProposalId" },
|
||||
unique: true,
|
||||
filter: "\"ProposalId\" <> '00000000-0000-0000-0000-000000000000'");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_engine_trades_UserId_ProposalId",
|
||||
table: "engine_trades");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+396
@@ -0,0 +1,396 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
[Migration("20260821215934_AddEvaluationOutcomeTrackingAndScanCycles")]
|
||||
partial class AddEvaluationOutcomeTrackingAndScanCycles
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("OutcomeReason")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedSimulationVeto")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<Guid?>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("ReliabilityBonus")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int>("TriggerSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("TriggeredByUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("OutcomeReason", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("TriggerSource", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineScanCycleEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CandidateIsins")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("CandidatesReturnedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CycleStartedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("RequestedLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal?>("RequestedMinScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CycleStartedAtUtc");
|
||||
|
||||
b.ToTable("engine_scan_cycles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.HasIndex("UserId", "ProposalId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"ProposalId\" <> '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddEvaluationOutcomeTrackingAndScanCycles : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OutcomeReason",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "PassedSimulationVeto",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProposalId",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "ReliabilityBonus",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "numeric(6,2)",
|
||||
nullable: false,
|
||||
defaultValue: 0m);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "TriggerSource",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TriggeredByUserId",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "engine_scan_cycles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CycleStartedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
RequestedLimit = table.Column<int>(type: "integer", nullable: false),
|
||||
RequestedMinScore = table.Column<decimal>(type: "numeric(6,2)", nullable: true),
|
||||
CandidatesReturnedCount = table.Column<int>(type: "integer", nullable: false),
|
||||
CandidateIsins = table.Column<string>(type: "jsonb", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_engine_scan_cycles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_evaluation_snapshots_OutcomeReason_EvaluatedAtUtc",
|
||||
table: "engine_evaluation_snapshots",
|
||||
columns: new[] { "OutcomeReason", "EvaluatedAtUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_evaluation_snapshots_TriggerSource_EvaluatedAtUtc",
|
||||
table: "engine_evaluation_snapshots",
|
||||
columns: new[] { "TriggerSource", "EvaluatedAtUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_engine_scan_cycles_CycleStartedAtUtc",
|
||||
table: "engine_scan_cycles",
|
||||
column: "CycleStartedAtUtc");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "engine_scan_cycles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_engine_evaluation_snapshots_OutcomeReason_EvaluatedAtUtc",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_engine_evaluation_snapshots_TriggerSource_EvaluatedAtUtc",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OutcomeReason",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PassedSimulationVeto",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProposalId",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReliabilityBonus",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TriggerSource",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TriggeredByUserId",
|
||||
table: "engine_evaluation_snapshots");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+402
@@ -0,0 +1,402 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
[Migration("20260822081405_AddUniverseSourceToEvaluationSnapshot")]
|
||||
partial class AddUniverseSourceToEvaluationSnapshot
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("OutcomeReason")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedSimulationVeto")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<Guid?>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("ReliabilityBonus")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int>("TriggerSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("TriggeredByUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime?>("UniverseEnteredAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("UniverseSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("OutcomeReason", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("TriggerSource", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineScanCycleEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CandidateIsins")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("CandidatesReturnedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CycleStartedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("RequestedLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal?>("RequestedMinScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CycleStartedAtUtc");
|
||||
|
||||
b.ToTable("engine_scan_cycles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.HasIndex("UserId", "ProposalId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"ProposalId\" <> '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUniverseSourceToEvaluationSnapshot : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UniverseEnteredAtUtc",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "UniverseSource",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UniverseEnteredAtUtc",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UniverseSource",
|
||||
table: "engine_evaluation_snapshots");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
[Migration("20260822083821_AddDividendGate")]
|
||||
partial class AddDividendGate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("DaysToNextExDividend")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("OutcomeReason")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedDividendGate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedSimulationVeto")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<Guid?>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("ReliabilityBonus")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int>("TriggerSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("TriggeredByUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime?>("UniverseEnteredAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("UniverseSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("OutcomeReason", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("TriggerSource", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineScanCycleEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CandidateIsins")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("CandidatesReturnedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CycleStartedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("RequestedLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal?>("RequestedMinScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CycleStartedAtUtc");
|
||||
|
||||
b.ToTable("engine_scan_cycles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.HasIndex("UserId", "ProposalId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"ProposalId\" <> '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddDividendGate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DaysToNextExDividend",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "PassedDividendGate",
|
||||
table: "engine_evaluation_snapshots",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DaysToNextExDividend",
|
||||
table: "engine_evaluation_snapshots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PassedDividendGate",
|
||||
table: "engine_evaluation_snapshots");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FinlyticEngine.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FinlyticEngine.Migrations
|
||||
{
|
||||
[DbContext(typeof(EngineDbContext))]
|
||||
partial class EngineDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FinlyticCore.Entities.Settings.SettingEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ServiceIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DynamicSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineEvaluationSnapshotEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiThesisSummary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<decimal>("CompositeOpportunityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int?>("DaysToNextEarnings")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("DaysToNextExDividend")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("EvaluatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("FundamentalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Isin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("OutcomeReason")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PassedAiValidation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedDividendGate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<bool>("PassedEarningsLockout")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PassedSimulationVeto")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<Guid?>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("ReliabilityBonus")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("SentimentScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TechnicalScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<int>("TriggerSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("TriggeredByUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime?>("UniverseEnteredAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("UniverseSource")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeOpportunityScore");
|
||||
|
||||
b.HasIndex("Isin", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("OutcomeReason", "EvaluatedAtUtc");
|
||||
|
||||
b.HasIndex("TriggerSource", "EvaluatedAtUtc");
|
||||
|
||||
b.ToTable("engine_evaluation_snapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineScanCycleEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CandidateIsins")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("CandidatesReturnedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CycleStartedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("RequestedLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal?>("RequestedMinScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CycleStartedAtUtc");
|
||||
|
||||
b.ToTable("engine_scan_cycles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("AverageBuyIn")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<DateTime?>("ClosedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("CurrentStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("DerivativeIsin")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("DerivativeWkn")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ExecutionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("InitialStopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("InstrumentType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("LastUpdatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("OpenedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("ProposalId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal>("RealizedPnlEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ScoreBreakdownJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TakeProfit2")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal?>("TakeProfitRunner")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalFeesEur")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("TotalQuantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenedAtUtc");
|
||||
|
||||
b.HasIndex("Status", "UnderlyingIsin");
|
||||
|
||||
b.HasIndex("UserId", "ProposalId")
|
||||
.IsUnique()
|
||||
.HasFilter("\"ProposalId\" <> '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("engine_trades");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ExecutedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("Fee")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("Quantity")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<Guid>("TradeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TradeId", "ExecutedAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_fills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeProposalEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AiValidation")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("CompositeScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<decimal>("CurrentPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int>("Direction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("EntryPrice")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ExitPlan")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("ExpiresAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal>("QualityScore")
|
||||
.HasColumnType("decimal(6,2)");
|
||||
|
||||
b.Property<decimal>("RiskRewardRatio")
|
||||
.HasColumnType("decimal(8,2)");
|
||||
|
||||
b.Property<string>("SelectedDerivative")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<decimal>("StopLoss")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("StrategyKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Symbol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<decimal>("TakeProfit1")
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnderlyingIsin")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompositeScore");
|
||||
|
||||
b.HasIndex("CreatedAtUtc");
|
||||
|
||||
b.HasIndex("UnderlyingIsin", "IsActive", "ExpiresAtUtc");
|
||||
|
||||
b.ToTable("engine_trade_proposals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeFillEntity", b =>
|
||||
{
|
||||
b.HasOne("FinlyticEngine.Database.Entities.EngineTradeEntity", "Trade")
|
||||
.WithMany("Fills")
|
||||
.HasForeignKey("TradeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Trade");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FinlyticEngine.Database.Entities.EngineTradeEntity", b =>
|
||||
{
|
||||
b.Navigation("Fills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user