public void Start() { loggingService.Info($"Start Trading service (Virtual: {Config.VirtualTrading})..."); IsTradingSuspended = true; orderingService = Application.Resolve <IOrderingService>(); rulesService = Application.Resolve <IRulesService>(); OnTradingRulesChanged(); rulesService.RegisterRulesChangeCallback(OnTradingRulesChanged); Exchange.Start(Config.VirtualTrading); signalsService = Application.Resolve <ISignalsService>(); if (!Config.VirtualTrading) { Account = new ExchangeAccount(loggingService, notificationService, healthCheckService, signalsService, this); } else { Account = new VirtualAccount(loggingService, notificationService, healthCheckService, signalsService, this); } accountRefreshTimedTask = tasksService.AddTask( name: nameof(AccountRefreshTimedTask), task: new AccountRefreshTimedTask(loggingService, healthCheckService, this), interval: Config.AccountRefreshInterval * 1000 / Application.Speed, startDelay: Constants.TaskDelays.ZeroDelay, startTask: false, runNow: true, skipIteration: 0); if (signalsService.Config.Enabled) { signalsService.Start(); } tradingTimedTask = tasksService.AddTask( name: nameof(TradingTimedTask), task: new TradingTimedTask(loggingService, notificationService, healthCheckService, signalsService, orderingService, this), interval: Config.TradingCheckInterval * 1000 / Application.Speed, startDelay: Constants.TaskDelays.NormalDelay, startTask: false, runNow: false, skipIteration: 0); tradingRulesTimedTask = tasksService.AddTask( name: nameof(TradingRulesTimedTask), task: new TradingRulesTimedTask(loggingService, notificationService, healthCheckService, rulesService, signalsService, this), interval: RulesConfig.CheckInterval * 1000 / Application.Speed, startDelay: Constants.TaskDelays.MidDelay, startTask: false, runNow: false, skipIteration: 0); IsTradingSuspended = false; loggingService.Info("Trading service started"); }
public void Start() { loggingService.Info("Start Backtesting Signals service..."); OnSignalRulesChanged(); rulesService.RegisterRulesChangeCallback(OnSignalRulesChanged); signalRulesTimedTask = new SignalRulesTimedTask(loggingService, healthCheckService, tradingService, rulesService, this); signalRulesTimedTask.Interval = RulesConfig.CheckInterval * 1000 / Application.Speed; signalRulesTimedTask.StartDelay = Constants.TimedTasks.StandardDelay; signalRulesTimedTask.LoggingEnabled = false; Application.Resolve <ICoreService>().AddTask(nameof(SignalRulesTimedTask), signalRulesTimedTask); loggingService.Info("Backtesting Signals service started"); }
public void Start() { loggingService.Info($"Start Trading service (Virtual: {Config.VirtualTrading})..."); IsTradingSuspended = true; rulesService = Application.Resolve <IRulesService>(); OnTradingRulesChanged(); rulesService.RegisterRulesChangeCallback(OnTradingRulesChanged); exchangeService.Start(Config.VirtualTrading); signalsService = Application.Resolve <ISignalsService>(); if (!Config.VirtualTrading) { Account = new ExchangeAccount(loggingService, notificationService, healthCheckService, signalsService, this); } else { Account = new VirtualAccount(loggingService, notificationService, healthCheckService, signalsService, this); } accountTimedTask = new AccountTimedTask(loggingService, healthCheckService, this); accountTimedTask.Interval = Config.AccountRefreshInterval * 1000 / Application.Speed; accountTimedTask.Run(); Application.Resolve <ICoreService>().AddTask(nameof(AccountTimedTask), accountTimedTask); if (signalsService.Config.Enabled) { signalsService.Start(); } tradingTimedTask = new TradingTimedTask(loggingService, notificationService, healthCheckService, signalsService, this); tradingTimedTask.Interval = Config.TradingCheckInterval * 1000 / Application.Speed; tradingTimedTask.StartDelay = Constants.TimedTasks.StandardDelay; tradingTimedTask.LoggingEnabled = !isReplayingSnapshots; Application.Resolve <ICoreService>().AddTask(nameof(TradingTimedTask), tradingTimedTask); tradingRulesTimedTask = new TradingRulesTimedTask(loggingService, notificationService, healthCheckService, rulesService, signalsService, this); tradingRulesTimedTask.Interval = RulesConfig.CheckInterval * 1000 / Application.Speed; Application.Resolve <ICoreService>().AddTask(nameof(TradingRulesTimedTask), tradingRulesTimedTask); IsTradingSuspended = false; loggingService.Info("Trading service started"); }
public void Start() { loggingService.Info("Start Backtesting Signals service..."); OnSignalRulesChanged(); rulesService.RegisterRulesChangeCallback(OnSignalRulesChanged); signalRulesTimedTask = tasksService.AddTask( name: nameof(SignalRulesTimedTask), task: new SignalRulesTimedTask(loggingService, healthCheckService, tradingService, rulesService, this), interval: RulesConfig.CheckInterval * 1000 / Application.Speed, startDelay: Constants.TaskDelays.LowDelay, startTask: false, runNow: false, skipIteration: 0); loggingService.Info("Backtesting Signals service started"); }
public void Start() { loggingService.Info("Start Signals service..."); OnSignalRulesChanged(); rulesService.RegisterRulesChangeCallback(OnSignalRulesChanged); signalReceivers.Clear(); foreach (var definition in Config.Definitions) { var receiver = Application.ResolveOptionalNamed <ISignalReceiver>(definition.Receiver, new TypedParameter(typeof(string), definition.Name), new TypedParameter(typeof(IConfigurationSection), definition.Configuration)); if (receiver != null) { if (signalReceivers.TryAdd(definition.Name, receiver)) { receiver.Start(); } else { throw new Exception($"Duplicate signal definition: {definition.Name}"); } } else { throw new Exception($"Signal receiver not found: {definition.Receiver}"); } } signalRulesTimedTask = tasksService.AddTask( name: nameof(SignalRulesTimedTask), task: new SignalRulesTimedTask(loggingService, healthCheckService, tradingService, rulesService, this), interval: RulesConfig.CheckInterval * 1000 / Application.Speed, startDelay: Constants.TaskDelays.LowDelay, startTask: false, runNow: false, skipIteration: 0); loggingService.Info("Signals service started"); }