Archived vols now contains the SecTups that are part of the vols

This commit is contained in:
Taha Afzal committed 2022-03-03 16:25:05 -05:00
1 parent 838546b497
commit 272fd35699
4 files changed
+33 -1

No files matched your search

@@ -130,6 +130,8 @@ namespace mbts.spark {
SystemContractData sc_data = _bb.read_state(SparkTags.SystemContractsTag);
var rv = SingleVolSurfaceTheoSource.convert_to_id_map(cand_theos, sc_data);
rv.SaveTime = VolSurfaceUtilityFunctions.get_unix_epoch_msecs();
var sec_tups = SingleVolSurfaceTheoSource.get_vs_sectups(_volsurface_id, _bb);
rv.SecTups.AddRange(sec_tups);
// TODO, figure out from vs usage which sec_tups to populate
return rv;
}
@@ -158,6 +158,13 @@ namespace mbts.spark {
return new Dictionary<VolSurfaceExpiration, IEnumerable<Theos>>();
}
public static IEnumerable<bts.api.SecurityTuple> get_vs_sectups(
int vs_id, ThreadedBlackboard bb) {
VolSurfaceUsageListImmutable vs_usage_list = bb.read_state(SparkTags.VolSurfaceUsageTag);
return vs_usage_list.get_sectups(vs_id);
}
// old -> new transformation, this is slow ! transforms data from one
// form to another
public static ArchivedTheoList
@@ -27,6 +27,21 @@
public static bool symbol_driven_by_vs(this VolSurfaceUsageListImmutable list, string option_name, int vs_id) =>
list.UsageList.Any(u => u.SymbolName == option_name && u.VsId == vs_id);
public static IEnumerable<bts.api.SecurityTuple> get_sectups(
this VolSurfaceUsageListImmutable list, int vs_id) {
List<bts.api.SecurityTuple> rv = new List<SecurityTuple>();
if (list.UsageList != null)
foreach (var u in list.UsageList) {
if (u.VsId == vs_id) {
bts.api.SecurityTuple st = new SecurityTuple();
st.Type = SecurityType.Option;
st.Venue = u.SymbolVenue;
st.Symbol = u.SymbolName;
}
}
return rv;
}
public static HashSet<string> hidden_cols(this VolSurfaceMacroGridSettings gs) =>
new(gs.column_settings.Where(cc => !cc.is_visible).Select(cc => cc.id));
@@ -1,4 +1,6 @@
using System;
using bts.api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,4 +10,10 @@ namespace mbts.analytics {
public static class VolSurfaceConstants {
public static int vol_time_sample_mins = 1;
}
// TODO: remove this
public static class VolSurfaceTemp {
public static Venue get_default_venue(SecurityType sec_type, string symbol_name) {
return Venue.Sim;
}
}
}