private void ClearOrderBooks(List <int> pertinentContracts) { OrderBooks.Clear(); ImpliedOrderBooks.Clear(); ConsolidatedOrderBooks.Clear(); int contractCount = pertinentContracts.Count; for (int i = 0; i < contractCount; i++) { int instrument = pertinentContracts[i]; AddNewOrderBooksFor(instrument); } }
private void ReconcileExpiredContracts() { for (int i = 0; i < ConsolidatedOrderBooks.Count; i++) { bool matchFound = false; foreach (int pertinentContract in pertinentContracts) { if (ConsolidatedOrderBooks[i].InstrumentId == pertinentContract) { matchFound = true; break; } } if (!matchFound) { OrderBooks.RemoveAt(i); ImpliedOrderBooks.RemoveAt(i); ConsolidatedOrderBooks.RemoveAt(i); } } }
private void AddNewOrderBooksFor(int instrumentId) { OrderBooks.Add(new OrderBook(OUTRIGHT_DEPTH, instrumentId)); ImpliedOrderBooks.Add(new OrderBook(IMPLIED_DEPTH, instrumentId)); ConsolidatedOrderBooks.Add(new OrderBook(OUTRIGHT_DEPTH, instrumentId)); }