private void BindFilteredData(int iSessionID)
        {
            var data = HistoricalDataServer.GetFilteredHistoricalData(iSessionID);

            this.ctlHistoricalDataViewer.Visible         = false;
            this.ctlFilteredHistoricalDataViewer.Visible = true;

            this.ctlFilteredHistoricalDataViewer.DataSource = data;
            this.ctlFilteredHistoricalDataViewer.DataBind();
        }
        private void BindData()
        {
            var data = HistoricalDataServer.GetHistoricalDataList();

            this.ctlHistoricalDataViewer.Visible         = true;
            this.ctlFilteredHistoricalDataViewer.Visible = false;

            this.ctlHistoricalDataViewer.DataSource = data;
            this.ctlHistoricalDataViewer.DataBind();
        }
Пример #3
0
        public void SetUp()
        {
            _realTimeDataBrokerMock   = new Mock <IRealTimeDataBroker>();
            _historicalDataBrokerMock = new Mock <IHistoricalDataBroker>();
            // Also need the real time server to keep the "heartbeat" going
            _rtServer = new RealTimeDataServer(5555, 5554, _realTimeDataBrokerMock.Object);
            _rtServer.StartServer();

            _hdServer = new HistoricalDataServer(5557, _historicalDataBrokerMock.Object);
            _hdServer.StartServer();

            _client = new QDMSClient.QDMSClient("testingclient", "127.0.0.1", 5554, 5555, 5556, 5557);
            _client.Connect();
        }
        private void CreateAndStartServers()
        {
            RealTimeServer          = new RealTimeDataServer(Settings.Default.RealTimeDataServerRequestPort, RealTimeBroker);
            DataServer              = new HistoricalDataServer(Settings.Default.HistoricalServerPort, HistoricalBroker);
            MessagesServer          = new MessagesServer(Settings.Default.MessagesServerPushPort);
            EquityUpdateServer      = new EquityUpdateServer(Settings.Default.EquityUpdateServerRouterPort);
            InstrumentRequestServer = new RequestResponseServer(Settings.Default.InstrumetnUpdateRequestSocketPort);

            RealTimeServer.StartServer();
            DataServer.StartServer();
            MessagesServer.StartServer();
            InstrumentRequestServer.StartServer();
            //not using poller.Async, need to spawn thread
            Task.Factory.StartNew(EquityUpdateServer.StartServer, TaskCreationOptions.LongRunning);
        }
        /// <summary>
        /// Starts the server.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <returns><c>true</c> if Server is successfully started, <c>false</c> otherwise.</returns>
        /// <exception cref="System.ArgumentNullException">server</exception>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public bool StartServer(MqServer server)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            INetMQServer netMqServer;

            switch (server.ServerType)
            {
            case ServerType.EquityUpdate:
                netMqServer = new EquityUpdateServer(server);
                netMqServer.StartServer();
                break;

            case ServerType.HistoricalData:
                netMqServer = new HistoricalDataServer(server, null);
                netMqServer.StartServer();
                break;

            case ServerType.InstrumentRequest:
                netMqServer = new RequestResponseServer(server);
                netMqServer.StartServer();
                break;

            case ServerType.Message:
                netMqServer = new MessagesServer(server);
                netMqServer.StartServer();
                break;

            case ServerType.RealTimeData:
                netMqServer = new EquityUpdateServer(server);
                netMqServer.StartServer();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(netMqServer.ServerRunning);
        }
Пример #6
0
        public void SetUp()
        {
            _realTimeDataBrokerMock   = new Mock <IRealTimeDataBroker>();
            _historicalDataBrokerMock = new Mock <IHistoricalDataBroker>();

            var settings = new Mock <ISettings>();

            settings.SetupGet(x => x.rtDBPubPort).Returns(5555);
            settings.SetupGet(x => x.rtDBReqPort).Returns(5554);
            settings.SetupGet(x => x.hDBPort).Returns(5557);

            // Also need the real time server to keep the "heartbeat" going
            _rtServer = new RealTimeDataServer(settings.Object, _realTimeDataBrokerMock.Object);
            _rtServer.StartServer();

            _hdServer = new HistoricalDataServer(settings.Object, _historicalDataBrokerMock.Object);
            _hdServer.StartServer();

            _client = new QDMSClient.QDMSClient("testingclient", "127.0.0.1", 5554, 5555, 5557, 5559, "");
            _client.Connect();
        }
