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,71 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace FinlyticCore.Models.Analyzer;
public class AssetRecommendationDto
{
[JsonPropertyName("mode")]
public string Mode { get; set; } = "AUTO_SCREENER";
[JsonPropertyName("timestamp")]
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
[JsonPropertyName("recommended_asset")]
public RecommendedAssetInfo RecommendedAsset { get; set; } = new();
[JsonPropertyName("rationale")]
public RecommendationRationaleInfo Rationale { get; set; } = new();
[JsonPropertyName("action_required")]
public string ActionRequired { get; set; } = "PROMPT_USER_FOR_MANUAL_TRADE"; // "PROMPT_USER_FOR_MANUAL_TRADE" | "NO_ACTION"
}
public class RecommendedAssetInfo
{
[JsonPropertyName("symbol")]
public string Symbol { get; set; } = string.Empty;
[JsonPropertyName("company_name")]
public string CompanyName { get; set; } = string.Empty;
[JsonPropertyName("isin")]
public string Isin { get; set; } = string.Empty;
[JsonPropertyName("market")]
public string Market { get; set; } = "US_EQUITIES";
[JsonPropertyName("bias")]
public string Bias { get; set; } = "BULLISH"; // "BULLISH" | "BEARISH" | "NEUTRAL"
[JsonPropertyName("confidence_score")]
public double ConfidenceScore { get; set; }
[JsonPropertyName("timeframe")]
public string Timeframe { get; set; } = "1D";
}
public class RecommendationRationaleInfo
{
[JsonPropertyName("pattern_detected")]
public string PatternDetected { get; set; } = string.Empty;
[JsonPropertyName("vix_context")]
public string VixContext { get; set; } = string.Empty;
[JsonPropertyName("key_technical_levels")]
public KeyTechnicalLevelsInfo KeyTechnicalLevels { get; set; } = new();
[JsonPropertyName("summary")]
public string Summary { get; set; } = string.Empty;
}
public class KeyTechnicalLevelsInfo
{
[JsonPropertyName("support")]
public List<double> Support { get; set; } = new();
[JsonPropertyName("resistance")]
public List<double> Resistance { get; set; } = new();
}
@@ -0,0 +1,28 @@
using System.Text.Json.Serialization;
using FinlyticCore.Models.Trades;
namespace FinlyticCore.Models.Analyzer;
/// <summary>
/// Response payload for manual AI analysis trigger RPC.
/// </summary>
public class ManualAnalysisResponseDto
{
[JsonPropertyName("analysisId")]
public string AnalysisId { get; set; } = string.Empty;
[JsonPropertyName("isTradeProposed")]
public bool IsTradeProposed { get; set; }
[JsonPropertyName("status")]
public string Status { get; set; } = "Success";
[JsonPropertyName("recommendation")]
public string Recommendation { get; set; } = "RECOMMENDED";
[JsonPropertyName("n8nResponse")]
public N8nAnalysisResponseDto? N8nResponse { get; set; }
[JsonPropertyName("proposal")]
public TradeProposalDto? Proposal { get; set; }
}
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
namespace FinlyticCore.Models.Analyzer;
public class TargetAssetInfo
{
public string Symbol { get; set; } = string.Empty; // e.g. "AAPL"
public string Name { get; set; } = string.Empty; // e.g. "Apple Inc."
public string Isin { get; set; } = string.Empty;
public string Sector { get; set; } = string.Empty;
}
public class MarketContextInfo
{
public decimal Vix { get; set; }
public string MarketRegime { get; set; } = string.Empty;
}
public class FilterContextInfo
{
public double ImpactScore { get; set; }
public string RawNewsHeadline { get; set; } = string.Empty;
}
public class UserPreferencesInfo
{
public int RiskScore { get; set; } = 50; // 0 to 100
public string RiskTolerance { get; set; } = "Balanced";
public int MinTimeframeValue { get; set; } = 1;
public int MaxTimeframeValue { get; set; } = 7;
public string TimeframeUnit { get; set; } = "Tage"; // "Stunden", "Tage", "Wochen", "Monate"
public string TimeframeFormatted { get; set; } = "1-7 Tage";
public string InstrumentType { get; set; } = "Stock"; // "Stock", "KnockOut", "Option", "CFD", "Future"
public string UserNotes { get; set; } = string.Empty;
}
public class TradeFeedbackInfo
{
public int TotalAssetTrades { get; set; }
public double AssetWinRate { get; set; }
public double AvgReturnPercent { get; set; }
public string LastTradeResult { get; set; } = "NONE"; // "WIN", "LOSS", "NONE"
}
public class PatternContextInfo
{
public string PatternName { get; set; } = string.Empty;
public string? BreakoutDirection { get; set; }
public double? TargetPrice { get; set; }
public double? PotentialPercent { get; set; }
}
public class TechnicalContextInfo
{
public string Rsi { get; set; } = "N/A";
public string SupertrendStatus { get; set; } = "N/A";
public string Atr { get; set; } = "N/A";
public double? Sma50 { get; set; }
public double? Sma200 { get; set; }
public List<PatternContextInfo> DetectedPatterns { get; set; } = new();
}
public class SentimentContextInfo
{
public double AssetSentimentScore { get; set; }
public double SectorSentimentScore { get; set; }
public string NewsSentimentSummary { get; set; } = "Neutral";
}
public class FundamentalContextInfo
{
public double? PeRatio { get; set; }
public double? ForwardPeRatio { get; set; }
public double? PegRatio { get; set; }
public double? MarketCap { get; set; }
public double? DebtToEquity { get; set; }
public double? GrossMargin { get; set; }
public double? NetProfitMargin { get; set; }
public double? ReturnOnEquity { get; set; }
public double? DividendYield { get; set; }
public double? ShortPercentOfFloat { get; set; }
public double? AnalystTargetMedian { get; set; }
public double? EvToEbitda { get; set; }
}
public class N8nAnalysisRequestDto
{
public string RequestId { get; set; } = string.Empty;
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
public string TriggerType { get; set; } = "AutomatedNews"; // "Manual" | "AutomatedNews"
public TargetAssetInfo TargetAsset { get; set; } = new();
public MarketContextInfo MarketContext { get; set; } = new();
public FilterContextInfo FilterContext { get; set; } = new();
public UserPreferencesInfo UserPreferences { get; set; } = new();
public TradeFeedbackInfo TradeFeedback { get; set; } = new();
public TechnicalContextInfo TechnicalContext { get; set; } = new();
public SentimentContextInfo SentimentContext { get; set; } = new();
public FundamentalContextInfo FundamentalContext { get; set; } = new();
}
@@ -0,0 +1,39 @@
using System.Collections.Generic;
namespace FinlyticCore.Models.Analyzer;
public class N8nAnalysisResponseDto
{
public string RequestId { get; set; } = string.Empty;
public double EvalScore { get; set; } // 0.00 to 1.00
public string AiDecision { get; set; } = "Proceed"; // "Proceed" | "Reject" | "Hold"
public string SuggestedDirection { get; set; } = "Long"; // "Long" | "Short"
public string AiReasoning { get; set; } = string.Empty;
public string SuggestedTimeframe { get; set; } = "Intraday"; // "Scalp" | "Intraday" | "Swing"
public string SuggestedRisk { get; set; } = "Medium"; // "Low" | "Medium" | "High"
public ExecutionPlanInfo? ExecutionPlan { get; set; }
public DetailedAnalysisInfo? DetailedAnalysis { get; set; }
}
public class ExecutionPlanInfo
{
public EntryZoneInfo? EntryZone { get; set; }
public decimal StopLoss { get; set; }
public List<decimal>? TakeProfitTargets { get; set; }
public decimal RiskRewardRatio { get; set; }
public decimal MaxLeverage { get; set; }
}
public class EntryZoneInfo
{
public decimal Min { get; set; }
public decimal Max { get; set; }
}
public class DetailedAnalysisInfo
{
public string TechnicalRationale { get; set; } = string.Empty;
public string FundamentalRationale { get; set; } = string.Empty;
public string RiskWarning { get; set; } = string.Empty;
}
@@ -0,0 +1,12 @@
namespace FinlyticCore.Models.Analyzer;
/// <summary>
/// Market volatility regime derived from VIX / VDAX index level.
/// </summary>
public enum VixMarketRegime
{
LowVol = 0, // VIX < 15
Normal = 1, // VIX 15 - 20
HighVol = 2, // VIX 20 - 30
Panic = 3 // VIX > 30
}