fix: Add a couple null checks

This commit is contained in:
John Colvin committed 2022-12-12 11:01:01 -05:00
1 parent 937173dd2f
commit a50e0cfc26
2 files changed
+15 -12

No files matched your search

+13 -11
View File
@@ -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<UInt32, DriverMD> normalize_drivers(
OptionDriverPriceMap driver_map, SystemContractData sc_data) {
if (driver_map is null) {
return new Dictionary<uint, DriverMD>(0);
}
Dictionary<UInt32, DriverMD> rv = new Dictionary<uint, DriverMD>();
foreach (var kv in driver_map.get_price_map()) {
var exp = kv.Key;
@@ -40,6 +39,9 @@ namespace mbts.spark {
}
public static IEnumerable<Tuple<SecurityImmutable, TheoPoint>> normalize_interp_theos(
OptionTheoInterpolationData symbol_theos, SystemContractData sc_data) {
if (symbol_theos is null) {
return Enumerable.Empty<Tuple<SecurityImmutable, TheoPoint>>();
}
var rv = new List<Tuple<SecurityImmutable, TheoPoint>>();
foreach (DateTime exp in symbol_theos.get_expirations()) {
Dictionary<double, Dictionary<double, TheoPoint>> exp_data =
@@ -65,4 +67,4 @@ namespace mbts.spark {
return rv;
}
}
}
}
@@ -44,10 +44,11 @@
<Setter Property="Margin" Value="{StaticResource PanelItem.MarginT}" />
</Style>
<Style x:Key="PanelItem.TickUpDown.Parameterless" TargetType="c:TickUpDown">
<Style x:Key="PanelItem.TickUpDown.Parameterless" TargetType="c:TickUpDown" BasedOn="{StaticResource {x:Type c:TickUpDown}}">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Margin" Value="{StaticResource PanelItem.MarginT}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{u:BTSBrush UI.default_text}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="TickUpCommandParameter" Value="{u:True}" />
<Setter Property="TickDownCommandParameter" Value="{u:False}" />