38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
namespace bts.SilverPine;
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
public class MbpStreamParams {
|
|
[StreamArgument("venue", "exchange", "exch", IsRequired = true)]
|
|
public string? Venue { get; set; }
|
|
|
|
[StreamArgument("symbol", "sym", "product", "asset", IsRequired = true)]
|
|
public string? Symbol { get; set; }
|
|
|
|
[StreamArgument("begin", "beginDate", "start", "startDate", "from", IsRequired = true)]
|
|
public DateTime BeginDate { get; set; }
|
|
|
|
[StreamArgument("end", "endDate", "stop", "stopDate", "to", IsRequired = true)]
|
|
public DateTime EndDate { get; set; }
|
|
|
|
[StreamArgument("interval", IsRequired = true)]
|
|
public TimeSpan Interval { get; set; }
|
|
|
|
[StreamArgument("levels")]
|
|
public int NumLevels { get; set; }
|
|
|
|
[MemberNotNull(nameof(Venue), nameof(Symbol))]
|
|
public MbpStreamParams Validate() {
|
|
if (Venue is null) {
|
|
throw new InvalidOperationException("Venue is null");
|
|
}
|
|
if (Symbol is null) {
|
|
throw new InvalidOperationException("Symbol is null");
|
|
}
|
|
if (Interval <= TimeSpan.Zero) {
|
|
throw new InvalidOperationException("Interval <= TimeSpan.Zero");
|
|
}
|
|
return this;
|
|
}
|
|
}
|