Merged in SPARK-2476-OB-KeyNotFoundException (pull request #248)

RTM: SPARK-2476 OB _get_legs KeyNotFoundException

Approved-by: Jake Norbut <jake.norbut@bluetradesys.com>
This commit is contained in:
John Colvin authored and Pedro Pinto committed 2019-06-07 21:14:14 +00:00
commit 84d666c29c
1 file changed
+3 -6
@@ -322,12 +322,9 @@ namespace mbts.spark {
}
static IEnumerable<LegSpreaderParamsTuple> _get_legs(Security synthetic, ExecutionStrategyImmutable strategy) {
try {
var results = synthetic.Synthetic.Legs
.Select(l => new LegSpreaderParamsTuple(l, strategy.LegParamsMap[l.Security.Id].Clone())).ToList();
return results;
} catch (KeyNotFoundException) {
return Enumerable.Empty<LegSpreaderParamsTuple>();
foreach (var l in synthetic.Synthetic.Legs) {
if (strategy.LegParamsMap.TryGetValue(l.Security.Id, out var p))
yield return new LegSpreaderParamsTuple(l, p);
}
}