Ejemplo n.º 1
0
            public void AddCandle(int securityIndex, Candle candle)
            {
                if (candle == null)
                {
                    throw new ArgumentNullException("candle");
                }

                if (Candles[securityIndex] != null)
                {
                    if (_isSparseBuffer)
                    {
                        return;
                    }

                    throw new ArgumentException(LocalizedStrings.Str654Params.Put(candle.OpenTime), "candle");
                }

                Candles[securityIndex] = candle;

                _counter--;

                if (_isSparseBuffer)
                {
                    if (candle.OpenTime < OpenTime)
                    {
                        OpenTime = candle.OpenTime;
                        OpenTime = Candles.Where(c => c != null).Min(c => c.OpenTime);
                    }

                    if (candle.CloseTime > CloseTime)
                    {
                        CloseTime = candle.CloseTime;
                        CloseTime = Candles.Where(c => c != null).Max(c => c.CloseTime);
                    }
                }
            }