//the application is closing, shut down all the servers and stuff private void DXWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //save grid layout using (StreamWriter file = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "GridLayout.xml")) { InstrumentsGrid.SerializeLayout(file); } //shut down quartz _scheduler.Shutdown(true); //then take down the client, the servers, and the brokers _client.Disconnect(); _client.Dispose(); _realTimeServer.StopServer(); _realTimeServer.Dispose(); _historicalDataServer.StopServer(); _historicalDataServer.Dispose(); RealTimeBroker.Dispose(); HistoricalBroker.Dispose(); }
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { _client.HistoricalDataReceived -= _client_HistoricalDataReceived; _client.Error -= _client_Error; _client.Disconnect(); _client.Dispose(); }
public void TearDown() { _client?.Dispose(); _hdServer?.Dispose(); _rtServer?.Dispose(); NetMQConfig.Cleanup(); }
public void TearDown() { _instrumentsServer.StopServer(); _instrumentsServer.Dispose(); _rtdServer.StopServer(); _rtdServer.Dispose(); _client.Dispose(); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (_connectionTimer != null) { _connectionTimer.Dispose(); _connectionTimer = null; } if (_client != null) { _client.Dispose(); _client = null; } }
//the application is closing, shut down all the servers and stuff private void DXWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //save grid layout using (StreamWriter file = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "GridLayout.xml")) { InstrumentsGrid.SerializeLayout(file); } //Dispose main viewmodel ViewModel.Dispose(); //then take down the client, the servers, and the brokers _client.Disconnect(); _client.Dispose(); }
public void TearDown() { _client.Dispose(); NetMQConfig.Cleanup(); }
static void Main() { //create the client, assuming the default port settings QDMSClient.QDMSClient client = new QDMSClient.QDMSClient( "SampleClient", "127.0.0.1", 5556, 5557, 5558, 5555); //hook up the events needed to receive data & error messages client.HistoricalDataReceived += client_HistoricalDataReceived; client.RealTimeDataReceived += client_RealTimeDataReceived; client.LocallyAvailableDataInfoReceived += client_LocallyAvailableDataInfoReceived; client.Error += client_Error; //connect to the server client.Connect(); //make sure the connection was succesful before we continue if (!client.Connected) { Console.WriteLine("Could not connect."); Console.WriteLine("Press enter to exit."); Console.ReadLine(); return; } //request the list of available instruments List <Instrument> instruments = client.FindInstruments(); foreach (Instrument i in instruments) { Console.WriteLine("Instrument ID {0}: {1} ({2}), Datasource: {3}", i.ID, i.Symbol, i.Type, i.Datasource.Name); } Thread.Sleep(3000); //then we grab some historical data from Yahoo //start by finding the SPY instrument var spy = client.FindInstruments(x => x.Symbol == "SPY" && x.Datasource.Name == "Yahoo").FirstOrDefault(); if (spy != null) { var req = new HistoricalDataRequest( spy, BarSize.OneDay, new DateTime(2013, 1, 1), new DateTime(2013, 1, 15), dataLocation: DataLocation.Both, saveToLocalStorage: true, rthOnly: true); client.RequestHistoricalData(req); Thread.Sleep(3000); //now that we downloaded the data, let's make a request to see what is stored locally client.GetLocallyAvailableDataInfo(spy); Thread.Sleep(3000); //finally send a real time data request (from the simulated data datasource) spy.Datasource.Name = "SIM"; var rtReq = new RealTimeDataRequest(spy, BarSize.OneSecond); client.RequestRealTimeData(rtReq); Thread.Sleep(3000); //And then cancel the real time data stream client.CancelRealTimeData(spy); } Console.WriteLine("Press enter to exit."); Console.ReadLine(); client.Disconnect(); client.Dispose(); }
static void Main() { //create the client, assuming the default port settings QDMSClient.QDMSClient client = new QDMSClient.QDMSClient( "SampleClient", "127.0.0.1", 5556, 5557, 5558, 5555); //hook up the events needed to receive data & error messages client.HistoricalDataReceived += client_HistoricalDataReceived; client.RealTimeDataReceived += client_RealTimeDataReceived; client.LocallyAvailableDataInfoReceived += client_LocallyAvailableDataInfoReceived; client.Error += client_Error; //connect to the server client.Connect(); //make sure the connection was succesful before we continue if (!client.Connected) { Console.WriteLine("Could not connect."); Console.WriteLine("Press enter to exit."); Console.ReadLine(); return; } //request the list of available instruments List<Instrument> instruments = client.FindInstruments(); foreach (Instrument i in instruments) { Console.WriteLine("Instrument ID {0}: {1} ({2}), Datasource: {3}", i.ID, i.Symbol, i.Type, i.Datasource.Name); } Thread.Sleep(3000); //then we grab some historical data from Yahoo //start by finding the SPY instrument var spy = client.FindInstruments(x => x.Symbol == "SPY" && x.Datasource.Name == "Yahoo").FirstOrDefault(); if (spy != null) { var req = new HistoricalDataRequest( spy, BarSize.OneDay, new DateTime(2013, 1, 1), new DateTime(2013, 1, 15), dataLocation: DataLocation.Both, saveToLocalStorage: true, rthOnly: true); client.RequestHistoricalData(req); Thread.Sleep(3000); //now that we downloaded the data, let's make a request to see what is stored locally client.GetLocallyAvailableDataInfo(spy); Thread.Sleep(3000); //finally send a real time data request (from the simulated data datasource) spy.Datasource.Name = "SIM"; var rtReq = new RealTimeDataRequest(spy, BarSize.OneSecond); client.RequestRealTimeData(rtReq); Thread.Sleep(3000); //And then cancel the real time data stream client.CancelRealTimeData(spy); } Console.WriteLine("Press enter to exit."); Console.ReadLine(); client.Disconnect(); client.Dispose(); }
public void TearDown() { _client.Dispose(); _rtServer.Dispose(); }
public void TearDown() { _client.Dispose(); }
public void TearDown() { _client?.Dispose(); _hdServer?.Dispose(); _rtServer?.Dispose(); }