/// <summary> /// </summary> public TradingOrderService( TradingRepository tradingRepository, EventHistoryService eventHistoryService, ILogger <TradingOrderService> logger) { _eventHistoryService = eventHistoryService; _logger = logger; OrderBook = tradingRepository.OrderBook(); HiddenOrders = tradingRepository.HiddenOrders(); OrderHistory = tradingRepository.OrderHistory(); TransactionHistory = tradingRepository.TransactionHistory(); }
private void LoadDatabaseFromSnapshot() { // I lied, we won't load anything _currentVersion = 0; _tradingRepository.OrderBook().DeleteMany( Builders <OrderBookEntry> .Filter.Where(e => true) ); _tradingRepository.HiddenOrders().DeleteMany( Builders <HiddenOrderEntry> .Filter.Where(e => true) ); _tradingRepository.TransactionHistory().DeleteMany( Builders <TransactionHistoryEntry> .Filter.Where(e => true) ); _tradingRepository.OrderHistory().DeleteMany( Builders <OrderHistoryEntry> .Filter.Where(e => true) ); _accountRepository.Accounts().DeleteMany( new BsonDocumentFilterDefinition <AccountEntry>(new BsonDocument()) ); // This enables the version control semaphore _versionControl.Initialize(_currentVersion); }