Files
Encelado/TradingBot/Models/AssetStatistics.cs
Alberto Balbo d25b4443c0 Aggiunta Bootstrap 5.3.3 (CSS, JS, RTL, mappe) al progetto
Sono stati aggiunti tutti i file principali di Bootstrap 5.3.3, inclusi CSS, JavaScript (bundle, ESM, UMD, minificati), versioni RTL, utility, reboot, griglia e relative mappe delle sorgenti. Questi file abilitano un sistema di design moderno, responsive e accessibile, con supporto per layout LTR e RTL, debugging avanzato tramite source map e tutte le funzionalità di Bootstrap per lo sviluppo dell’interfaccia utente. Nessuna modifica ai file esistenti.
2025-12-12 23:27:28 +01:00

95 lines
3.8 KiB
C#

namespace TradingBot.Models;
public class AssetStatistics
{
public string Symbol { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
// Trading Performance
public int TotalTrades { get; set; }
public int WinningTrades { get; set; }
public int LosingTrades { get; set; }
public decimal WinRate => TotalTrades > 0 ? (decimal)WinningTrades / TotalTrades * 100 : 0;
// Financial Metrics
public decimal TotalProfit { get; set; }
public decimal TotalLoss { get; set; }
public decimal NetProfit => TotalProfit - TotalLoss;
public decimal ProfitPercentage { get; set; }
public decimal AverageProfit => WinningTrades > 0 ? TotalProfit / WinningTrades : 0;
public decimal AverageLoss => LosingTrades > 0 ? TotalLoss / LosingTrades : 0;
public decimal ProfitFactor => TotalLoss > 0 ? TotalProfit / TotalLoss : TotalProfit > 0 ? decimal.MaxValue : 0;
// Position Information
public decimal CurrentPosition { get; set; }
public decimal AverageEntryPrice { get; set; }
public decimal CurrentPrice { get; set; }
public decimal UnrealizedPnL => CurrentPosition > 0 && AverageEntryPrice > 0
? (CurrentPrice - AverageEntryPrice) * CurrentPosition
: 0;
public decimal UnrealizedPnLPercentage => AverageEntryPrice > 0
? (CurrentPrice - AverageEntryPrice) / AverageEntryPrice * 100
: 0;
// Risk Metrics
public decimal MaxDrawdown { get; set; }
public decimal CurrentDrawdown { get; set; }
public decimal LargestWin { get; set; }
public decimal LargestLoss { get; set; }
public decimal SharpeRatio { get; set; }
// Time-based Metrics
public DateTime? FirstTradeTime { get; set; }
public DateTime? LastTradeTime { get; set; }
public TimeSpan TradingDuration => FirstTradeTime.HasValue && LastTradeTime.HasValue
? LastTradeTime.Value - FirstTradeTime.Value
: TimeSpan.Zero;
// Daily Statistics
public int TradesToday { get; set; }
public decimal ProfitToday { get; set; }
public decimal ProfitTodayPercentage { get; set; }
// Trade Details
public List<Trade> RecentTrades { get; set; } = new();
public List<decimal> EquityCurve { get; set; } = new();
// Strategy Performance
public Dictionary<string, int> TradesByStrategy { get; set; } = new();
public Dictionary<string, decimal> ProfitByStrategy { get; set; } = new();
// Additional Metrics
public decimal AverageTradeSize { get; set; }
public decimal AverageHoldingTime { get; set; } // in hours
public int ConsecutiveWins { get; set; }
public int ConsecutiveLosses { get; set; }
public int MaxConsecutiveWins { get; set; }
public int MaxConsecutiveLosses { get; set; }
}
public class PortfolioStatistics
{
public decimal TotalBalance { get; set; }
public decimal InitialBalance { get; set; }
public decimal TotalProfit => TotalBalance - InitialBalance;
public decimal TotalProfitPercentage => InitialBalance > 0 ? (TotalProfit / InitialBalance) * 100 : 0;
public int TotalAssets { get; set; }
public int ActiveAssets { get; set; }
public int TotalTrades { get; set; }
public decimal WinRate { get; set; }
public decimal BestPerformingAssetProfit { get; set; }
public string BestPerformingAssetSymbol { get; set; } = string.Empty;
public decimal WorstPerformingAssetProfit { get; set; }
public string WorstPerformingAssetSymbol { get; set; } = string.Empty;
public List<AssetStatistics> AssetStatistics { get; set; } = new();
public Dictionary<string, decimal> DailyProfits { get; set; } = new();
public Dictionary<string, int> DailyTrades { get; set; } = new();
public DateTime? StartDate { get; set; }
public DateTime LastUpdateTime { get; set; } = DateTime.UtcNow;
}