namespace Bts.SharedStreams.StreamFactories; using bts.api; public class BookStreamParams { [StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.VenueRegex })] public Venue? Venue { get; set; } [StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SymbolRegex })] public string? Symbol { get; set; } [StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SecurityTypeRegex })] public SecurityType? SecurityType { get; set; } [StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SecurityNameRegex })] public string? SecurityName { get; set; } [StreamArgument(RegexNames = new[] { "$(levels|nLevels|numLevels|n)^" })] public int NumLevels { get; set; } = 5; [StreamArgument(RegexNames = new[] { "$(show|include)?(price|px|p)^" })] public bool ShowPrice { get; set; } = true; [StreamArgument(RegexNames = new[] { "$(show|include)?(quantity|qty|q)^" })] public bool ShowQuantity { get; set; } = true; [StreamArgument(RegexNames = new[] { "$(show|include)?(notional|notl)^" })] public bool ShowNotional { get; set; } [StreamArgument(RegexNames = new[] { "$(show|include)?(cashPerPoint|cpp)^" })] public bool ShowCashPerPoint { get; set; } = true; public mbts.spark.SecurityCriteria GetSecurityCriteria() { var clause = new mbts.spark.SecurityCriteriaClause( exchanges: Venue.HasValue ? new[] { Venue.Value } : null, security_types: SecurityType.HasValue ? new[] { SecurityType.Value } : null, symbols: !string.IsNullOrEmpty(Symbol) ? new[] { Symbol } : null, names: !string.IsNullOrEmpty(SecurityName) ? new[] { SecurityName } : null); return clause.is_defined ? new(new[] { clause }) : new(); } public BookSchemaBuilder GetSchemaBuilder() => new() { NumLevels = NumLevels, ShowVenue = true, ShowSecurityType = true, ShowAsset = true, ShowSecurityName = true, ShowSecurityId = true, ShowPrice = ShowPrice, ShowQuantity = ShowQuantity, ShowNotional = ShowNotional, ShowCashPerPoint = ShowCashPerPoint, }; }