Exemplo n.º 1
0
        /// <summary>
        /// removes the level from the specified side's excess level
        /// </summary>
        /// <returns></returns>
        private bool RemoveLevelFromExcess(DepthLevelMap depthLevelMap, DepthLevel[] sideLevels)
        {
            if (depthLevelMap.Any())
            {
                sideLevels.Last().UpdatePrice(depthLevelMap.First().Value.Price);
                sideLevels.Last().UpdateVolume(depthLevelMap.First().Value.AggregatedVolume);
                sideLevels.Last().UpdateOrderCount(depthLevelMap.First().Value.OrderCount);
                sideLevels.Last().ChangeExcessStatus(false);

                depthLevelMap.RemoveLevel(depthLevelMap.First().Value.Price);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public Depth(string currencyPair, int size)
        {
            _currencyPair = currencyPair;
            _size         = size;

            _bidLevels = new DepthLevel[size];
            _askLevels = new DepthLevel[size];

            for (int i = 0; i < _bidLevels.Length; i++)
            {
                _bidLevels[i] = new DepthLevel(null);
                _askLevels[i] = new DepthLevel(null);
            }

            _bestBid = _bidLevels[0];
            _bestAsk = _askLevels[0];
            _lastBid = _bidLevels.Last();
            _lastAsk = _askLevels.Last();

            _bidExcessLevels = new DepthLevelMap(currencyPair, OrderSide.Buy);
            _askExcessLevels = new DepthLevelMap(currencyPair, OrderSide.Sell);
        }