fix: Provide venue param w/ symbol when computing fut slide

This commit is contained in:
John Colvin authored and Adeel Khan committed 2024-10-03 17:46:50 +05:00
1 parent def021612c
commit 5137785f7f
1 file changed
+6 -5
@@ -313,10 +313,10 @@ namespace mbts.analytics {
IDictionary<VolSurfaceExpiration, VolSurfaceDriverTheo> fut_theo_map,
IDictionary<mbts.SecurityTuple, double> cpp_map) {
IDictionary<VolSurfaceExpiration, IEnumerable<SlideGreekUnit>> rv = new Dictionary<VolSurfaceExpiration, IEnumerable<SlideGreekUnit>>();
foreach (string future_symbol in new HashSet<string>(fut_pos_map.Keys.Select(e => e.symbol))) {
double cpp = cpp_map.TryGetValue(new mbts.SecurityTuple(SecurityType.Future, future_symbol, Venue.Unset), out cpp) ? cpp : Double.NaN,
delta_terms_symbol_cpp = cpp_map.TryGetValue(delta_terms_symbol, out delta_terms_symbol_cpp) ? delta_terms_symbol_cpp : Double.NaN;
IDictionary<VolSurfaceExpiration, IEnumerable<SlideGreekUnit>> sym_rv = _compute_single_symbol_future_slide(ordered_greeks, handles, future_symbol, fut_theo_map, fut_pos_map, cpp, delta_terms_symbol_cpp);
foreach (var (fut_symbol, fut_venue) in fut_pos_map.Keys.Select(e => (e.symbol, e.venue)).Distinct()) {
double cpp = cpp_map.GetValueOrDefault(new(SecurityType.Future, fut_symbol, fut_venue), double.NaN);
double delta_terms_symbol_cpp = cpp_map.GetValueOrDefault(delta_terms_symbol, double.NaN);
var sym_rv = _compute_single_symbol_future_slide(ordered_greeks, handles, fut_symbol, fut_venue, fut_theo_map, fut_pos_map, cpp, delta_terms_symbol_cpp);
sym_rv.ToList().ForEach(kv => rv.Add(kv));
}
return rv;
@@ -326,11 +326,12 @@ namespace mbts.analytics {
private static IDictionary<VolSurfaceExpiration, IEnumerable<SlideGreekUnit>> _compute_single_symbol_future_slide(IEnumerable<VolSurfaceGreeks> ordered_greeks,
IEnumerable<double> handles,
string fut_sym,
Venue fut_venue,
IDictionary<VolSurfaceExpiration, VolSurfaceDriverTheo> fut_theo_map,
IDictionary<VolSurfaceExpiration, double> future_pos_map,
double sym_cpp, double interms_sym_cpp) {
IDictionary<VolSurfaceExpiration, IEnumerable<SlideGreekUnit>> rv = new Dictionary<VolSurfaceExpiration, IEnumerable<SlideGreekUnit>>();
foreach (KeyValuePair<VolSurfaceExpiration, double> kv in future_pos_map.Where(kv => kv.Key.symbol == fut_sym)) {
foreach (KeyValuePair<VolSurfaceExpiration, double> kv in future_pos_map.Where(kv => kv.Key.symbol == fut_sym && kv.Key.venue == fut_venue)) {
VolSurfaceDriverTheo theo_tup = fut_theo_map.TryGetValue(kv.Key, out theo_tup) ? theo_tup : null;
IEnumerable<SlideGreekUnit> exp_pos_greeks = _compute_single_exp_future_slide(
kv.Key,