17 using System.Collections.Generic;
27 private readonly Func<Symbol, decimal> _marketPriceProvider;
35 _marketPriceProvider = marketPriceProvider;
49 var marketPrice = _marketPriceProvider(positions.
Underlying);
51 var longPositions =
new List<OptionPosition>();
52 var shortPuts =
new SortedDictionary<decimal, OptionPosition>();
53 var shortCalls =
new SortedDictionary<decimal, OptionPosition>();
54 foreach (var position
in positions)
56 if (!position.Symbol.HasUnderlying)
58 yield
return position;
61 if (position.Quantity > 0)
63 longPositions.Add(position);
67 switch (position.Right)
70 shortPuts.Add(position.Strike, position);
74 shortCalls.Add(position.Strike, position);
78 throw new ApplicationException(
79 "The skies are falling, the oceans rising - you're having a bad time"
85 throw new NotImplementedException(
"This implementation needs to be completed.");