static LiveTickCollectorManager() { try { Cel = new CQGCEL(); Cel.APIConfiguration.CollectionsThrowException = false; Cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; Cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; Cel.APIConfiguration.DefaultInstrumentSubscriptionLevel = eDataSubscriptionLevel.dsQuotesAndDOM; Cel.APIConfiguration.DOMUpdatesMode = eDOMUpdatesMode.domUMDynamic; Cel.DataConnectionStatusChanged += _cel_DataConnectionStatusChanged; _cel_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); Cel.InstrumentSubscribed += _cel_InstrumentSubscribed; Cel.DataError += _cel_DataError; Cel.IncorrectSymbol += _cel_IncorrectSymbol; Cel.InstrumentChanged += Cel_InstrumentChanged; Cel.InstrumentDOMChanged += Cel_InstrumentDOMChanged; Cel.Startup(); _timerScheduler.Tick += _timerScheduler_Tick; } catch (Exception ex) { Console.WriteLine(ex); } }
static CQGDataCollectorManager() { try { Cel = new CQGCEL(); Cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; Cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; Cel.APIConfiguration.CollectionsThrowException = false; Cel.APIConfiguration.LogSeverity = eLogSeverity.lsDebug; Cel.APIConfiguration.MessageProcessingTimeout = 30000; Cel.DataConnectionStatusChanged += _cel_DataConnectionStatusChanged; _cel_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); Cel.InstrumentSubscribed += _cel_InstrumentSubscribed; Cel.DataError += _cel_DataError; Cel.IncorrectSymbol += _cel_IncorrectSymbol; Cel.TimedBarsResolved += _cel_TimedBarsResolved; Cel.TicksResolved += _cel_TicksResolved; Cel.HistoricalSessionsResolved += _cel_HistoricalSessionsResolved; Cel.Startup(); _timerScheduler.Tick += _timerScheduler_Tick; } catch (Exception ex) { Console.WriteLine(ex); } }
internal void connectCQG() { if (m_CEL != null) { m_CEL.Startup(); } }
public void CQG_Start() { try { _cel.Startup(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Init() { if (_inited) return; _inited = true; _cqgVar=new CQGCEL(); _cqgVar.DataConnectionStatusChanged += _cel_DataConnectionStatusChanged; _cel_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); _cqgVar.InstrumentSubscribed += _cel_InstrumentSubscribed; _cqgVar.IncorrectSymbol += _cel_IncorrectSymbol; _cqgVar.InstrumentChanged += CQG_var_InstrumentChanged; _cqgVar.APIConfiguration.CollectionsThrowException = false; _cqgVar.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; _cqgVar.APIConfiguration.TimeZoneCode = eTimeZone.tzCentral; _cqgVar.Startup(); }
public CQGConnector() { _cel = new CQGCEL(); _cel.APIConfiguration.CollectionsThrowException = false; _cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; _cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; _cel.APIConfiguration.DefaultInstrumentSubscriptionLevel = eDataSubscriptionLevel.dsQuotesAndBBA; _cel.APIConfiguration.DOMUpdatesMode = eDOMUpdatesMode.domUMDynamic; if (_cel.IsStarted) { _cel.Shutdown(); } if (!_cel.IsStarted) { _cel.Startup(); } }
public static void Init() { if (_inited) { return; } _inited = true; _cqgVar = new CQGCEL(); _cqgVar.DataConnectionStatusChanged += _cel_DataConnectionStatusChanged; _cel_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); _cqgVar.InstrumentSubscribed += _cel_InstrumentSubscribed; _cqgVar.IncorrectSymbol += _cel_IncorrectSymbol; _cqgVar.InstrumentChanged += CQG_var_InstrumentChanged; _cqgVar.APIConfiguration.CollectionsThrowException = false; _cqgVar.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; _cqgVar.APIConfiguration.TimeZoneCode = eTimeZone.tzCentral; _cqgVar.Startup(); }
public void CreateConnection(CQGCEL CEL) { try { // Creates the CQGCEL object CEL = new CQGCEL(); CEL.DataError += new CQG._ICQGCELEvents_DataErrorEventHandler(CEL_DataError); CEL.DataConnectionStatusChanged += new CQG._ICQGCELEvents_DataConnectionStatusChangedEventHandler(CEL_DataConnectionStatusChanged); CEL.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; CEL.APIConfiguration.CollectionsThrowException = false; CEL.APIConfiguration.TimeZoneCode = eTimeZone.tzGreenwich; // Disables the controls CEL_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); // Starts up the CQGCEL CEL.Startup(); } catch (Exception ex) { modErrorHandler.ShowError("CQGConnection.cs", "CreateConnection", ex); } }
static CQGDataCollectorManager() { try { Cel = new CQGCEL(); Cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; Cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; Cel.APIConfiguration.CollectionsThrowException = false; Cel.APIConfiguration.LogSeverity = eLogSeverity.lsDebug; Cel.APIConfiguration.MessageProcessingTimeout = 30000; Cel.DataConnectionStatusChanged += _cel_DataConnectionStatusChanged; _cel_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); Cel.InstrumentSubscribed += _cel_InstrumentSubscribed; Cel.DataError += _cel_DataError; Cel.IncorrectSymbol += _cel_IncorrectSymbol; Cel.TimedBarsResolved += _cel_TimedBarsResolved; Cel.TicksResolved += _cel_TicksResolved; Cel.HistoricalSessionsResolved += _cel_HistoricalSessionsResolved; Cel.Startup(); _timerScheduler.Tick += _timerScheduler_Tick; //_timerTimeout.Tick += _timerTimeout_Tick; _timerTimeout.Elapsed += _timerTimeout_Elapsed; } catch (Exception ex) { Console.WriteLine(ex); } }
private void Form1_Load(object sender, EventArgs e) { try { ClientDatabaseManager.ConnectionStatusChanged += ClientDataManager_ConnectionStatusChanged; if (Settings.Default.L.X < 0 || Settings.Default.L.Y < 0) Settings.Default.L = new Point(0, 0); if (Settings.Default.S.Width < 0 || Settings.Default.S.Height < 0) Settings.Default.S = new Size(800, 500); Size = Settings.Default.S; Location = Settings.Default.L; _emeilAfterFinishing= Settings.Default.IsSendReports; UpdateControlsSizeAndLocation(); _logger = Logger.GetInstance(listViewLogger); _logger.LogAdd("Application Start", Category.Information); _missingBarManager = new MissingBarManager(_logger); _missingBarManager.MissingBarStart += DataCollector_MissingBarStart; _missingBarManager.MissingBarEnd += DataCollector_MissingBarEnd; _missingBarManager.Finished += DataCollector_Finished; _missingBarManager.Progress += _missingBarManager_Progress; ui_home_textBoxX_db.Text = Settings.Default.MainDB; ui_home_textBoxX_db_bar.Text = Settings.Default.dbBar; ui_home_textBoxX_db_historical.Text = Settings.Default.dbHistorical; ui_home_textBoxX_uid.Text = Settings.Default.User; ui_home_textBoxX_pwd.Text = Settings.Default.Password; ui_home_textBoxX_host.Text = Settings.Default.Host; //nudEndBar.Value = Settings.Default.valFinish; checkBoxX1.Checked = Settings.Default.SavePass; //** metroShell1.SelectedTab = metroTabItem1; ResetColorMarks(); // todo _cel = new CQGCEL(); _cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; _cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; _cel.APIConfiguration.CollectionsThrowException = false; _cel.APIConfiguration.LogSeverity = eLogSeverity.lsDebug; _cel.APIConfiguration.MessageProcessingTimeout = 30000; _cel.DataConnectionStatusChanged += CEL_DataConnectionStatusChanged; CEL_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); _cel.DataError += CEL_DataError; _cel.IncorrectSymbol += CEL_IncorrectSymbol; _cel.HistoricalSessionsResolved += CEL_HistoricalSessionsResolved; _cel.InstrumentSubscribed += CEL_InstrumentSubscribed; FormAddSymbolsGroups.RefreshSYmbolsGroups += RefreshGridSymbolsGroups; FormAutocollect.RefreshGroups += RefreshGridGroups; //todo _pingTimer = new Timer(); _pingTimer.Tick += TimerTick; _pingTimer.Interval = 1000; _pingTimer.Enabled = true; _onlineServerSymbol = _startControl.uiServerOnlineFakeSymbol.Symbol; _offlineServerSymbol = _startControl.uiOfflineFakeSymbol.Symbol; //todo //groupList4.ItemStateChanged +=groupList4_ItemStateChanged; //todo subscribe FormSettings.EmeilAfterFinishing += EmailChange; FormSettings.IsAutocollect += AutocollectChange; FormSettings.BarEnd += barEndChange; CQGDataCollectorManager.ItemStateChanged += CQGDataCollectorManager_ItemStateChanged; CQGDataCollectorManager.CollectedSymbolCountChanged += CQGDataCollectorManager_CollectedSymbolCountChanged; CQGDataCollectorManager.RunnedStateChanged += CQGDataCollectorManager_RunnedStateChanged; CQGDataCollectorManager.StartTimeChanged += CQGDataCollectorManager_StartTimeChanged; CQGDataCollectorManager.CQGStatusChanged += CQGDataCollectorManager_CQGStatusChanged; CQGDataCollectorManager.UnsuccessfulSymbol += CQGDataCollectorManager_UnsuccessfulSymbol; CQGDataCollectorManager.TickInsertingStarted += CQGDataCollectorManager_TickInsertingStarted; CQGDataCollectorManager.ProgressBarChanged += CQGDataCollectorManager_ProgressBarChanched; CQGDataCollectorManager.SendReport += CQGDataCollectorManager_SendReport; //todo Thread.Sleep(1000); // Fixed bug with closeing while starting//do not remove this _cel.Startup(); //Restarting after crashing if (Settings.Default.IsCrashed) { LoginToServer(Settings.Default.scUser1, Settings.Default.scPassword, Settings.Default.scHostSlave, _nowIsMaster); } dataSet.Relations.Add("1", dataSet.Tables["my_tbl"].Columns["ID"], dataSet.Tables["tbl_sym"].Columns["ID"], false); //superGridControl1.DefaultVisualStyles.RowStyles.SelectedMouseOver.Background.Color1 = Color.Red; } catch (Exception ex) { Console.WriteLine(ex.Message); _logger.LogAdd("Error in loading. " + ex.Message, Category.Error); Close(); } }
/// <summary> /// Send message. /// </summary> /// <param name="message">Message.</param> protected override void OnSendInMessage(Message message) { switch (message.Type) { case MessageTypes.Reset: { if (_session != null) { try { DisposeSession(); } catch (Exception ex) { SendOutError(ex); } _session = null; } SendOutMessage(new ResetMessage()); break; } case MessageTypes.Connect: { if (_session != null) throw new InvalidOperationException(LocalizedStrings.Str1619); _session = new CQGCELClass(); _session.CELStarted += SessionOnCelStarted; _session.DataError += SessionOnDataError; _session.AccountChanged += SessionOnAccountChanged; _session.AlgorithmicOrderPlaced += SessionOnAlgorithmicOrderPlaced; _session.AlgorithmicOrderRegistrationComplete += SessionOnAlgorithmicOrderRegistrationComplete; _session.OrderChanged += SessionOnOrderChanged; _session.PositionsStatementResolved += SessionOnPositionsStatementResolved; _session.InstrumentDOMChanged += SessionOnInstrumentDomChanged; _session.InstrumentChanged += SessionOnInstrumentChanged; _session.TicksAdded += SessionOnTicksAdded; _session.IncorrectSymbol += SessionOnIncorrectSymbol; _session.InstrumentSubscribed += SessionOnInstrumentSubscribed; _session.ConstantVolumeBarsAdded += SessionOnConstantVolumeBarsAdded; _session.ConstantVolumeBarsUpdated += SessionOnConstantVolumeBarsUpdated; _session.PointAndFigureBarsAdded += SessionOnPointAndFigureBarsAdded; _session.PointAndFigureBarsUpdated += SessionOnPointAndFigureBarsUpdated; _session.TimedBarsAdded += SessionOnTimedBarsAdded; _session.TimedBarsUpdated += SessionOnTimedBarsUpdated; _session.TFlowBarsAdded += SessionOnFlowBarsAdded; _session.TFlowBarsUpdated += SessionOnFlowBarsUpdated; _session.Startup(); break; } case MessageTypes.Disconnect: { if (_session == null) throw new InvalidOperationException(LocalizedStrings.Str1856); DisposeSession(); _session = null; SendOutMessage(new DisconnectMessage()); break; } case MessageTypes.MarketData: { var mdMsg = (MarketDataMessage)message; switch (mdMsg.DataType) { case MarketDataTypes.Level1: { var instrument = _instruments.TryGetValue(mdMsg.SecurityId.SecurityCode); //SessionHolder.Session.CreateInstrumentRequest().; break; } case MarketDataTypes.MarketDepth: break; case MarketDataTypes.Trades: break; case MarketDataTypes.OrderLog: break; case MarketDataTypes.CandleTimeFrame: break; default: { SendOutMarketDataNotSupported(mdMsg.TransactionId); return; } } var reply = (MarketDataMessage)mdMsg.Clone(); reply.OriginalTransactionId = mdMsg.TransactionId; SendOutMessage(reply); break; } case MessageTypes.OrderRegister: { var regMsg = (OrderRegisterMessage)message; var instrument = _instruments.TryGetValue(regMsg.SecurityId.SecurityCode); if (instrument == null) throw new InvalidOperationException(LocalizedStrings.Str3792Params.Put(regMsg.SecurityId.SecurityCode)); var account = _accounts.TryGetValue(regMsg.PortfolioName); if (account == null) throw new InvalidOperationException(LocalizedStrings.Str3793Params.Put(regMsg.PortfolioName)); var stopPrice = regMsg.OrderType == OrderTypes.Conditional ? ((CQGOrderCondition)regMsg.Condition).StopPrice : null; var order = _session.CreateOrder(regMsg.OrderType.ToCQG(stopPrice), instrument, account, (int)regMsg.Volume, regMsg.Side.ToCQG(), (double)regMsg.Price, (double)(stopPrice ?? 0)); _orders.Add(regMsg.TransactionId, order); order.Place(); break; } case MessageTypes.OrderCancel: { var cancelMsg = (OrderCancelMessage)message; var order = _orders.TryGetValue(cancelMsg.OrderTransactionId); if (order == null) throw new InvalidOperationException(LocalizedStrings.Str3794Params.Put(cancelMsg.OrderTransactionId)); else order.Cancel(); break; } case MessageTypes.OrderReplace: { var replaceMsg = (OrderReplaceMessage)message; var order = _orders.TryGetValue(replaceMsg.OldTransactionId); if (order == null) { throw new InvalidOperationException(LocalizedStrings.Str3794Params.Put(replaceMsg.OldTransactionId)); } else { var modify = order.PrepareModify(); modify.Properties[eOrderProperty.opLimitPrice].Value = replaceMsg.Price; modify.Properties[eOrderProperty.opQuantity].Value = replaceMsg.Volume; order.Modify(modify); } break; } } }
/// <summary> /// Send message. /// </summary> /// <param name="message">Message.</param> protected override void OnSendInMessage(Message message) { switch (message.Type) { case MessageTypes.Reset: { if (_session != null) { try { DisposeSession(); } catch (Exception ex) { SendOutError(ex); } _session = null; } SendOutMessage(new ResetMessage()); break; } case MessageTypes.Connect: { if (_session != null) { throw new InvalidOperationException(LocalizedStrings.Str1619); } _session = new CQGCELClass(); _session.CELStarted += SessionOnCelStarted; _session.DataError += SessionOnDataError; _session.AccountChanged += SessionOnAccountChanged; _session.AlgorithmicOrderPlaced += SessionOnAlgorithmicOrderPlaced; _session.AlgorithmicOrderRegistrationComplete += SessionOnAlgorithmicOrderRegistrationComplete; _session.OrderChanged += SessionOnOrderChanged; _session.PositionsStatementResolved += SessionOnPositionsStatementResolved; _session.InstrumentDOMChanged += SessionOnInstrumentDomChanged; _session.InstrumentChanged += SessionOnInstrumentChanged; _session.TicksAdded += SessionOnTicksAdded; _session.IncorrectSymbol += SessionOnIncorrectSymbol; _session.InstrumentSubscribed += SessionOnInstrumentSubscribed; _session.ConstantVolumeBarsAdded += SessionOnConstantVolumeBarsAdded; _session.ConstantVolumeBarsUpdated += SessionOnConstantVolumeBarsUpdated; _session.PointAndFigureBarsAdded += SessionOnPointAndFigureBarsAdded; _session.PointAndFigureBarsUpdated += SessionOnPointAndFigureBarsUpdated; _session.TimedBarsAdded += SessionOnTimedBarsAdded; _session.TimedBarsUpdated += SessionOnTimedBarsUpdated; _session.TFlowBarsAdded += SessionOnFlowBarsAdded; _session.TFlowBarsUpdated += SessionOnFlowBarsUpdated; _session.Startup(); break; } case MessageTypes.Disconnect: { if (_session == null) { throw new InvalidOperationException(LocalizedStrings.Str1856); } DisposeSession(); _session = null; SendOutMessage(new DisconnectMessage()); break; } case MessageTypes.MarketData: { var mdMsg = (MarketDataMessage)message; switch (mdMsg.DataType) { case MarketDataTypes.Level1: { var instrument = _instruments.TryGetValue(mdMsg.SecurityId.SecurityCode); //SessionHolder.Session.CreateInstrumentRequest().; break; } case MarketDataTypes.MarketDepth: break; case MarketDataTypes.Trades: break; case MarketDataTypes.OrderLog: break; case MarketDataTypes.CandleTimeFrame: break; default: { SendOutMarketDataNotSupported(mdMsg.TransactionId); return; } } var reply = (MarketDataMessage)mdMsg.Clone(); reply.OriginalTransactionId = mdMsg.TransactionId; SendOutMessage(reply); break; } case MessageTypes.OrderRegister: { var regMsg = (OrderRegisterMessage)message; var instrument = _instruments.TryGetValue(regMsg.SecurityId.SecurityCode); if (instrument == null) { throw new InvalidOperationException(LocalizedStrings.Str3792Params.Put(regMsg.SecurityId.SecurityCode)); } var account = _accounts.TryGetValue(regMsg.PortfolioName); if (account == null) { throw new InvalidOperationException(LocalizedStrings.Str3793Params.Put(regMsg.PortfolioName)); } if (regMsg.OrderType == null) { throw new InvalidOperationException(); } var stopPrice = regMsg.OrderType == OrderTypes.Conditional ? ((CQGOrderCondition)regMsg.Condition).StopPrice : null; var order = _session.CreateOrder(regMsg.OrderType.Value.ToCQG(stopPrice), instrument, account, (int)regMsg.Volume, regMsg.Side.ToCQG(), (double)regMsg.Price, (double)(stopPrice ?? 0)); _orders.Add(regMsg.TransactionId, order); order.Place(); break; } case MessageTypes.OrderCancel: { var cancelMsg = (OrderCancelMessage)message; var order = _orders.TryGetValue(cancelMsg.OrderTransactionId); if (order == null) { throw new InvalidOperationException(LocalizedStrings.Str3794Params.Put(cancelMsg.OrderTransactionId)); } else { order.Cancel(); } break; } case MessageTypes.OrderReplace: { var replaceMsg = (OrderReplaceMessage)message; var order = _orders.TryGetValue(replaceMsg.OldTransactionId); if (order == null) { throw new InvalidOperationException(LocalizedStrings.Str3794Params.Put(replaceMsg.OldTransactionId)); } else { var modify = order.PrepareModify(); modify.Properties[eOrderProperty.opLimitPrice].Value = replaceMsg.Price; modify.Properties[eOrderProperty.opQuantity].Value = replaceMsg.Volume; order.Modify(modify); } break; } } }
private void Form1_Load(object sender, EventArgs e) { try { slidePanelSymbols.IsOpen = false; ClientDatabaseManager.ConnectionStatusChanged += ClientDataManager_ConnectionStatusChanged; if (Settings.Default.L.X < 0 || Settings.Default.L.Y < 0) Settings.Default.L = new Point(0, 0); if (Settings.Default.S.Width < 0 || Settings.Default.S.Height < 0) Settings.Default.S = new Size(800, 500); Size = Settings.Default.S; Location = Settings.Default.L; checkBox_emailMe.Checked = Settings.Default.IsSendReports; UpdateControlsSizeAndLocation(); _logger = Logger.GetInstance(listViewLogger); _logger.LogAdd("Application Start", Category.Information); _missingBarManager = new MissingBarManager(_logger); _missingBarManager.MissingBarStart += DataCollector_MissingBarStart; _missingBarManager.MissingBarEnd += DataCollector_MissingBarEnd; _missingBarManager.Finished += DataCollector_Finished; _missingBarManager.Progress += _missingBarManager_Progress; ui_home_textBoxX_db.Text = Settings.Default.MainDB; ui_home_textBoxX_db_bar.Text = Settings.Default.dbBar; ui_home_textBoxX_db_historical.Text = Settings.Default.dbHistorical; ui_home_textBoxX_uid.Text = Settings.Default.User; ui_home_textBoxX_pwd.Text = Settings.Default.Password; ui_home_textBoxX_host.Text = Settings.Default.Host; nudEndBar.Value = Settings.Default.valFinish; ui_checkBoxAuto_CheckForMissedBars.Value = Settings.Default.AutoMissingBarReport; checkBoxX1.Checked = Settings.Default.SavePass; //** metroShell1.SelectedTab = metroTabItem1; cmbContinuationType.Items.Clear(); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctNoContinuation); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctStandard); //cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctStandardByMonth); //cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctActive); //cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctActiveByMonth); //cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctAdjusted); //cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctAdjustedByMonth); cmbContinuationType.SelectedIndex = 1; cmbHistoricalPeriod.SelectedIndex = 0; ResetColorMarks(); // todo _cel = new CQGCEL(); _cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; _cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; _cel.APIConfiguration.CollectionsThrowException = false; _cel.APIConfiguration.LogSeverity = eLogSeverity.lsDebug; _cel.APIConfiguration.MessageProcessingTimeout = 30000; _cel.DataConnectionStatusChanged += CEL_DataConnectionStatusChanged; CEL_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); _cel.DataError += CEL_DataError; _cel.IncorrectSymbol += CEL_IncorrectSymbol; _cel.HistoricalSessionsResolved += CEL_HistoricalSessionsResolved; _cel.InstrumentSubscribed += CEL_InstrumentSubscribed; //todo //currStatus = DEFAULT_STATUS; dateTimeInputStart.Value = DateTime.Now.AddDays(-1); dateTimeInputEnd.Value = DateTime.Now; _pingTimer = new Timer(); _pingTimer.Tick += TimerTick; _pingTimer.Interval = 1000; _pingTimer.Enabled = true; _onlineServerSymbol = _startControl.uiServerOnlineFakeSymbol.Symbol; _offlineServerSymbol = _startControl.uiOfflineFakeSymbol.Symbol; //todo groupList4.ItemStateChanged +=groupList4_ItemStateChanged; CQGDataCollectorManager.ItemStateChanged += CQGDataCollectorManager_ItemStateChanged; CQGDataCollectorManager.CollectedSymbolCountChanged += CQGDataCollectorManager_CollectedSymbolCountChanged; CQGDataCollectorManager.RunnedStateChanged += CQGDataCollectorManager_RunnedStateChanged; CQGDataCollectorManager.StartTimeChanged += CQGDataCollectorManager_StartTimeChanged; CQGDataCollectorManager.CQGStatusChanged += CQGDataCollectorManager_CQGStatusChanged; CQGDataCollectorManager.UnsuccessfulSymbol += CQGDataCollectorManager_UnsuccessfulSymbol; CQGDataCollectorManager.TickInsertingStarted += CQGDataCollectorManager_TickInsertingStarted; CQGDataCollectorManager.ProgressBarChanged += CQGDataCollectorManager_ProgressBarChanched; CQGDataCollectorManager.SendReport += CQGDataCollectorManager_SendReport; //todo Thread.Sleep(1000); // Fixed bug with closeing while starting//do not remove this _cel.Startup(); //Restarting after crashing if (Settings.Default.IsCrashed) { LoginToServer(Settings.Default.scUser1, Settings.Default.scPassword, Settings.Default.scHostSlave, _nowIsMaster); } } catch (Exception ex) { Console.WriteLine(ex.Message); _logger.LogAdd("Error in loading. " + ex.Message, Category.Error); Close(); } }
private void Form1_Load(object sender, EventArgs e) { try { DataNetClientDataManager.ConnectionStatusChanged += ClientDataManager_ConnectionStatusChanged; if (Settings.Default.L.X < 0 || Settings.Default.L.Y < 0) Settings.Default.L = new Point(0, 0); if (Settings.Default.S.Width < 0 || Settings.Default.S.Height < 0) Settings.Default.S = new Size(800, 500); Size = Settings.Default.S; Location = Settings.Default.L; UpdateControlsSizeAndLocation(); _logger = Logger.GetInstance(listViewLogger); _logger.LogAdd("Application Start", Category.Information); _dataCollector = new DataCollector(_logger); _dataCollector.SymbolCollectStart += DataCollector_SymbolCollectStart; _dataCollector.SymbolCollectEnd += DataCollector_SymbolCollectEnd; _dataCollector.MissingBarStart += DataCollector_MissingBarStart; _dataCollector.MissingBarEnd += DataCollector_MissingBarEnd; _dataCollector.Finished += DataCollector_Finished; ui_home_textBoxX_db.Text = Settings.Default.DB; ui_home_textBoxX_db_bar.Text = Settings.Default.dbBar; ui_home_textBoxX_db_historical.Text = Settings.Default.dbHistorical; ui_home_textBoxX_uid.Text = Settings.Default.User; ui_home_textBoxX_pwd.Text = Settings.Default.Password; ui_home_textBoxX_host.Text = Settings.Default.Host; nudEndBar.Value = Settings.Default.valFinish; ui_checkBoxAuto_CheckForMissedBars.Value = Settings.Default.AutoMissingBarReport; checkBoxX1.Checked = Settings.Default.SavePass; //** metroShell1.SelectedTab = metroTabItem1; cmbContinuationType.Items.Clear(); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctNoContinuation); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctStandard); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctStandardByMonth); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctActive); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctActiveByMonth); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctAdjusted); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctAdjustedByMonth); cmbContinuationType.SelectedIndex = 0; cmbHistoricalPeriod.SelectedIndex = 0; ResetColorMarks(); // todo _cel = new CQGCEL(); _cel.APIConfiguration.TimeZoneCode = eTimeZone.tzGMT; _cel.APIConfiguration.ReadyStatusCheck = eReadyStatusCheck.rscOff; _cel.APIConfiguration.CollectionsThrowException = false; _cel.APIConfiguration.LogSeverity = eLogSeverity.lsDebug; _cel.APIConfiguration.MessageProcessingTimeout = 30000; _cel.DataConnectionStatusChanged += CEL_DataConnectionStatusChanged; CEL_DataConnectionStatusChanged(eConnectionStatus.csConnectionDown); _cel.DataError += CEL_DataError; _cel.TimedBarsResolved += CEL_TimedBarsResolved; _cel.IncorrectSymbol += CEL_IncorrectSymbol; _cel.HistoricalSessionsResolved += CEL_HistoricalSessionsResolved; _cel.TicksResolved += CQG_TicksResolved; _cel.InstrumentSubscribed += CEL_InstrumentSubscribed; _cel.Startup(); //todo //currStatus = DEFAULT_STATUS; dateTimeInputStart.Value = DateTime.Now.AddDays(-1); dateTimeInputEnd.Value = DateTime.Now; ui_listBox_symbols.DrawItem += listBox1_DrawItem; _pingTimer = new Timer(); _pingTimer.Tick += TimerTick; _pingTimer.Interval = 1000; _pingTimer.Enabled = true; _onlineServerSymbol = _startControl.uiServerOnlineFakeSymbol.Symbol; _offlineServerSymbol = _startControl.uiOfflineFakeSymbol.Symbol; //todo styledListControl1.ItemStateChanged += styledListControl1_ItemStateChanged; CQGDataCollectorManager.ItemStateChanged += CQGDataCollectorManager_ItemStateChanged; CQGDataCollectorManager.CollectedSymbolCountChanged += CQGDataCollectorManager_CollectedSymbolCountChanged; CQGDataCollectorManager.RunnedStateChanged += CQGDataCollectorManager_RunnedStateChanged; CQGDataCollectorManager.StartTimeChanged += CQGDataCollectorManager_StartTimeChanged; CQGDataCollectorManager.CQGStatusChanged += CQGDataCollectorManager_CQGStatusChanged; //todo } catch (Exception ex) { Console.WriteLine(ex.Message); _logger.LogAdd("Error in loading. " + ex.Message, Category.Error); Close(); } }