feat(engine): add FinlyticEngine microservice with trade lifecycle, AI reasoning gate, composite scoring, and unit tests

This commit is contained in:
2026-08-24 21:37:05 +02:00
parent a4959658a2
commit 5c95dd182c
49 changed files with 7709 additions and 0 deletions
@@ -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");
}
}
}