Пример #7
0
        public void Initialisize()
        {
            _log.Info($"Server is initialisizing ...");

            //create data db if it doesn't exist
            DataDBContext dataContext;

            try
            {
                dataContext = new DataDBContext(_config.LocalStorage.ConnectionString);
                dataContext.Database.Initialize(false);
            }
            catch (System.Data.Entity.Core.ProviderIncompatibleException ex)
            {
                throw new NotSupportedException("Could not connect to context DataDB!", ex);
            }
            dataContext.Dispose();

            MyDBContext entityContext;

            try
            {
                entityContext = new MyDBContext(_config.DataStorage.ConnectionString);
                entityContext.Database.Initialize(false);
            }
            catch (System.Data.Entity.Core.ProviderIncompatibleException ex)
            {
                throw new NotSupportedException("Could not connect to context MyDB!", ex);
            }

            // initialisize helper classes
            _instrumentManager = new InstrumentManager();

            var cfRealtimeBroker = new ContinuousFuturesBroker(new QDMSClient.QDMSClient("RTDBCFClient", "127.0.0.1",
                                                                                         _config.RealtimeDataService.RequestPort, _config.RealtimeDataService.PublisherPort,
                                                                                         _config.InstrumentService.Port, _config.HistoricalDataService.Port), _instrumentManager, false);
            var cfHistoricalBroker = new ContinuousFuturesBroker(new QDMSClient.QDMSClient("HDBCFClient", "127.0.0.1",
                                                                                           _config.RealtimeDataService.RequestPort, _config.RealtimeDataService.PublisherPort,
                                                                                           _config.InstrumentService.Port, _config.HistoricalDataService.Port), _instrumentManager, false);

            IDataStorage localStorage;

            switch (_config.LocalStorage.Type)
            {
            case Config.LocalStorageType.MySql:
                localStorage = new QDMSServer.DataSources.MySQLStorage(_config.LocalStorage.ConnectionString);
                break;

            case Config.LocalStorageType.SqlServer:
                localStorage = new QDMSServer.DataSources.SqlServerStorage(_config.LocalStorage.ConnectionString);
                break;

            default:
                throw new NotSupportedException("Not supported local storage type: " + _config.LocalStorage.Type);
            }

            // create brokers
            _historicalDataBroker = new HistoricalDataBroker(cfHistoricalBroker, localStorage, new IHistoricalDataSource[] {
                // @todo please add here some historical data sources the service should provide
            });
            _realTimeDataBroker   = new RealTimeDataBroker(cfRealtimeBroker, localStorage, new IRealTimeDataSource[] {
                // @todo please add here some real time data sources the service should provide
            });

            // create servers
            _instrumentsServer    = new InstrumentsServer(_config.InstrumentService.Port, _instrumentManager);
            _historicalDataServer = new HistoricalDataServer(_config.HistoricalDataService.Port, _historicalDataBroker);
            _realTimeDataServer   = new RealTimeDataServer(_config.RealtimeDataService.PublisherPort, _config.RealtimeDataService.RequestPort, _realTimeDataBroker);

            // ... start the servers
            _instrumentsServer.StartServer();
            _historicalDataServer.StartServer();
            _realTimeDataServer.StartServer();

            _log.Info($"Server is ready.");
        }
Пример #8
0
        public void Initialisize()
        {
            _log.Info($"Server is initialisizing ...");

            //create data db if it doesn't exist
            DataDBContext dataContext;

            try
            {
                dataContext = new DataDBContext(_config.LocalStorage.ConnectionString);
                dataContext.Database.Initialize(false);
            }
            catch (System.Data.Entity.Core.ProviderIncompatibleException ex)
            {
                throw new NotSupportedException("Could not connect to context DataDB!", ex);
            }
            dataContext.Dispose();

            MyDBContext entityContext;

            try
            {
                entityContext = new MyDBContext(_config.DataStorage.ConnectionString);
                entityContext.Database.Initialize(false);
            }
            catch (System.Data.Entity.Core.ProviderIncompatibleException ex)
            {
                throw new NotSupportedException("Could not connect to context MyDB!", ex);
            }

            // initialisize helper classes

            var cfRealtimeBroker   = new ContinuousFuturesBroker(GetClient("RTDBCFClient"), false);
            var cfHistoricalBroker = new ContinuousFuturesBroker(GetClient("HDBCFClient"), false);

            IDataStorage localStorage;

            switch (_config.LocalStorage.Type)
            {
            case LocalStorageType.MySql:
                localStorage = new QDMSServer.DataSources.MySQLStorage(_config.LocalStorage.ConnectionString);
                break;

            case LocalStorageType.SqlServer:
                localStorage = new QDMSServer.DataSources.SqlServerStorage(_config.LocalStorage.ConnectionString);
                break;

            default:
                throw new NotSupportedException("Not supported local storage type: " + _config.LocalStorage.Type);
            }

            // create brokers
            _historicalDataBroker  = new HistoricalDataBroker(cfHistoricalBroker, localStorage, new IHistoricalDataSource[] {
                // @todo please add here some historical data sources the service should provide
            });
            _realTimeDataBroker    = new RealTimeDataBroker(cfRealtimeBroker, localStorage, new IRealTimeDataSource[] {
                // @todo please add here some real time data sources the service should provide
            });
            _economicReleaseBroker = new EconomicReleaseBroker("FXStreet",
                                                               new[] { new fx.FXStreet(new CountryCodeHelper(entityContext.Countries.ToList())) });

            // create servers
            _historicalDataServer = new HistoricalDataServer(_config.HistoricalDataService.Port, _historicalDataBroker);
            _realTimeDataServer   = new RealTimeDataServer(_config.RealtimeDataService.PublisherPort, _config.RealtimeDataService.RequestPort, _realTimeDataBroker);

            // create scheduler
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory(); //todo need settings for scheduler + jobfactory

            _scheduler = schedulerFactory.GetScheduler();

            var bootstrapper = new CustomBootstrapper(
                localStorage,
                _economicReleaseBroker,
                _historicalDataBroker,
                _realTimeDataBroker,
                _scheduler,
                _config.WebService.ApiKey);
            var uri = new Uri((_config.WebService.UseSsl ? "https" : "http") + "://localhost:" + _config.WebService.Port);

            _httpServer = new NancyHost(bootstrapper, uri);

            // ... start the servers
            _historicalDataServer.StartServer();
            _realTimeDataServer.StartServer();
            _httpServer.Start();
            _scheduler.Start();

            _log.Info($"Server is ready.");
        }