- Sidebar portfolio con metriche dettagliate (Totale, Investito, Disponibile, P&L, ROI) e aggiornamento real-time - Sistema multi-strategia: 8 strategie assegnabili per asset, voting decisionale, pagina Trading Control - Nuova pagina Posizioni: gestione, chiusura manuale, P&L non realizzato, notifiche - Sistema indicatori tecnici: 7+ indicatori configurabili, segnali real-time, raccomandazioni, storico segnali - Refactoring TradingBotService per capitale, P&L, ROI, eventi - Nuovi modelli e servizi per strategie/indicatori, persistenza configurazioni - UI/UX: navigazione aggiornata, widget, modali, responsive - Aggiornamento README e CHANGELOG con tutte le novità
138 lines
4.1 KiB
C#
138 lines
4.1 KiB
C#
namespace TradingBot.Models;
|
|
|
|
/// <summary>
|
|
/// Represents the mapping between an asset and its assigned trading strategies
|
|
/// </summary>
|
|
public class AssetStrategyMapping
|
|
{
|
|
public string Symbol { get; set; } = string.Empty;
|
|
public string AssetName { get; set; } = string.Empty;
|
|
public List<string> StrategyIds { get; set; } = new();
|
|
public bool IsActive { get; set; }
|
|
public DateTime ActivatedAt { get; set; }
|
|
public DateTime? DeactivatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Strategy-specific parameters override
|
|
/// Key: StrategyId, Value: Dictionary of parameter names and values
|
|
/// </summary>
|
|
public Dictionary<string, Dictionary<string, object>> StrategyParameters { get; set; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a trading strategy instance
|
|
/// </summary>
|
|
public class StrategyInfo
|
|
{
|
|
public string Id { get; set; } = string.Empty;
|
|
public string Name { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty;
|
|
public string Category { get; set; } = string.Empty; // Trend, Oscillator, Volatility, etc.
|
|
public StrategyRisk RiskLevel { get; set; }
|
|
public TimeFrame RecommendedTimeFrame { get; set; }
|
|
public List<string> RequiredIndicators { get; set; } = new();
|
|
public Dictionary<string, ParameterInfo> Parameters { get; set; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Parameter information for strategy configuration
|
|
/// </summary>
|
|
public class ParameterInfo
|
|
{
|
|
public string Name { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty;
|
|
public ParameterType Type { get; set; }
|
|
public object DefaultValue { get; set; } = 0;
|
|
public object? MinValue { get; set; }
|
|
public object? MaxValue { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Trading engine status for an asset
|
|
/// </summary>
|
|
public class TradingEngineStatus
|
|
{
|
|
public string Symbol { get; set; } = string.Empty;
|
|
public bool IsRunning { get; set; }
|
|
public int ActiveStrategies { get; set; }
|
|
public DateTime? LastSignalTime { get; set; }
|
|
public List<StrategySignal> RecentSignals { get; set; } = new();
|
|
public TradingDecision? LastDecision { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Signal from a specific strategy
|
|
/// </summary>
|
|
public class StrategySignal
|
|
{
|
|
public string StrategyId { get; set; } = string.Empty;
|
|
public string StrategyName { get; set; } = string.Empty;
|
|
public TradingSignal Signal { get; set; } = new();
|
|
public DateTime GeneratedAt { get; set; } = DateTime.UtcNow;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Aggregated trading decision from multiple strategies
|
|
/// </summary>
|
|
public class TradingDecision
|
|
{
|
|
public string Symbol { get; set; } = string.Empty;
|
|
public SignalType Decision { get; set; }
|
|
public decimal Confidence { get; set; }
|
|
public string Reason { get; set; } = string.Empty;
|
|
public int BuyVotes { get; set; }
|
|
public int SellVotes { get; set; }
|
|
public int HoldVotes { get; set; }
|
|
public List<string> SupportingStrategies { get; set; } = new();
|
|
public List<string> OpposingStrategies { get; set; } = new();
|
|
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Strategy performance metrics
|
|
/// </summary>
|
|
public class StrategyPerformance
|
|
{
|
|
public string StrategyId { get; set; } = string.Empty;
|
|
public string Symbol { get; set; } = string.Empty;
|
|
public int TotalSignals { get; set; }
|
|
public int CorrectSignals { get; set; }
|
|
public decimal Accuracy { get; set; }
|
|
public decimal TotalProfit { get; set; }
|
|
public decimal AverageConfidence { get; set; }
|
|
public DateTime FirstSignalTime { get; set; }
|
|
public DateTime LastSignalTime { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Risk level for strategies
|
|
/// </summary>
|
|
public enum StrategyRisk
|
|
{
|
|
Low,
|
|
Medium,
|
|
High,
|
|
VeryHigh
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recommended time frame for strategy
|
|
/// </summary>
|
|
public enum TimeFrame
|
|
{
|
|
ShortTerm, // Minutes to hours
|
|
MediumTerm, // Hours to days
|
|
LongTerm // Days to weeks
|
|
}
|
|
|
|
/// <summary>
|
|
/// Parameter data type
|
|
/// </summary>
|
|
public enum ParameterType
|
|
{
|
|
Integer,
|
|
Decimal,
|
|
Boolean,
|
|
String
|
|
}
|