From a50e0cfc26fca4ccea3cbfc60356b4b1834783a5 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 12 Dec 2022 10:56:10 -0500 Subject: [PATCH] fix: Add a couple null checks --- .../spark/AW2/Misc/SecurityNormalizer.cs | 24 ++++++++++--------- .../View/VolSurfaceMacroControlView.xaml | 3 ++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/client/spark/AW2/Misc/SecurityNormalizer.cs b/src/client/spark/AW2/Misc/SecurityNormalizer.cs index d76034493..9228bd5c0 100644 --- a/src/client/spark/AW2/Misc/SecurityNormalizer.cs +++ b/src/client/spark/AW2/Misc/SecurityNormalizer.cs @@ -1,14 +1,10 @@ -using System; -using System.Collections.Generic; -using mbts.analytics; -using bts.api; -using mbts.ui; -using MathNet.Numerics.Providers.FourierTransform; -using BCG; -using System.Windows.Automation; -using bts.collections; - namespace mbts.spark { + using bts.api; + + using System; + using System.Collections.Generic; + using System.Linq; + // A lot of options data (migrated from edge) is not normalized // on the sec_id, but rather on a combination of symbol, exp, strike. @@ -20,6 +16,9 @@ namespace mbts.spark { public static IDictionary normalize_drivers( OptionDriverPriceMap driver_map, SystemContractData sc_data) { + if (driver_map is null) { + return new Dictionary(0); + } Dictionary rv = new Dictionary(); foreach (var kv in driver_map.get_price_map()) { var exp = kv.Key; @@ -40,6 +39,9 @@ namespace mbts.spark { } public static IEnumerable> normalize_interp_theos( OptionTheoInterpolationData symbol_theos, SystemContractData sc_data) { + if (symbol_theos is null) { + return Enumerable.Empty>(); + } var rv = new List>(); foreach (DateTime exp in symbol_theos.get_expirations()) { Dictionary> exp_data = @@ -65,4 +67,4 @@ namespace mbts.spark { return rv; } } -} \ No newline at end of file +} diff --git a/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml b/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml index c621ec24b..d975d53fc 100644 --- a/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml +++ b/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml @@ -44,10 +44,11 @@ -