public IndexSecurityMarketDataStorage(IndexSecurity security, object arg, Func <T, Security> getSecurity, Func <Security, IMarketDataDrive, IMarketDataStorage <T> > getStorage, IMarketDataStorageDrive drive) { if (security == null) { throw new ArgumentNullException(nameof(security)); } if (security.InnerSecurities.IsEmpty()) { throw new ArgumentOutOfRangeException(nameof(security)); } if (getSecurity == null) { throw new ArgumentNullException(nameof(getSecurity)); } if (getStorage == null) { throw new ArgumentNullException(nameof(getStorage)); } if (drive == null) { throw new ArgumentNullException(nameof(drive)); } _security = security; _arg = arg; _getSecurity = getSecurity; _getStorage = getStorage; Drive = drive; }
//private readonly Func<Security, IMarketDataDrive, IMarketDataStorage<T>> _getStorage; //private readonly Func<T, Security> _getSecurity; /// <summary> /// Initializes a new instance of the <see cref="IndexSecurityMarketDataStorage{T}"/>. /// </summary> /// <param name="security">The index, built of instruments. For example, to specify spread at arbitrage or pair trading.</param> /// <param name="arg">The additional argument, associated with data. For example, <see cref="CandleMessage.Arg"/>.</param> public IndexSecurityMarketDataStorage(IndexSecurity security, object arg) { if (security == null) { throw new ArgumentNullException(nameof(security)); } if (security.InnerSecurities.IsEmpty()) { throw new ArgumentOutOfRangeException(nameof(security)); } //if (getSecurity == null) // throw new ArgumentNullException(nameof(getSecurity)); //if (getStorage == null) // throw new ArgumentNullException(nameof(getStorage)); //if (drive == null) // throw new ArgumentNullException(nameof(drive)); Security = security; Arg = arg; //_getSecurity = getSecurity; //_getStorage = getStorage; //Drive = drive; }
private void CreateSourceElements(IndexSecurity security) { var area = _mainArea; var axisId = 1; foreach (var innerSecurity in security.InnerSecurities) { var axisName = "SA_" + axisId++; var series = new CandleSeries(typeof(TimeFrameCandle), innerSecurity, TimeSpan.FromMinutes(5)); var indicatorElement = new ChartIndicatorElement { Title = innerSecurity.Id, Color = _colors[axisId], YAxisId = axisName, StrokeThickness = 1 }; area.YAxises.Add(new ChartAxis { Id = axisName, AutoRange = true, AxisType = ChartAxisType.Numeric, AxisAlignment = ChartAxisAlignment.Right }); var indicator = new CandlePartIndicator(); //_indicators.Add(indicatorElement, indicator); _sourceElements.Add(innerSecurity, indicatorElement); _bufferedChart.AddElement(area, indicatorElement, series, indicator); } }
public IndexCandleBuilder(IndexSecurity security, Type candleType) { _security = security ?? throw new ArgumentNullException(nameof(security)); _candleType = candleType ?? throw new ArgumentNullException(nameof(candleType)); FillSecurityIndecies(_security); _bufferSize = _securityIndecies.Values.Distinct().Count(); }
/// <summary> /// Initializes a new instance of the <see cref="IndexSecurityMarketDataStorage{T}"/>. /// </summary> /// <param name="security">The index, built of instruments. For example, to specify spread at arbitrage or pair trading.</param> /// <param name="arg">The additional argument, associated with data. For example, <see cref="CandleMessage.Arg"/>.</param> public IndexSecurityMarketDataStorage(IndexSecurity security, object arg) { if (security == null) { throw new ArgumentNullException(nameof(security)); } if (security.InnerSecurityIds.IsEmpty()) { throw new ArgumentOutOfRangeException(nameof(security)); } if (typeof(T) == typeof(ExecutionMessage)) { _builder = new TradeIndexBuilder(security).To <IndexBuilder <T> >(); _messageType = MessageTypes.Execution; } else if (typeof(T) == typeof(CandleMessage)) { _builder = new TimeFrameCandleIndexBuilder(security).To <IndexBuilder <T> >(); _messageType = MessageTypes.CandleTimeFrame; } else if (typeof(T) == typeof(QuoteChangeMessage)) { _builder = new QuoteChangeIndexBuilder(security).To <IndexBuilder <T> >(); _messageType = MessageTypes.QuoteChange; } else { throw new InvalidOperationException(LocalizedStrings.Str2142Params.Put(typeof(T))); } Security = security; Arg = arg; }
public IndexCandleBuilder(IndexSecurity security) { if (security == null) { throw new ArgumentNullException(nameof(security)); } _security = security; FillSecurityIndecies(_security); _bufferSize = _securityIndecies.Values.Distinct().Count(); }
protected IndexBuilder(IndexSecurity security) { if (security == null) { throw new ArgumentNullException(nameof(security)); } Security = security; SecurityId = security.ToSecurityId(); FillSecurityIndecies(Security); _bufferSize = _securityIndecies.Values.Distinct().Count(); }
protected IndexBuilder(IndexSecurity security) { Security = security ?? throw new ArgumentNullException(nameof(security)); SecurityId = security.ToSecurityId(); SecurityId.EnsureHashCode(); var index = 0; foreach (var innerSec in security.InnerSecurityIds) { _securityIndecies[innerSec] = index; index++; } _bufferSize = index; }
protected IndexBuilder(IndexSecurity security) { if (security == null) { throw new ArgumentNullException(nameof(security)); } Security = security; SecurityId = security.ToSecurityId(); var index = 0; foreach (var innerSec in security.InnerSecurityIds) { _securityIndecies[innerSec] = index; index++; } _bufferSize = index; }
public QuoteChangeIndexBuilder(IndexSecurity security) : base(security) { }
public TimeFrameCandleIndexBuilder(IndexSecurity security) : base(security) { }
public TradeIndexBuilder(IndexSecurity security) : base(security) { }
public TimeFrameCandleIndexBuilder(IndexSecurity security, bool ignoreErrors) : base(security, ignoreErrors) { }
public IndexCandleBuilder(IndexSecurity security) { if (security == null) throw new ArgumentNullException(nameof(security)); _security = security; FillSecurityIndecies(_security); _bufferSize = _securityIndecies.Values.Distinct().Count(); }
public QuoteChangeIndexBuilder(IndexSecurity security, bool ignoreErrors) : base(security, ignoreErrors) { }
public IndexSeriesInfo(ICandleManager candleManager, Type candleType, IEnumerable <CandleSeries> innerSeries, DateTimeOffset?from, DateTimeOffset?to, IndexSecurity security, Action <Candle> processing, Action stopped) { if (innerSeries == null) { throw new ArgumentNullException(nameof(innerSeries)); } if (security == null) { throw new ArgumentNullException(nameof(security)); } _candleManager = candleManager ?? throw new ArgumentNullException(nameof(candleManager)); _innerSeries = innerSeries.ToHashSet(); _from = from; _to = to; _processing = processing ?? throw new ArgumentNullException(nameof(processing)); _stopped = stopped ?? throw new ArgumentNullException(nameof(stopped)); candleManager.Processing += OnInnerSourceProcessCandle; candleManager.Stopped += OnInnerSourceStopped; _builder = new IndexCandleBuilder(security, candleType, security.IgnoreErrors); //_innerSeries.ForEach(s => //{ // s.ProcessCandle += OnInnerSourceProcessCandle; // s.Stopped += OnInnerSourceStopped; // _startedSeriesCount++; //}); }
public IndexSeriesInfo(ICandleManager candleManager, IEnumerable <CandleSeries> innerSeries, DateTimeOffset from, DateTimeOffset to, IndexSecurity security, Action <Candle> processing, Action stopped) { if (candleManager == null) { throw new ArgumentNullException("candleManager"); } if (innerSeries == null) { throw new ArgumentNullException("innerSeries"); } if (security == null) { throw new ArgumentNullException("security"); } if (processing == null) { throw new ArgumentNullException("processing"); } if (stopped == null) { throw new ArgumentNullException("stopped"); } _candleManager = candleManager; _innerSeries = innerSeries; _from = from; _to = to; _processing = processing; _stopped = stopped; _builder = new IndexCandleBuilder(security); _innerSeries.ForEach(s => { s.ProcessCandle += OnInnerSourceProcessCandle; s.Stopped += OnInnerSourceStopped; _startedSeriesCount++; }); }
public TradeIndexBuilder(IndexSecurity security, bool ignoreErrors) : base(security, ignoreErrors) { }