/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(SubscriptionDataConfig other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(_sid.Equals(other._sid) && Type == other.Type && TickType == other.TickType && Resolution == other.Resolution && FillDataForward == other.FillDataForward && ExtendedMarketHours == other.ExtendedMarketHours && IsInternalFeed == other.IsInternalFeed && IsCustomData == other.IsCustomData && DataTimeZone.Equals(other.DataTimeZone) && DataMappingMode == other.DataMappingMode && ExchangeTimeZone.Equals(other.ExchangeTimeZone) && ContractDepthOffset == other.ContractDepthOffset && IsFilteredSubscription == other.IsFilteredSubscription); }
/// <summary> /// Aggregates the new 'data' into the 'workingBar'. The 'workingBar' will be /// null following the event firing. /// </summary> /// <param name="workingBar">The bar we're building, null if the event was just fired and we're starting a new consolidated bar.</param> /// <param name="data">The new data.</param> protected override void AggregateBar(ref QuoteBar workingBar, QuoteBar data) { var bid = data.Bid; var ask = data.Ask; if (workingBar == null) { // Data is in exchange TZ, let's zone it var zonedDataTimeDT = ExchangeTimeZone.AtLeniently(CreateLocalDateTime(data.Time)); workingBar = new QuoteBar { Symbol = data.Symbol, Time = RoundDownToLastEmitTime(zonedDataTimeDT).WithZone(ExchangeTimeZone).ToDateTimeUnspecified(), Bid = bid == null ? null : bid.Clone(), Ask = ask == null ? null : ask.Clone(), Period = TimeSpan.FromDays(1) }; } // Update the bid and ask if (bid != null) { workingBar.LastBidSize = data.LastBidSize; if (workingBar.Bid == null) { workingBar.Bid = new Bar(bid.Open, bid.High, bid.Low, bid.Close); } else { workingBar.Bid.Close = bid.Close; if (workingBar.Bid.High < bid.High) { workingBar.Bid.High = bid.High; } if (workingBar.Bid.Low > bid.Low) { workingBar.Bid.Low = bid.Low; } } } if (ask != null) { workingBar.LastAskSize = data.LastAskSize; if (workingBar.Ask == null) { workingBar.Ask = new Bar(ask.Open, ask.High, ask.Low, ask.Close); } else { workingBar.Ask.Close = ask.Close; if (workingBar.Ask.High < ask.High) { workingBar.Ask.High = ask.High; } if (workingBar.Ask.Low > ask.Low) { workingBar.Ask.Low = ask.Low; } } } workingBar.Value = data.Value; workingBar.Period += data.Period; }