fix: Pass symbol/venue from vs usage cfg to AnalyticsService proto
This commit is contained in:
1 parent
c3cb8995bf
commit
85529b2232
2 files changed
+27
-2
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@@ -18,6 +18,8 @@ using mbts.spark;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using Spark.Core.Protobuf;
|
||||
using mbts.ui;
|
||||
using bts.config.toggles;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
// using mbts.bb;
|
||||
|
||||
namespace mbts.spark
|
||||
@@ -141,6 +143,10 @@ namespace mbts.spark
|
||||
Log.Ui.info($"VolSurfaceUsageList vs_usage acount: {vs_usage.Items.Count}");
|
||||
foreach (var u in vs_usage.Items)
|
||||
{
|
||||
if (!validate_vs_usage_unit(u, out var error)) {
|
||||
Log.Gen.error($"Invalid VolSurfaceUsageUnit config. error: {error}; value: {u}");
|
||||
continue;
|
||||
}
|
||||
string option_name = u.OptionName;
|
||||
string vs_name = u.VsName;
|
||||
int vs_key;
|
||||
@@ -149,10 +155,11 @@ namespace mbts.spark
|
||||
ulist.UsageList.Add(new VolSurfaceUsageEntry()
|
||||
{
|
||||
VsId = vs_key,
|
||||
SymbolName = option_name,
|
||||
SecTup = new bts.api.SecurityTuple
|
||||
{
|
||||
Type = SecurityType.Option,
|
||||
Venue = Venue.Deribit,
|
||||
Venue = u.OptionVenue,
|
||||
Symbol = option_name
|
||||
}
|
||||
});
|
||||
@@ -181,6 +188,23 @@ namespace mbts.spark
|
||||
}
|
||||
);
|
||||
_disps.Add(theo_sub);
|
||||
|
||||
static bool validate_vs_usage_unit(VolSurfaceUsageUnit vs_usage_unit, [NotNullWhen(false)]out string error) {
|
||||
if (vs_usage_unit.OptionVenue == Venue.Unset) {
|
||||
error = "OptionVenue is unspecified";
|
||||
return false;
|
||||
}
|
||||
if (string.IsNullOrEmpty(vs_usage_unit.OptionName)) {
|
||||
error = "OptionName is null/empty";
|
||||
return false;
|
||||
}
|
||||
if (string.IsNullOrEmpty(vs_usage_unit.VsName)) {
|
||||
error = "VsName is null/empty";
|
||||
return false;
|
||||
}
|
||||
error = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static IReadOnlyDictionary<uint, VolSurfaceTheoPoint> _assemble_keyed_theos(
|
||||
|
||||
@@ -117,6 +117,7 @@ message ExchangeSubAccounts{
|
||||
message VolSurfaceUsageUnit{
|
||||
// This is a temporary config
|
||||
string option_name = 1;
|
||||
bts.api.Venue option_venue = 3;
|
||||
string vs_name = 2;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user