17 using System.Collections.Generic;
29 private readonly Dictionary<Universe, List<Security>> _pendingRemovals;
35 public IReadOnlyDictionary<Universe, List<Security>>
PendingRemovals => _pendingRemovals;
43 _orderProvider = orderProvider;
44 _pendingRemovals =
new Dictionary<Universe, List<Security>>();
58 pair.Key.Underlying == member.
Symbol && !IsSafeToRemove(pair.Value.Security, universe)))
67 if (unsettledCash !=
default && unsettledCash.Amount > 0)
87 if (IsSafeToRemove(member, universe))
89 return new List<RemovedMember> {
new RemovedMember(universe, member)};
92 if (_pendingRemovals.ContainsKey(universe))
94 if (!_pendingRemovals[universe].Contains(member))
96 _pendingRemovals[universe].Add(member);
101 _pendingRemovals.Add(universe,
new List<Security> { member });
114 HashSet<Symbol> selectedSymbols,
117 var result =
new List<RemovedMember>();
119 foreach (var kvp
in _pendingRemovals.ToList())
121 var universeRemoving = kvp.Key;
122 foreach (var security
in kvp.Value.ToList())
124 var isSafeToRemove = IsSafeToRemove(security, universeRemoving);
129 universeRemoving == currentUniverse
130 && selectedSymbols.Contains(security.Symbol))
137 _pendingRemovals[universeRemoving].Remove(security);
140 if (!_pendingRemovals[universeRemoving].Any())
142 _pendingRemovals.Remove(universeRemoving);