feat(Core): update DTOs and shared models

This commit is contained in:
2026-08-09 21:01:38 +02:00
parent 6337e63a77
commit 5475c3ac51
58 changed files with 3418 additions and 30 deletions
@@ -0,0 +1,13 @@
using System;
namespace FinlyticCore.Models.Trades;
/// <summary>
/// Request payload for manually closing an active trade via REST API.
/// </summary>
public class CloseTradeRequest
{
public decimal UserExitPrice { get; set; }
public DateTime? UserExitTimestamp { get; set; }
public string CloseReason { get; set; } = "ManualClosure"; // "TakeProfitHit", "StopLossHit", "ManualClosure", "TimeExpired"
}
@@ -0,0 +1,31 @@
using System;
namespace FinlyticCore.Models.Trades;
public class TradeAcceptanceDto
{
public string TradeId { get; set; } = string.Empty;
public string AnalysisId { get; set; } = string.Empty;
public string Isin { get; set; } = string.Empty;
public string? UserId { get; set; } = "default_user";
public decimal? ActualEntryPrice { get; set; }
public decimal? PositionSize { get; set; }
public decimal? LeverageUsed { get; set; } = 1;
public decimal? EntryFee { get; set; } = 0;
public decimal? ExitFee { get; set; } = 0;
public string? Symbol { get; set; }
public string? SignalType { get; set; }
public decimal? EntryPrice { get; set; }
public decimal? StopLoss { get; set; }
public decimal? TakeProfit { get; set; }
public string? InstrumentType { get; set; }
public string? Timeframe { get; set; }
public string? Reasoning { get; set; }
public DateTime? ExecutionTimestamp { get; set; }
public decimal? Quantity { get; set; }
public decimal? KnockoutThreshold { get; set; }
public bool IsRecurring { get; set; } = false;
}
@@ -0,0 +1,35 @@
using System;
using FinlyticCore.Models.Analyzer;
namespace FinlyticCore.Models.Trades;
/// <summary>
/// Structured closed trade record exported to JSON/Parquet for AI win-rate calibration feedback loops.
/// </summary>
public class TradeFeedbackRecord
{
public string TradeId { get; set; } = string.Empty;
public string AnalysisId { get; set; } = string.Empty;
public string Sector { get; set; } = string.Empty;
public string Symbol { get; set; } = string.Empty;
public string Isin { get; set; } = string.Empty;
public decimal EntryPrice { get; set; }
public decimal StopLoss { get; set; }
public decimal TakeProfit { get; set; }
public decimal UserExitPrice { get; set; }
public decimal PnlAbsolute { get; set; }
public decimal PnlPercent { get; set; }
public bool IsWin { get; set; }
public string CloseReason { get; set; } = string.Empty;
public VixMarketRegime VixRegime { get; set; }
public decimal VixValue { get; set; }
public double ReactionDelayMinutes { get; set; }
public decimal SlippagePercent { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ClosedAt { get; set; }
}
@@ -0,0 +1,20 @@
using System;
namespace FinlyticCore.Models.Trades;
/// <summary>
/// Hourly AI recommendation update for an active trade.
/// </summary>
public class TradeHourlyUpdateDto
{
public string TradeId { get; set; } = string.Empty;
public string Recommendation { get; set; } = "Hold"; // "Hold", "AdjustSL", "AdjustTP", "Close"
public decimal CurrentPrice { get; set; }
public decimal? SuggestedStopLoss { get; set; }
public decimal? SuggestedTakeProfit { get; set; }
public decimal VixValue { get; set; }
public string Reasoning { get; set; } = string.Empty;
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
}
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using FinlyticCore.Models.Analyzer;
namespace FinlyticCore.Models.Trades;
/// <summary>
/// Trade proposal generated by FinlyticAnalyzer and dispatched via MQTT QoS 2.
/// </summary>
public class TradeProposalDto
{
public string TradeId { get; set; } = string.Empty;
public string? UserId { get; set; }
public bool IsGlobalProposal { get; set; } = true;
public string Status { get; set; } = "Proposed";
public string AnalysisId { get; set; } = string.Empty;
public string EventId { get; set; } = string.Empty;
public string Sector { get; set; } = string.Empty;
public string Symbol { get; set; } = string.Empty;
public string Isin { get; set; } = string.Empty;
public string CompanyName { get; set; } = string.Empty;
public decimal EntryPrice { get; set; }
public decimal StopLoss { get; set; }
public decimal TakeProfit { get; set; }
public string SignalType { get; set; } = "BUY"; // "BUY", "SELL"
public string RiskTolerance { get; set; } = "Moderate"; // "Conservative", "Moderate", "Aggressive"
public string Timeframe { get; set; } = "1D"; // "1H", "4H", "1D", "1W"
public string InstrumentType { get; set; } = "Stock"; // "Stock", "Option", "CFD", "Crypto"
public double WinRate { get; set; }
public VixMarketRegime VixRegime { get; set; }
public decimal VixValue { get; set; }
public int TtlMinutes { get; set; } = 60;
public string Reasoning { get; set; } = string.Empty;
// --- New Fields for Detailed Execution & Rationale ---
public decimal? EntryZoneMin { get; set; }
public decimal? EntryZoneMax { get; set; }
public List<decimal>? TakeProfitTargets { get; set; }
public decimal? RiskRewardRatio { get; set; }
public decimal? MaxLeverage { get; set; }
public string TechnicalRationale { get; set; } = string.Empty;
public string FundamentalRationale { get; set; } = string.Empty;
public string RiskWarning { get; set; } = string.Empty;
// --- Real Trade Execution Data ---
public decimal? ActualEntryPrice { get; set; }
public decimal? PositionSize { get; set; }
public decimal? LeverageUsed { get; set; }
public decimal? EntryFee { get; set; }
public decimal? ExitFee { get; set; }
public DateTime? ExecutionTimestamp { get; set; }
public decimal? Quantity { get; set; }
public decimal? KnockoutThreshold { get; set; }
public bool IsRecurring { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
+14
View File
@@ -0,0 +1,14 @@
namespace FinlyticCore.Models.Trades;
/// <summary>
/// Status of a proposed/active trade lifecycle.
/// </summary>
public enum TradeStatus
{
Proposed = 0,
Active = 1,
Closed = 2,
Expired = 3,
Rejected = 4,
Invalidated = 5
}