feat(engine): add FinlyticEngine microservice with trade lifecycle, AI reasoning gate, composite scoring, and unit tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user