Esempio n. 1
0
        public ServiceHost()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, "RabbitMQ Service");

            Username    = config.GetString(nameof(Username));
            Password    = config.GetString(nameof(Password));
            VirtualHost = config.GetString(nameof(VirtualHost));
            HostName    = config.GetString(nameof(HostName));

            _core           = new HostCore();
            _commandManager = _core.CommandManager;
            _rabbitMQServer = _core.RabbitMQServer;

            RegisterCommands();
        }
Esempio n. 2
0
        public ServiceHost()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, "  WCF Service");

            IP     = config.GetString(nameof(IP));
            Port   = config.GetInt(nameof(Port));
            DTPort = config.GetInt(nameof(DTPort));

            _uris = new[]
            {
                new Uri($"net.tcp://{IP}:{Port}/TradingService"),
                new Uri($"http://{IP}:{DTPort}/TradingService")
            };

            var timeOut = new TimeSpan(0, 1, 0);

            _netTcpBinding = new NetTcpBinding
            {
                TransactionFlow        = false,
                ReceiveTimeout         = timeOut,
                SendTimeout            = timeOut,
                OpenTimeout            = timeOut,
                CloseTimeout           = timeOut,
                Security               = { Mode = SecurityMode.None },
                MaxBufferSize          = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                MaxBufferPoolSize      = 1073741823,
                MaxConnections         = 100
            };

            _netTcpBinding.Security.Transport.ProtectionLevel      = System.Net.Security.ProtectionLevel.EncryptAndSign;
            _netTcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
            _netTcpBinding.ReliableSession.InactivityTimeout       = timeOut;
        }
        public PoloniexDataFeed()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, "Poloniex Datafeed");

            PublicKey  = config.GetString(nameof(PublicKey));
            PrivateKey = config.GetString(nameof(PrivateKey));
            Url        = config.GetString(nameof(Url));

            TimeZoneInfo       = TimeZoneInfo.Utc;
            Securities         = new List <Security>();
            _securities        = new Dictionary <CurrencyPair, Security>();
            _securitiesById    = new Dictionary <int, Security>();
            _orderBooks        = new Dictionary <CurrencyPair, OrderBook>();
            _subscribedSymbols = new Dictionary <string, int>();
            _tickTimestamps    = new Dictionary <string, DateTime>();
        }
Esempio n. 4
0
        public LMAXDataFeed()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, "Lmax Datafeed");

            Username = config.GetString(nameof(Username));
            Password = config.GetString(nameof(Password));
            Url      = config.GetString(nameof(Url));

            TimeZoneInfo = TimeZoneInfo.Utc;
            Securities   = new List <Security>();

            _productType = ProductType.CFD_LIVE;

            _securities                       = new Dictionary <int, Security>();
            _subscribedSymbols                = new Dictionary <int, int>();
            _historyRequestHandlers           = new Dictionary <int, HistoryAnswerHandler>();
            _originalHistoryRequestParameters = new Dictionary <int, Selection>();
            _bidAskCache                      = new ConcurrentDictionary <int, List <Bar> >();
        }
Esempio n. 5
0
        public ServiceHost()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, " WebSocket Service");

            IP   = config.GetString(nameof(IP));
            Port = config.GetInt(nameof(Port));

            var core = new CoreServiceHost();

            _commandManager  = core.CommandManager;
            _webSocketServer = core.WebSocketServer;
            _core            = core;

            RegsterCommands();
        }
Esempio n. 6
0
        public Core()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, "Scripting service");

            var rabbitMQUserName    = config.GetString("rabbitMQUserName", "Username");
            var rabbitMQPassword    = config.GetString("rabbitMQPassword", "Password");
            var rabbitMQVirtualHost = config.GetString("rabbitMQVirtualHost", "VirtualHost");
            var rabbitMQHostName    = config.GetString("rabbitMQHostName", "HostName");
            var wcfIP   = config.GetString("rabbitMQHostName", "WCFServerIP");
            var wcfPort = config.GetString("wcfPort", "WCFServerPort");

            _connector        = new Connector(wcfIP, wcfPort);
            _scriptingManager = new ScriptingManager(_connector, rabbitMQUserName, rabbitMQPassword, rabbitMQVirtualHost, rabbitMQHostName);

            _connector.StartSignal          += ConnectorOnStartSignal;
            _connector.SetSignalFlag        += ConnectorOnSetSignalFlag;
            _connector.StartIndicator       += ConnectorOnStartIndicator;
            _connector.UpdateStrategyParams += (serviceId, login, name, parameters) => _scriptingManager.UpdateSignalStrategyParams(login, name, parameters);
            _connector.RemoveIndicator      += (login, name, id) => _scriptingManager.RemoveWorkingIndicator(name, login);
            _connector.NewTick += (sender, tick) => Task.Run(() => _scriptingManager.RecalculateOnNewTick(tick));
            _connector.NewBar  += (sender, tuple) => Task.Run(() => _scriptingManager.RecalculateOnNewBar(tuple.Item1, tuple.Item2));
        }