void ICandleSource <Candle> .Start(CandleSeries series, DateTimeOffset from, DateTimeOffset to)
        {
            if (series == null)
            {
                throw new ArgumentNullException("series");
            }

            var indexSecurity = (IndexSecurity)series.Security;

            var basketInfo = new IndexSeriesInfo(CandleManager,
                                                 indexSecurity
                                                 .InnerSecurities
                                                 .Select(sec => new CandleSeries(series.CandleType, sec, CloneArg(series.Arg, sec))
            {
                WorkingTime = series.WorkingTime.Clone(),
            }).ToArray(),
                                                 from, to, indexSecurity,
                                                 c =>
            {
                if (c.Series == null)
                {
                    c.Series = series;
                    c.Source = this;
                }

                CandleManager.Container.AddCandle(series, c);
                Processing.SafeInvoke(series, c);
            },
                                                 () =>
                                                 Stopped.SafeInvoke(series));

            _info.Add(series, basketInfo);

            basketInfo.Start();
        }
Exemplo n.º 2
0
        void ICandleSource <Candle> .Start(CandleSeries series, DateTimeOffset?from, DateTimeOffset?to)
        {
            if (series == null)
            {
                throw new ArgumentNullException(nameof(series));
            }

            var indexSecurity = (IndexSecurity)series.Security;

            var basketInfo = new IndexSeriesInfo(_candleManager,
                                                 series.CandleType,
                                                 indexSecurity
                                                 .GetInnerSecurities(_securityProvider)
                                                 .Select(sec => new CandleSeries(series.CandleType, sec, IndexCandleBuilder.CloneArg(series.Arg, sec))
            {
                WorkingTime = series.WorkingTime.Clone(),
            })
                                                 .ToArray(),
                                                 from, to, indexSecurity,
                                                 c =>
            {
                //if (c.Series == null)
                //{
                //	c.Series = series;
                //	c.Source = this;
                //}

                _candleManager.Container.AddCandle(series, c);
                Processing?.Invoke(series, c);
            },
                                                 () => Stopped?.Invoke(series));

            _info.Add(series, basketInfo);

            basketInfo.Start();
        }