private void AddDisconectPacket() { if (!IsConnected) { return; } Status = eConnectionStatus.DisConnected; Packet packet = new ClientDisConnectedPacket(); packet.FactoryInit(null, this); m_vPacketsToProcess.Enqueue(new SinglePacketProcessor(packet)); EngineControler.Instance.QueForProcessing(this); }
internal ClientConnection(TcpClient client) { m_TcpClient = client; m_sConnectionDesc = m_TcpClient.Client.RemoteEndPoint.ToString(); m_ClientStream = m_TcpClient.GetStream(); Status = eConnectionStatus.Connected; lastReceiveDataTime = ApiDateTime.Now; Task.Run(async() => { try { await BeginRead(); } catch (Exception ex) { AOutput.Log($"ClientConnection {ex.Message}"); } }); }
private void CEL_DataConnectionStatusChanged(eConnectionStatus eConnectionStatus) { CqgConnectionStatusChanged(eConnectionStatus == eConnectionStatus.csConnectionUp); }
static void _cel_DataConnectionStatusChanged(eConnectionStatus newStatus) { OnCQGStatusChanged(newStatus == eConnectionStatus.csConnectionUp); }
private static void _cel_DataConnectionStatusChanged(eConnectionStatus newStatus) { _cqgIsStarted = newStatus == eConnectionStatus.csConnectionUp; }
void CEL_DataConnectionStatusChanged(eConnectionStatus eConnectionStatus1) { CqgConnectionStatusChanged(eConnectionStatus1 == eConnectionStatus.csConnectionUp); }
/// <summary> /// This event is fired, when some changes occur in the connection with the CQG data server. /// </summary> /// <param name="newStatus"> /// The current status of the connection with the data server. /// </param> private void CEL_DataConnectionStatusChanged(eConnectionStatus newStatus) { try { string info; System.Drawing.Color BackCol; if (newStatus != eConnectionStatus.csConnectionUp) { BackCol = System.Drawing.Color.FromArgb(255, 114, 0); info = "DATA Connection is " + (newStatus == eConnectionStatus.csConnectionDelayed ? "Delayed" : "Down").ToString(); //txtSymbol.Text = ""; //btnSubscribe.Enabled = false; } else { BackCol = System.Drawing.Color.FromArgb(192, 209, 205); info = "DATA Connection is UP"; MessageBox.Show(info); //SetSubscribeButtonStatus(); } //lblDataConnection.BackColor = BackCol; //lblDataConnection.Text = info; } catch (Exception ex) { modErrorHandler.ShowError("ticknet", "CEL_DataConnectionStatusChanged", ex); } }
private void Cell_DataConnectionStatusChanged(eConnectionStatus new_status) { status = new_status.ToString(); }
private void setGWStatus(eConnectionStatus newStatus) { try { if ((m_GWStatus != eConnectionStatus.csConnectionUp) && (newStatus == eConnectionStatus.csConnectionUp)) { m_GWStatus = newStatus; // Do any deleyed requests while (m_DelayedProductRequests.Count > 0) { KaiTrade.Interfaces.IProduct product = m_DelayedProductRequests.Pop(); m_CQGHostForm.CQGApp.NewInstrument(product.GenericName); } } else { m_GWStatus = newStatus; } } catch (Exception ex) { log.Error("setGWStatus", ex); } }
/// <summary> /// This event is fired, when some changes occur in the connection /// with the CQG Gateway server. /// </summary> /// <param name="newStatus"> The current status of the /// connection with the Gateway server.</param> private void cel_GWConnectionStatusChanged(eConnectionStatus newStatus) { try { wireLog.Info("cel_GWConnectionStatusChanged old:" + m_GWStatus.ToString() + " new=" + newStatus.ToString()); setGWStatus(newStatus); switch (newStatus) { case eConnectionStatus.csConnectionUp: m_CQGHostForm.CQGApp.AccountSubscriptionLevel = eAccountSubscriptionLevel.aslAccountUpdatesAndOrders; this.SendStatusMessage(KaiTrade.Interfaces.Status.open, "CQG GW Connection is UP"); this.SendAdvisoryMessage("CQG GW Connection is UP"); UpdateStatus("GW", "", "", "", KaiTrade.Interfaces.Status.open, "CQG GW Connection is UP"); m_RunningState.OrderRouting = StatusConditon.good; break; case eConnectionStatus.csConnectionDelayed: this.SendStatusMessage(KaiTrade.Interfaces.Status.error, "CQG GW Connection is Delayed"); this.SendAdvisoryMessage("CQG GW Connection is Delayed"); UpdateStatus("GW", "", "", "", KaiTrade.Interfaces.Status.error, "CQG GW Connection is Delayed"); // set the status of any subscribed items setSubscriptionsStatus(KaiTrade.Interfaces.Status.error); m_RunningState.OrderRouting = StatusConditon.alert; //Facade.RaiseAlert("KTACQG", "CQG GW Connection is Delayed", 0, KaiTrade.Interfaces.ErrorLevel.recoverable, KaiTrade.Interfaces.FlashMessageType.error); break; case eConnectionStatus.csConnectionDown: this.SendStatusMessage(KaiTrade.Interfaces.Status.closed, "CQG GW Connection is Down"); this.SendAdvisoryMessage("CQG GW Connection is Down"); UpdateStatus("GW", "", "", "", KaiTrade.Interfaces.Status.closed, "CQG GW Connection is Down"); // set the status of any subscribed items setSubscriptionsStatus(KaiTrade.Interfaces.Status.closed); m_RunningState.OrderRouting = StatusConditon.error; //Facade.RaiseAlert("KTACQG", "CQG GW Connection is Down", 0, KaiTrade.Interfaces.ErrorLevel.fatal, KaiTrade.Interfaces.FlashMessageType.error); break; default: this.SendStatusMessage(KaiTrade.Interfaces.Status.error, "CQG GW Connection unknown connection status: " + newStatus.ToString()); UpdateStatus("GW", "", "", "", KaiTrade.Interfaces.Status.error, "CQG GW Connection unknown connection status: " + newStatus.ToString()); // set the status of any subscribed items setSubscriptionsStatus(KaiTrade.Interfaces.Status.closed); break; } } catch (Exception ex) { log.Error("cel_GWConnectionStatusChanged", ex); } }
public KTACQG() { // initialize member data // set our ID m_ID = "KTACQG"; // this is the name used in the publisher Name = "KTACQG"; driverLog.Info("KTACQG Created"); _config = new CQGConfig(); m_SubscribedProducts = new System.Collections.Hashtable(); //m_SubjectRegister = new System.Collections.Hashtable(); //m_ClIDOrder = new System.Collections.Hashtable(); m_GUID2CQGOrder = new System.Collections.Hashtable(); m_TSSets = new Dictionary<string, KaiTrade.Interfaces.ITSSet>(); m_DelayedProductRequests = new Stack<KaiTrade.Interfaces.IProduct>(); m_ExpressionStrategyID = new Dictionary<string, string>(); m_ExecutionPatterns = new Dictionary<string, string>(); // set status to down setGWStatus(eConnectionStatus.csConnectionDown); m_DataStatus = eConnectionStatus.csConnectionDown; m_RunningState = new DriverBase.DriverStatus(); }
/// <summary> /// This event is fired, when some changes occur in the connection /// with the CQG data server. /// </summary> /// <param name="newStatus"> The current status of the /// connection with the Data server.</param> private void cel_DataConnectionStatusChanged(eConnectionStatus newStatus) { try { wireLog.Info("cel_DataConnectionStatusChanged old:" + m_DataStatus.ToString() + " new=" + newStatus.ToString()); m_DataStatus = newStatus; switch (newStatus) { case eConnectionStatus.csConnectionUp: this.SendStatusMessage(KaiTrade.Interfaces.Status.open, "CQG Data Connection is UP"); this.SendAdvisoryMessage("CQG Data Connection is UP"); UpdateStatus("Data", "", "", "", KaiTrade.Interfaces.Status.open, "CQG Data Connection is UP"); // Subscribe to the products in our interest list subscribeInterestList(); m_RunningState.Prices = StatusConditon.good; m_RunningState.HistoricData = StatusConditon.good; break; case eConnectionStatus.csConnectionDelayed: this.SendStatusMessage(KaiTrade.Interfaces.Status.error, "CQG Data Connection is Delayed"); this.SendAdvisoryMessage("CQG Data Connection is Delayed"); UpdateStatus("Data", "", "", "", KaiTrade.Interfaces.Status.error, "CQG Data Connection is Delayed"); // set the status of any subscribed items setSubscriptionsStatus(KaiTrade.Interfaces.Status.closed); m_RunningState.Prices = StatusConditon.alert; m_RunningState.HistoricData = StatusConditon.alert; //Facade.RaiseAlert("KTACQG", "CQG Data Connection is Delayed", 0, KaiTrade.Interfaces.ErrorLevel.recoverable, KaiTrade.Interfaces.FlashMessageType.error); break; case eConnectionStatus.csConnectionDown: this.SendStatusMessage(KaiTrade.Interfaces.Status.closed, "CQG Data Connection is Down"); this.SendAdvisoryMessage("CQG Data Connection is Down"); UpdateStatus("Data", "", "", "", KaiTrade.Interfaces.Status.closed, "CQG Data Connection is Down"); // set the status of any subscribed items setSubscriptionsStatus(KaiTrade.Interfaces.Status.closed); m_RunningState.Prices = StatusConditon.error; m_RunningState.HistoricData = StatusConditon.error; //Facade.RaiseAlert("KTACQG", "CQG Data Connection is Down", 0, KaiTrade.Interfaces.ErrorLevel.fatal, KaiTrade.Interfaces.FlashMessageType.error); break; default: this.SendStatusMessage(KaiTrade.Interfaces.Status.error, "CQG Data Connection unknown connection status: " + newStatus.ToString()); UpdateStatus("Data", "", "", "", KaiTrade.Interfaces.Status.error, "CQG Data Connection unknown connection status: " + newStatus.ToString()); // set the status of any subscribed items setSubscriptionsStatus(KaiTrade.Interfaces.Status.closed); //SendAdvisoryMessage(); m_RunningState.Prices = StatusConditon.alert; m_RunningState.HistoricData = StatusConditon.alert; break; } } catch (Exception ex) { log.Error("cel_DataConnectionStatusChanged", ex); } }
private void m_CEL_CELDataConnectionChg(eConnectionStatus new_status) { StringBuilder connStatusString = new StringBuilder(); StringBuilder connStatusShortString = new StringBuilder(); Color connColor = Color.Red; try { if (m_CEL.IsStarted) { connStatusString.Append("CQG API:"); connStatusString.Append(m_CEL.Environment.CELVersion); connStatusShortString.Append("CQG:"); if (new_status != eConnectionStatus.csConnectionUp) { if (new_status == eConnectionStatus.csConnectionDelayed) { connColor = Color.BlanchedAlmond; connStatusString.Append(" - CONNECTION IS DELAYED"); connStatusShortString.Append("DELAYED"); currConnStat = eConnectionStatus.csConnectionDelayed; CQGEventHandlers._ICQGCELEvents_DataConnectionStatusChangedEventHandlerImpl(eConnectionStatus.csConnectionDelayed); } else { connStatusString.Append(" - CONNECTION IS DOWN"); connStatusShortString.Append("DOWN"); currConnStat = eConnectionStatus.csConnectionDown; CQGEventHandlers._ICQGCELEvents_DataConnectionStatusChangedEventHandlerImpl(eConnectionStatus.csConnectionDelayed); } } else { connColor = Color.LawnGreen; connStatusString.Append(" - CONNECTION IS UP"); connStatusShortString.Append("UP"); currConnStat = eConnectionStatus.csConnectionUp; CQGEventHandlers._ICQGCELEvents_DataConnectionStatusChangedEventHandlerImpl(eConnectionStatus.csConnectionUp); } } else { connStatusString.Append("WAITING FOR API CONNECTION"); connStatusShortString.Append("WAITING"); } if (mainForm != null) { mainForm.UpdateConnectionStatus( connStatusString.ToString(), connColor); } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }