public AnalyticsManager(IAnalyticsStorage analyticsStorage, List <double> precisions, List <int> markets, List <OrderInfo> orders, int tradesHistorySize = 100)
 {
     this.analyticsStorage = analyticsStorage ?? throw new ArgumentNullException(nameof(analyticsStorage));
     AnalyticsExchange     = AnalyticsExchange.RestoreExchange(markets, orders);
     PriceHistoryManager   = new PriceHistoryManager(analyticsStorage, markets ?? throw new ArgumentNullException(nameof(markets)));
     TradesHistoryManager  = new TradesHistoryManager(markets, tradesHistorySize);
     MarketDepthsManager   = new MarketDepthsManager(markets, precisions, AnalyticsExchange.OrderMap);
     MarketTickersManager  = new MarketTickersManager(markets, PriceHistoryManager);
 }
        public async Task OnUpdates(ExchangeUpdate updates)
        {
            await syncRoot.WaitAsync();

            try
            {
                AnalyticsExchange.OnUpdates(updates);
                await PriceHistoryManager.OnTrade(updates);

                TradesHistoryManager.OnTrade(updates);
                MarketDepthsManager.OnOrderUpdates(updates);
            }
            catch (Exception exc)
            {
                //TODO: add support for delayed trades, now it failes during rising
                OnError?.Invoke(exc);
                logger.Error(exc);
            }
            finally
            {
                syncRoot.Release();
            }
        }