diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs index beebc0d94..cd7c9f538 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs @@ -97,6 +97,9 @@ namespace mbts.spark { Log.Gen.info(String.Format( "SingleVolSurfaceGateway._on_bb_data Time to commit volsurface {0} {1} msecs", _volsurface_id, _timer.lastIntervalTime)); + var archived_theos = _get_theos(); + if (archived_theos != null) + _analytics_service.archive_theos(archived_theos); } catch (Exception ex) { Log.Gen.warn(ex.ToString()); _bb.post(SparkTags.MessageDisplayTag, @@ -122,6 +125,27 @@ namespace mbts.spark { vssr.connected_symbols = distinct_syms; } + private bts.api.analytics.ArchivedTheoList _get_theos() { + ArchivedTheoList rv = new ArchivedTheoList(); + IReadOnlyDictionary theo_map = _bb.read_state(SparkTags.Greeks); + SystemContractData sc_data = _bb.read_state(SparkTags.SystemContractsTag); + if (theo_map == null || sc_data == null) + return null; + foreach (var kv in theo_map) { + var sec = sc_data.get_sec_md(kv.Key); + GreeksTuple gtup = kv.Value; + if (sec != null) { + var asec_theo = new ArchivedSecurityTheo(); + asec_theo.Driver = gtup.driver; + asec_theo.Theo = gtup.theo; + asec_theo.Vol = gtup.vol; + asec_theo.Delta = gtup.delta; + rv.SecTheo.Add(asec_theo); + } + } + return rv; + } + #region Disposable public void Dispose() { _bb.data_callback -= _on_bb_data; diff --git a/src/client/spark/AW2/LiveTheoPublisher.cs b/src/client/spark/AW2/LiveTheoPublisher.cs index d4d7c10f1..9b0678e1c 100644 --- a/src/client/spark/AW2/LiveTheoPublisher.cs +++ b/src/client/spark/AW2/LiveTheoPublisher.cs @@ -5,6 +5,7 @@ using bts.api; using mbts.ui; namespace mbts.spark { + // Publishes theos for all options (on the side, also publishes the theos for TC2) public class LiveTheoPublisher : IDisposable { private ThreadedBlackboard _bb; private readonly ITag>