private void RaiseMarketDataSubscriptionFinished(SubscriptionFinishedMessage message, Subscription subscription) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (subscription == null) { throw new ArgumentNullException(nameof(subscription)); } var securityId = subscription.SecurityId; this.AddDebugLog(LocalizedStrings.SubscriptionFinished, securityId, message); MarketDataSubscriptionFinished?.Invoke(TryGetSecurity(securityId), message); RaiseSubscriptionStopped(subscription, null); if (subscription.CandleSeries != null) { RaiseCandleSeriesStopped(subscription.CandleSeries); } }
private void RaiseMarketDataUnexpectedCancelled(MarketDataMessage message, Exception error, Subscription subscription) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (error == null) { throw new ArgumentNullException(nameof(error)); } if (subscription == null) { throw new ArgumentNullException(nameof(subscription)); } var securityId = subscription.SecurityId; this.AddErrorLog(LocalizedStrings.SubscriptionUnexpectedCancelled, securityId, message.DataType2, error.Message); MarketDataUnexpectedCancelled?.Invoke(TryGetSecurity(securityId), message, error); RaiseSubscriptionStopped(subscription, error); if (subscription.CandleSeries != null) { RaiseCandleSeriesStopped(subscription.CandleSeries); } }
private void RaiseMarketDataUnSubscriptionFailed(MarketDataMessage origin, SubscriptionResponseMessage reply, Subscription subscription) { if (origin == null) { throw new ArgumentNullException(nameof(origin)); } if (reply == null) { throw new ArgumentNullException(nameof(reply)); } if (subscription == null) { throw new ArgumentNullException(nameof(subscription)); } var securityId = subscription.SecurityId; var error = reply.Error ?? new NotSupportedException(); this.AddErrorLog(LocalizedStrings.UnSubscribedError, securityId, origin.DataType2, error.Message); var security = TryGetSecurity(securityId); MarketDataUnSubscriptionFailed?.Invoke(security, origin, error); MarketDataUnSubscriptionFailed2?.Invoke(security, origin, reply); RaiseSubscriptionFailed(subscription, error, false); }
private void RaiseMarketDataUnSubscriptionSucceeded(MarketDataMessage message, Subscription subscription) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (subscription == null) { throw new ArgumentNullException(nameof(subscription)); } var securityId = subscription.SecurityId; var msg = LocalizedStrings.UnSubscribedOk.Put(securityId, message.DataType2); if (message.From != null && message.To != null) { msg += LocalizedStrings.Str691Params.Put(message.From.Value, message.To.Value); } this.AddDebugLog(msg + "."); MarketDataUnSubscriptionSucceeded?.Invoke(TryGetSecurity(securityId), message); RaiseSubscriptionStopped(subscription, null); if (subscription.CandleSeries != null) { RaiseCandleSeriesStopped(subscription.CandleSeries); } }
private void RaiseMarketDataSubscriptionFailed(MarketDataMessage origin, SubscriptionResponseMessage reply, Subscription subscription) { if (origin == null) { throw new ArgumentNullException(nameof(origin)); } if (reply == null) { throw new ArgumentNullException(nameof(reply)); } if (subscription == null) { throw new ArgumentNullException(nameof(subscription)); } var securityId = subscription.SecurityId; var error = reply.Error ?? new NotSupportedException(LocalizedStrings.SubscriptionNotSupported.Put(origin)); if (reply.IsNotSupported()) { this.AddWarningLog(LocalizedStrings.SubscriptionNotSupported, origin); } else { this.AddErrorLog(LocalizedStrings.SubscribedError, securityId, origin.DataType2, error.Message); } var security = TryGetSecurity(securityId); MarketDataSubscriptionFailed?.Invoke(security, origin, error); MarketDataSubscriptionFailed2?.Invoke(security, origin, reply); RaiseSubscriptionFailed(subscription, error, true); if (subscription.CandleSeries != null) { RaiseCandleSeriesError(subscription.CandleSeries, reply); } }
private void RaiseLevel1Received(Subscription subscription, Level1ChangeMessage message) { Level1Received?.Invoke(subscription, message); RaiseSubscriptionReceived(subscription, message); }
private void RaiseSubscriptionReceived(Subscription subscription, Message message) { SubscriptionReceived?.Invoke(subscription, message); }