feat(core): add shared DTOs, MqttTopics constants, DatabaseBootstrapper, and ManagedMqttClient extensions
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
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 decimal ExitFee { get; set; } = 1.0m;
|
||||
public string CloseReason { get; set; } = "ManualClosure"; // "TakeProfitHit", "StopLossHit", "ManualClosure", "TimeExpired"
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
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; }
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using FinlyticCore.Models.Analyzer;
|
||||
|
||||
namespace FinlyticCore.Models.Trades;
|
||||
|
||||
/// <summary>
|
||||
/// Trade proposal generated by FinlyticAnalyzer and dispatched via MQTT QoS 2.
|
||||
/// </summary>
|
||||
public class TradeProposalDto
|
||||
{
|
||||
[JsonPropertyName("tradeId")]
|
||||
public string TradeId { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("userId")]
|
||||
public string? UserId { get; set; }
|
||||
|
||||
[JsonPropertyName("isGlobalProposal")]
|
||||
public bool IsGlobalProposal { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; } = "Proposed";
|
||||
|
||||
[JsonPropertyName("analysisId")]
|
||||
public string AnalysisId { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("eventId")]
|
||||
public string EventId { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("sector")]
|
||||
public string Sector { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("symbol")]
|
||||
public string Symbol { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("isin")]
|
||||
public string Isin { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("companyName")]
|
||||
public string CompanyName { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("entryPrice")]
|
||||
public decimal EntryPrice { get; set; }
|
||||
|
||||
[JsonPropertyName("stopLoss")]
|
||||
public decimal StopLoss { get; set; }
|
||||
|
||||
[JsonPropertyName("takeProfit")]
|
||||
public decimal TakeProfit { get; set; }
|
||||
|
||||
[JsonPropertyName("signalType")]
|
||||
public string SignalType { get; set; } = "BUY"; // "BUY", "SELL"
|
||||
|
||||
[JsonPropertyName("riskTolerance")]
|
||||
public string RiskTolerance { get; set; } = "Moderate"; // "Conservative", "Moderate", "Aggressive"
|
||||
|
||||
[JsonPropertyName("timeframe")]
|
||||
public string Timeframe { get; set; } = "1D"; // "1H", "4H", "1D", "1W"
|
||||
|
||||
[JsonPropertyName("instrumentType")]
|
||||
public string InstrumentType { get; set; } = "Stock"; // "Stock", "Option", "CFD", "Crypto"
|
||||
|
||||
[JsonPropertyName("assetType")]
|
||||
public string AssetType { get; set; } = "stock"; // "stock", "etf", "crypto", "bond"
|
||||
|
||||
[JsonPropertyName("hasCfd")]
|
||||
public bool HasCfd { get; set; }
|
||||
|
||||
[JsonPropertyName("derivativeProductCategories")]
|
||||
public List<string> DerivativeProductCategories { get; set; } = new();
|
||||
|
||||
[JsonPropertyName("derivativeIsin")]
|
||||
public string? DerivativeIsin { get; set; }
|
||||
|
||||
[JsonPropertyName("winRate")]
|
||||
public double WinRate { get; set; }
|
||||
|
||||
[JsonPropertyName("vixRegime")]
|
||||
public VixMarketRegime VixRegime { get; set; }
|
||||
|
||||
[JsonPropertyName("vixValue")]
|
||||
public decimal VixValue { get; set; }
|
||||
|
||||
[JsonPropertyName("ttlMinutes")]
|
||||
public int TtlMinutes { get; set; } = 60;
|
||||
|
||||
[JsonPropertyName("reasoning")]
|
||||
public string Reasoning { get; set; } = string.Empty;
|
||||
|
||||
// --- New Fields for Detailed Execution & Rationale ---
|
||||
[JsonPropertyName("entryZoneMin")]
|
||||
public decimal? EntryZoneMin { get; set; }
|
||||
|
||||
[JsonPropertyName("entryZoneMax")]
|
||||
public decimal? EntryZoneMax { get; set; }
|
||||
|
||||
[JsonPropertyName("takeProfitTargets")]
|
||||
public List<decimal>? TakeProfitTargets { get; set; }
|
||||
|
||||
[JsonPropertyName("riskRewardRatio")]
|
||||
public decimal? RiskRewardRatio { get; set; }
|
||||
|
||||
[JsonPropertyName("maxLeverage")]
|
||||
public decimal? MaxLeverage { get; set; }
|
||||
|
||||
[JsonPropertyName("technicalRationale")]
|
||||
public string TechnicalRationale { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("fundamentalRationale")]
|
||||
public string FundamentalRationale { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("riskWarning")]
|
||||
public string RiskWarning { get; set; } = string.Empty;
|
||||
|
||||
// --- Real Trade Execution Data ---
|
||||
[JsonPropertyName("actualEntryPrice")]
|
||||
public decimal? ActualEntryPrice { get; set; }
|
||||
|
||||
[JsonPropertyName("positionSize")]
|
||||
public decimal? PositionSize { get; set; }
|
||||
|
||||
[JsonPropertyName("leverageUsed")]
|
||||
public decimal? LeverageUsed { get; set; }
|
||||
|
||||
[JsonPropertyName("entryFee")]
|
||||
public decimal? EntryFee { get; set; }
|
||||
|
||||
[JsonPropertyName("exitFee")]
|
||||
public decimal? ExitFee { get; set; }
|
||||
|
||||
[JsonPropertyName("executionTimestamp")]
|
||||
public DateTime? ExecutionTimestamp { get; set; }
|
||||
|
||||
[JsonPropertyName("quantity")]
|
||||
public decimal? Quantity { get; set; }
|
||||
|
||||
[JsonPropertyName("knockoutThreshold")]
|
||||
public decimal? KnockoutThreshold { get; set; }
|
||||
|
||||
[JsonPropertyName("isRecurring")]
|
||||
public bool IsRecurring { get; set; } = false;
|
||||
|
||||
[JsonPropertyName("currentPrice")]
|
||||
public decimal? CurrentPrice { get; set; }
|
||||
|
||||
[JsonPropertyName("pnlAbsolute")]
|
||||
public decimal? PnlAbsolute { get; set; }
|
||||
|
||||
[JsonPropertyName("pnlPercent")]
|
||||
public decimal? PnlPercent { get; set; }
|
||||
|
||||
[JsonPropertyName("closeReason")]
|
||||
public string? CloseReason { get; set; }
|
||||
|
||||
[JsonPropertyName("userExitTimestamp")]
|
||||
public DateTime? UserExitTimestamp { get; set; }
|
||||
|
||||
[JsonPropertyName("hasPendingExitAlert")]
|
||||
public bool HasPendingExitAlert { get; set; } = false;
|
||||
|
||||
[JsonPropertyName("pendingExitReason")]
|
||||
public string? PendingExitReason { get; set; }
|
||||
|
||||
[JsonPropertyName("hourlyUpdates")]
|
||||
public List<TradeHourlyUpdateDto>? HourlyUpdates { get; set; }
|
||||
|
||||
[JsonPropertyName("createdAt")]
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user