So we can create ViewStreams that depend on other services, config, etc. Previously, the PrimitiveManager relied purely on static construction of types through reflection.
83 lines
3.2 KiB
C#
83 lines
3.2 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.AssetRegex })]
|
|
public string? Asset { get; set; }
|
|
|
|
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SecurityType })]
|
|
public SecurityType? Type { get; set; }
|
|
|
|
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.SecurityName })]
|
|
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.ShowAssetRegex })]
|
|
public bool ShowAsset { get; set; } = true;
|
|
|
|
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowSecurityTypeRegex })]
|
|
public bool ShowType { get; set; } = true;
|
|
|
|
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowSecurityNameRegex })]
|
|
public bool ShowName { get; set; } = true;
|
|
|
|
public bool ShowId { get; set; } = false;
|
|
|
|
[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.ShowLegAssetRegex })]
|
|
public bool ShowLegAsset { get; set; } = true;
|
|
|
|
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowLegSecurityTypeRegex })]
|
|
public bool ShowLegType { get; set; } = true;
|
|
|
|
[StreamArgument(RegexNames = new[] { WellKnownStreamArgumentAliases.ShowLegNameRegex })]
|
|
public bool ShowLegName { get; set; } = true;
|
|
|
|
public bool ShowLegId { get; set; } = false;
|
|
|
|
[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(Asset) ? new[] { Asset } : 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 = ShowType,
|
|
ShowAsset = ShowAsset,
|
|
ShowName = ShowName,
|
|
ShowId = ShowId,
|
|
ShowCashPerPoint = ShowCashPerPoint,
|
|
ShowLegVenue = ShowLegVenue,
|
|
ShowLegType = ShowLegType,
|
|
ShowLegAsset = ShowLegAsset,
|
|
ShowLegName = ShowLegName,
|
|
ShowLegId = ShowLegId,
|
|
ShowLegCashPerPoint = ShowLegCashPerPoint,
|
|
};
|
|
}
|