17 using System.Collections.Immutable;
19 using System.Reflection;
31 private static readonly Lazy<ImmutableList<OptionStrategyDefinition>> All
32 =
new Lazy<ImmutableList<OptionStrategyDefinition>>(() =>
34 .GetProperties(BindingFlags.Public | BindingFlags.Static)
43 public static ImmutableList<OptionStrategyDefinition>
AllDefinitions
47 var strategies = All.Value;
50 .SelectMany(optionStrategy => {
55 if (strategies.Any(strategy => strategy.UnderlyingLots == inverted.UnderlyingLots
56 && strategy.Legs.Count == inverted.Legs.Count
57 && strategy.Legs.All(leg => inverted.Legs.
58 Any(invertedLeg => invertedLeg.Right == leg.Right
59 && leg.Quantity == invertedLeg.Quantity
60 && leg.All(predicate => invertedLeg.Any(invertedPredicate => invertedPredicate.ToString() == predicate.ToString()))))))
63 return new[] { optionStrategy };
65 return new[] { optionStrategy, inverted };
116 (legs, p) => p.Expiration == legs[0].Expiration)
128 (legs, p) => p.Expiration == legs[0].Expiration)
140 (legs, p) => p.Expiration == legs[0].Expiration)
167 (legs, p) => p.Expiration == legs[0].Expiration)
178 (legs, p) => p.Expiration == legs[0].Expiration)
189 (legs, p) => p.Expiration == legs[0].Expiration)
201 (legs, p) => p.Expiration == legs[0].Expiration)
212 (legs, p) => p.Expiration == legs[0].Expiration)
224 (legs, p) => p.Expiration == legs[0].Expiration)
235 (legs, p) => p.Expiration == legs[0].Expiration)
247 (legs, p) => p.Expiration == legs[0].Expiration)
258 (legs, p) => p.Expiration == legs[0].Expiration),
260 (legs, p) => p.Expiration == legs[0].Expiration,
261 (legs, p) => p.Strike - legs[1].Strike == legs[1].Strike - legs[0].Strike)
272 (legs, p) => p.Expiration == legs[0].Expiration),
274 (legs, p) => p.Expiration == legs[0].Expiration,
275 (legs, p) => p.Strike - legs[1].Strike == legs[1].Strike - legs[0].Strike)
286 (legs, p) => p.Expiration == legs[0].Expiration),
288 (legs, p) => p.Expiration == legs[0].Expiration,
289 (legs, p) => p.Strike - legs[1].Strike == legs[1].Strike - legs[0].Strike)
301 (legs, p) => p.Expiration == legs[0].Expiration),
303 (legs, p) => p.Expiration == legs[0].Expiration,
304 (legs, p) => p.Strike - legs[1].Strike == legs[1].Strike - legs[0].Strike)
315 (legs, p) => p.Expiration > legs[0].Expiration)
327 (legs, p) => p.Expiration > legs[0].Expiration)
338 (legs, p) => p.Expiration > legs[0].Expiration)
350 (legs, p) => p.Expiration > legs[0].Expiration)
361 (legs, p) => p.Expiration == legs[0].Expiration),
363 (legs, c) => c.Expiration == legs[0].Expiration),
365 (legs, c) => c.Expiration == legs[0].Expiration)
376 (legs, p) => p.Expiration == legs[0].Expiration),
378 (legs, c) => c.Expiration == legs[0].Expiration),
380 (legs, c) => c.Expiration == legs[0].Expiration)
391 (legs, p) => p.Expiration == legs[0].Expiration),
393 (legs, p) => p.Expiration == legs[0].Expiration),
395 (legs, p) => p.Expiration == legs[0].Expiration)
406 (legs, p) => p.Expiration == legs[0].Expiration),
408 (legs, p) => p.Expiration == legs[0].Expiration),
410 (legs, p) => p.Expiration == legs[0].Expiration)
422 (legs, p) => p.Expiration == legs[0].Expiration),
424 (legs, c) => c.Expiration == legs[0].Expiration),
426 (legs, c) => c.Expiration == legs[0].Expiration)
438 (legs, p) => p.Expiration == legs[0].Expiration),
440 (legs, c) => c.Expiration == legs[0].Expiration),
442 (legs, c) => c.Expiration == legs[0].Expiration)
453 (legs, c) => c.Expiration > legs[0].Expiration),
455 (legs, p) => p.Expiration == legs[0].Expiration),
457 (legs, p) => p.Expiration == legs[1].Expiration)
468 (legs, c) => c.Expiration > legs[0].Expiration),
470 (legs, p) => p.Expiration == legs[0].Expiration),
472 (legs, p) => p.Expiration == legs[1].Expiration)
483 (legs, c) => c.Expiration == legs[0].Expiration),
485 (legs, c) => c.Expiration == legs[0].Expiration)
496 (legs, p) => p.Expiration == legs[0].Expiration),
498 (legs, p) => p.Expiration == legs[0].Expiration)
509 (legs, c) => c.Expiration == legs[0].Expiration),
511 (legs, c) => c.Expiration == legs[0].Expiration)
522 (legs, p) => p.Expiration == legs[0].Expiration),
524 (legs, p) => p.Expiration == legs[0].Expiration)