/// DB Ping Run Method: public static void Run() { //Don't run at all if local. if (_local) { return; } while (!_exitTriggered) { if (AlgorithmManager.AlgorithmId != "" && AlgorithmManager.QuitState == false) { try { //Get the state from the central server: var state = Api.GetAlgorithmStatus(AlgorithmManager.AlgorithmId); AlgorithmManager.SetStatus(state.Status); //Set which chart the user is look at, so we can reduce excess messaging (e.g. trading 100 symbols, only send 1). ResultHandler.SetChartSubscription(state.ChartSubscription); Log.Debug("StateCheck.Ping.Run(): Algorithm Status: " + state.Status + " Subscription: " + state.ChartSubscription); } catch { Log.Debug("StateCheck.Run(): Error in state check."); } } else { Log.Debug("StateCheck.Ping.Run(): Opted to not ping: " + AlgorithmManager.AlgorithmId + " " + AlgorithmManager.QuitState); } Thread.Sleep(1000); } }
/// DB Ping Run Method: public static void Run() { //Don't run at all if local. if (_local) { return; } while (!_exitTriggered) { if (AlgorithmManager.AlgorithmId != "" && AlgorithmManager.QuitState == false) { try { //Get the state from the central server: var state = Api.GetAlgorithmStatus(AlgorithmManager.AlgorithmId); AlgorithmManager.SetStatus(state.Status); ResultHandler.SetChartSubscription(state.ChartSubscription); Log.Debug("StateCheck.Ping.Run(): Algorithm Status: " + state); } catch { Log.Debug("StateCheck.Run(): Error in state check."); } } else { Log.Debug("StateCheck.Ping.Run(): Opted to not ping: " + AlgorithmManager.AlgorithmId + " " + AlgorithmManager.QuitState); } Thread.Sleep(1000); } }