fix: Include venue w/ symbol when publishing interp greeks

This commit is contained in:
John Colvin authored and Adeel Khan committed 2024-10-03 17:46:51 +05:00
1 parent 2511b0d966
commit 0268bd476f
3 files changed
+12 -9

No files matched your search

@@ -1,4 +1,6 @@
using System;
using bts.api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,11 +12,15 @@ namespace mbts.spark {
// indexed by option_expiration->driver_price->option_strike->TheoPoint
public class OptionTheoInterpolationData {
public readonly string symbol;
public readonly Venue venue;
private IDictionary<DateTime, Dictionary<double, Dictionary<double, TheoPoint>>> _map =
new Dictionary<DateTime, Dictionary<double, Dictionary<double, TheoPoint>>>();
private IDictionary<DateTime, double> _zero_move_driver_map = new Dictionary<DateTime, double>();
public OptionTheoInterpolationData(string symbol) { this.symbol = symbol; }
public OptionTheoInterpolationData(string symbol, Venue venue) {
this.symbol = symbol;
this.venue = venue;
}
public void set_data(DateTime option_expiration, double driver_price,
double move, double option_strike, TheoPoint theo_point) {
@@ -125,4 +131,4 @@ namespace mbts.spark {
#endregion
}
}
}
@@ -95,7 +95,7 @@ namespace mbts.spark {
foreach (var kv in vs_theos) {
OptionTheoInterpolationData sym_data = null;
if (!rv.TryGetValue((kv.Key.symbol, kv.Key.venue), out sym_data)) {
sym_data = new OptionTheoInterpolationData(kv.Key.symbol);
sym_data = new OptionTheoInterpolationData(kv.Key.symbol, kv.Key.venue);
rv.Add((kv.Key.symbol, kv.Key.venue), sym_data);
}
foreach (var t in kv.Value)
@@ -154,11 +154,8 @@ namespace mbts.analytics {
private IDictionary<SecurityExpiration, AnalyticsExpirationParameters> _sync_exp_params() {
var master_exp_keys =
_exp_strikes_map.Keys.Select(k =>
new SecurityExpiration(Venue.Unset, SecurityType.Option, k.symbol, k.expiration));
// TODO: add exchange to key (so we don't have to 'Crush' the duplicate keys)
var exp_params_no_exch = _exp_params_map.ToDictionaryCrushed(
kv => kv.Key.unset_exchange(), kv => kv.Value);
return exp_params_no_exch.sync(master_exp_keys, true,
new SecurityExpiration(k.venue, SecurityType.Option, k.symbol, k.expiration));
return _exp_params_map.sync(master_exp_keys, true,
exp => AnalyticsExpirationParameters.empty);
}