Files
Predictalytics/src/Predictalytics.Domain/Entities/Trader.cs
T

71 lines
2.9 KiB
C#

using Predictalytics.Domain.Enums;
namespace Predictalytics.Domain.Entities;
/// <summary>
/// Represents a trader on a prediction market platform.
/// Identity is composite: PlatformType + PlatformUserId (e.g. wallet address on Polymarket).
/// </summary>
public class Trader
{
public int Id { get; set; }
/// <summary>The platform this trader belongs to.</summary>
public PlatformType Platform { get; set; }
/// <summary>Platform-specific user identifier (e.g. Ethereum wallet address for Polymarket).</summary>
public string PlatformUserId { get; set; } = string.Empty;
/// <summary>Display name / alias (can be auto-discovered or manually set).</summary>
public string DisplayName { get; set; } = string.Empty;
/// <summary>Optional notes about the trader.</summary>
public string? Notes { get; set; }
/// <summary>Whether this trader was auto-discovered or manually added.</summary>
public bool IsAutoDiscovered { get; set; }
/// <summary>Current tier classification.</summary>
public TraderTier Tier { get; set; } = TraderTier.Unknown;
/// <summary>Classified strategy type from deep-dive analysis.</summary>
public StrategyType Strategy { get; set; } = StrategyType.Unknown;
/// <summary>Whether the trader shows bot-like behavior.</summary>
public bool IsSuspectedBot { get; set; }
/// <summary>Manual priority override (null = use calculated score).</summary>
public int? ManualPriorityOverride { get; set; }
/// <summary>When this trader was first tracked.</summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>When data was last polled for this trader.</summary>
public DateTime? LastPolledAt { get; set; }
/// <summary>When the trader's trade history was last fully synced. Used for cooldown.</summary>
public DateTime? LastTradesUpdatedAt { get; set; }
/// <summary>Whether the initial full historical trade import is complete.</summary>
public bool IsInitialImportComplete { get; set; }
/// <summary>When the API first returned an error (e.g. 404 for deleted account).</summary>
public DateTime? LastApiErrorAt { get; set; }
/// <summary>Total estimated PnL across all resolved markets.</summary>
public decimal TotalPnl { get; set; }
/// <summary>Win rate as a percentage (0-100).</summary>
public decimal WinRate { get; set; }
/// <summary>Total number of trades tracked.</summary>
public int TotalTrades { get; set; }
// Navigation properties
public ICollection<Trade> Trades { get; set; } = new List<Trade>();
public TraderScore? CurrentScore { get; set; }
public virtual TraderAnalytics? Analytics { get; set; }
public ICollection<WatchlistEntry> WatchlistEntries { get; set; } = new List<WatchlistEntry>();
public ICollection<TraderPosition> Positions { get; set; } = new List<TraderPosition>();
}