using System; using System.Collections.Generic; namespace NT8.Core.MarketData { /// /// Represents bid-ask spread information for a symbol /// public class SpreadInfo { /// /// Symbol for the spread information /// public string Symbol { get; set; } /// /// Current bid price /// public double Bid { get; set; } /// /// Current ask price /// public double Ask { get; set; } /// /// Calculated spread value (ask - bid) /// public double Spread { get; set; } /// /// Spread as percentage of midpoint /// public double SpreadPercentage { get; set; } /// /// Timestamp of the spread measurement /// public DateTime Timestamp { get; set; } /// /// Constructor for SpreadInfo /// /// Symbol for the spread /// Bid price /// Ask price /// Timestamp of measurement public SpreadInfo(string symbol, double bid, double ask, DateTime timestamp) { if (string.IsNullOrEmpty(symbol)) throw new ArgumentNullException("symbol"); Symbol = symbol; Bid = bid; Ask = ask; Spread = ask - bid; SpreadPercentage = Spread > 0 && bid > 0 ? (Spread / ((bid + ask) / 2.0)) * 100 : 0; Timestamp = timestamp; } } /// /// Metrics representing liquidity conditions for a symbol /// public class LiquidityMetrics { /// /// Symbol for the liquidity metrics /// public string Symbol { get; set; } /// /// Current bid-ask spread /// public double Spread { get; set; } /// /// Average spread over recent period /// public double AverageSpread { get; set; } /// /// Bid volume at best bid level /// public long BidVolume { get; set; } /// /// Ask volume at best ask level /// public long AskVolume { get; set; } /// /// Total depth in the order book /// public long TotalDepth { get; set; } /// /// Number of orders at each level /// public int OrderLevels { get; set; } /// /// Timestamp of the metrics /// public DateTime Timestamp { get; set; } /// /// Constructor for LiquidityMetrics /// /// Symbol for the metrics /// Current spread /// Average spread /// Bid volume /// Ask volume /// Total order book depth /// Number of order levels /// Timestamp of metrics public LiquidityMetrics( string symbol, double spread, double averageSpread, long bidVolume, long askVolume, long totalDepth, int orderLevels, DateTime timestamp) { if (string.IsNullOrEmpty(symbol)) throw new ArgumentNullException("symbol"); Symbol = symbol; Spread = spread; AverageSpread = averageSpread; BidVolume = bidVolume; AskVolume = askVolume; TotalDepth = totalDepth; OrderLevels = orderLevels; Timestamp = timestamp; } } /// /// Information about the current trading session /// public class SessionInfo { /// /// Symbol for the session information /// public string Symbol { get; set; } /// /// Current trading session type /// public TradingSession Session { get; set; } /// /// Start time of current session /// public DateTime SessionStart { get; set; } /// /// End time of current session /// public DateTime SessionEnd { get; set; } /// /// Time remaining in current session /// public TimeSpan TimeRemaining { get; set; } /// /// Whether this is regular trading hours /// public bool IsRegularHours { get; set; } /// /// Constructor for SessionInfo /// /// Symbol for the session /// Current session type /// Session start time /// Session end time /// Time remaining in session /// Whether it's regular trading hours public SessionInfo( string symbol, TradingSession session, DateTime sessionStart, DateTime sessionEnd, TimeSpan timeRemaining, bool isRegularHours) { if (string.IsNullOrEmpty(symbol)) throw new ArgumentNullException("symbol"); Symbol = symbol; Session = session; SessionStart = sessionStart; SessionEnd = sessionEnd; TimeRemaining = timeRemaining; IsRegularHours = isRegularHours; } } /// /// Information about contract roll status /// public class ContractRollInfo { /// /// Base symbol (e.g., ES for ESZ24, ESH25) /// public string BaseSymbol { get; set; } /// /// Current active contract /// public string ActiveContract { get; set; } /// /// Next contract to roll to /// public string NextContract { get; set; } /// /// Date of the roll /// public DateTime RollDate { get; set; } /// /// Days remaining until roll /// public int DaysToRoll { get; set; } /// /// Whether currently in roll period /// public bool IsRollPeriod { get; set; } /// /// Constructor for ContractRollInfo /// /// Base symbol /// Current active contract /// Next contract to roll to /// Roll date /// Days until roll /// Whether in roll period public ContractRollInfo( string baseSymbol, string activeContract, string nextContract, DateTime rollDate, int daysToRoll, bool isRollPeriod) { if (string.IsNullOrEmpty(baseSymbol)) throw new ArgumentNullException("baseSymbol"); BaseSymbol = baseSymbol; ActiveContract = activeContract; NextContract = nextContract; RollDate = rollDate; DaysToRoll = daysToRoll; IsRollPeriod = isRollPeriod; } } /// /// Enum representing liquidity quality score /// public enum LiquidityScore { /// /// Very poor liquidity conditions /// Poor = 0, /// /// Fair liquidity conditions /// Fair = 1, /// /// Good liquidity conditions /// Good = 2, /// /// Excellent liquidity conditions /// Excellent = 3 } /// /// Enum representing different trading sessions /// public enum TradingSession { /// /// Pre-market session /// PreMarket = 0, /// /// Regular trading hours /// RTH = 1, /// /// Extended trading hours /// ETH = 2, /// /// Market closed /// Closed = 3 } }