private void ConnectorOnStartSignal(object sender, StartSignalParameters startSignalParameters) { Task.Run(() => { var signalBase = _scriptingManager.StartSignalExecution(startSignalParameters.Login, startSignalParameters.SignalInitParams, startSignalParameters.AccountInfos, startSignalParameters.Files); if (signalBase == null) { return; } var signal = ScriptingManager.CreateSignal(signalBase, startSignalParameters.SignalInitParams.FullName); if (signal == null) { return; } _connector.SignalStarted(signal, startSignalParameters.Login, signalBase.GetActualAlerts()); }); }
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)); }