public void ResetMarke(decimal initPrice, decimal levelSize, decimal delta, int countLevelsPerSide)
        {
            _levels.Clear();
            _levelsByOrder.Clear();

            _trader.CancelAllOrders(_symbol);

            var price = initPrice;

            for (int i = 0; i < countLevelsPerSide; i++)
            {
                price += delta;

                var level = new MarketLevel()
                {
                    OriginalSize    = levelSize,
                    Price           = price,
                    PriceCompensate = price - delta,
                    Side            = MarketSide.Short,
                    Status          = MarketLevelStatus.Empty,
                    CurrentOrderId  = string.Empty,
                    Delta           = delta,
                    Type            = MarketLevelType.Direct
                };

                _levels.Add(level);
            }

            price = initPrice;
            for (int i = 0; i < countLevelsPerSide; i++)
            {
                price -= delta;

                var level = new MarketLevel()
                {
                    OriginalSize    = levelSize,
                    Price           = price,
                    PriceCompensate = price + delta,
                    Side            = MarketSide.Long,
                    Status          = MarketLevelStatus.Empty,
                    CurrentOrderId  = string.Empty,
                    Delta           = delta,
                    Type            = MarketLevelType.Direct
                };

                _levels.Add(level);
            }
        }
        public async Task ResetMarke(decimal initPrice, decimal levelMinSize, decimal delta, int countLevelsPerSide,
                                     decimal pricePulseTick, int pricePulseMaxTicks,
                                     decimal sizePulseTick, int sizePulseMaxTick)
        {
            await _semaphoreSlim.WaitAsync();

            try
            {
                _levels.Clear();
                _levelsByOrder.Clear();

                await _trader.CancelAllOrders(_symbol);

                var price = initPrice;
                for (int i = 0; i < countLevelsPerSide; i++)
                {
                    var level = new MarketLevel()
                    {
                        MinSize            = levelMinSize,
                        ActualOrderSize    = levelMinSize,
                        PriceBuy           = price,
                        PriceSell          = price + delta,
                        Side               = MarketSide.Short,
                        Status             = MarketLevelStatus.Empty,
                        CurrentOrderId     = string.Empty,
                        Delta              = delta,
                        PricePulseTick     = pricePulseTick,
                        PricePulseMaxTicks = pricePulseMaxTicks,
                        SizePulseTick      = sizePulseTick,
                        SizePulseMaxTick   = sizePulseMaxTick,
                        CompensateSize     = 0
                    };

                    level.ApplySizePulse();

                    _levels.Add(level);

                    price += delta;
                }

                price = initPrice - delta;
                for (int i = 0; i < countLevelsPerSide; i++)
                {
                    var level = new MarketLevel()
                    {
                        MinSize            = levelMinSize,
                        ActualOrderSize    = levelMinSize,
                        PriceBuy           = price,
                        PriceSell          = price + delta,
                        Side               = MarketSide.Long,
                        Status             = MarketLevelStatus.Empty,
                        CurrentOrderId     = string.Empty,
                        Delta              = delta,
                        PricePulseTick     = pricePulseTick,
                        PricePulseMaxTicks = pricePulseMaxTicks,
                        SizePulseTick      = sizePulseTick,
                        SizePulseMaxTick   = sizePulseMaxTick,
                        CompensateSize     = 0
                    };

                    level.ApplySizePulse();

                    _levels.Add(level);

                    price -= delta;
                }
            }
            finally
            {
                _semaphoreSlim.Release();
            }
        }