Files
spark/src/DataStreamSuite/SharedStreams/StreamFactories/InstrumentStreamParams.cs
T
John Colvin ada7d4bed1 refactor: Load IDataStreamFactory(s) with dependency injection
So we can create ViewStreams that depend on other services, config, etc.
Previously, the PrimitiveManager relied purely on static construction of
types through reflection.
2025-11-14 14:52:07 -05:00

67 lines
2.6 KiB
C#

namespace Bts.SharedStreams.StreamFactories;
using bts.api;
using Bts.DataStreamCore;
public class InstrumentStreamParams {
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.VenueRegex })]
public Venue? Venue { get; set; }
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.Symbol })]
public string? Symbol { get; set; }
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SecurityType })]
public SecurityType? Type { get; set; }
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SecurityType })]
public string? Name { get; set; }
[StreamArgument("legs", "nLegs", "numLegs")]
public int NumLegs { get; set; } = 5;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowVenueRegex })]
public bool ShowVenue { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowSecurityTypeRegex })]
public bool ShowType { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowSymbolRegex })]
public bool ShowSymbol { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowCashPerPointRegex })]
public bool ShowCashPerPoint { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowLegVenueRegex })]
public bool ShowLegVenue { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowLegSecurityTypeRegex })]
public bool ShowLegType { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowLegSymbolRegex })]
public bool ShowLegSymbol { get; set; } = true;
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowLegCashPerPointRegex })]
public bool ShowLegCashPerPoint { get; set; } = true;
public mbts.spark.SecurityCriteria GetSecurityCriteria() {
var clause = new mbts.spark.SecurityCriteriaClause(
exchanges: Venue.HasValue ? new[] { Venue.Value } : null,
security_types: Type.HasValue ? new[] { Type.Value } : null,
symbols: !string.IsNullOrEmpty(Symbol) ? new[] { Symbol } : null,
names: !string.IsNullOrEmpty(Name) ? new[] { Name } : null);
return clause.is_defined ? new(new[] { clause }) : new();
}
public InstrumentSchemaBuilder GetSchemaBuilder() =>
new() {
NumLegs = NumLegs,
ShowVenue = ShowVenue,
ShowType = true,
ShowAsset = true,
ShowName = true,
ShowId = true,
ShowCashPerPoint = ShowCashPerPoint,
};
}