private void RecordInvalidResponse(QStrategyException rex, string location) { string logMessage = string.Format("Class: {0}, Method: {1}", "StrategyEngine", "RecordInvalidResponse(...)"); LogUtil.WriteLog(LogLevel.INFO, logMessage); this.IsInvalidSymbolUpdateResponse = true; Exception excep = rex; while (excep.InnerException != null) { excep = excep.InnerException; } if (excep is System.Net.Sockets.SocketException || excep is System.Net.WebException) { this.IsConnected = false; this.APIState = ""; } this.LastInvalidSymbolUpdateMessage = excep.Message; this.LastInvalidSymbolUpdateMessageDetail = excep.StackTrace; throw excep; }
public bool IsServerConnected() { string logMessage = string.Format("Class: {0}, Method: {1}", "StrategyEngine", "IsServerConnected()"); LogUtil.WriteLog(LogLevel.INFO, logMessage); try { bool serverStatus = false; serverStatus = this.ComMgr.CheckConnection(); this.IsConnected = serverStatus; return serverStatus; } catch (Exception ex) { this.IsConnected = false; string location = string.Format("Class: {0}, Method:{1}", "StrategyEngine", "public bool IsServerConnected()"); QStrategyException qex = new QStrategyException(ex.Message, ex, ExceptionType.ServerConnectionException, location); this.StrategyEngineStatus = ""; while (ex.InnerException != null) { ex = ex.InnerException; } if (ex is System.Net.Sockets.SocketException || ex is System.Net.WebException) { this.IsConnected = false; this.APIState = ""; } else { RecordInvalidResponse(qex, location); } return false; } }
public List<StrategyOrderInfo> ProcessSymbol(string _strategyId, string[] _symbolList, ProcessType _processType) { string logMessage = string.Format("Class: {0}, Method: {1}", "StrategyEngine", "ProcessSymbol(...)"); LogUtil.WriteLog(LogLevel.INFO, logMessage); try { List<StrategyOrderInfo> StrategyOrderInfoList = this.ComMgr.ProcessSymbol(_strategyId, _symbolList, _processType); ClearInvalidResponse(); return StrategyOrderInfoList; } catch (Exception ex) { string location = string.Format("Class: {0}, Method:{1}", "StrategyEngine", "public List<StrategyOrder> ProcessSymbol(string " + _strategyId + ",_symbolList, " + _processType + ")"); QStrategyException qex = new QStrategyException(ex.Message, ex, ExceptionType.ProcessSymbolException, location); RecordInvalidResponse(qex, location); return new List<StrategyOrderInfo>(); } }
public List<StrategyOrderInfo> GetStrategyUpdate() { string logMessage = string.Format("Class: {0}, Method: {1}", "StrategyEngine", "List<StrategyOrderInfo> GetStrategyUpdate()"); LogUtil.WriteLog(LogLevel.INFO, logMessage); try { List<StrategyOrderInfo> StrategyOrderInfo = this.ComMgr.GetStrategyUpdate(); ClearInvalidResponse(); return StrategyOrderInfo; } catch (Exception ex) { string location = string.Format("Class: {0}, Method:{1}", "StrategyEngine", "public List<StrategyOrder> GetStrategyUpdate()"); QStrategyException rex = new QStrategyException(ex.Message, ex, ExceptionType.ReceiveSymbolUpdateException, location); RecordInvalidResponse(rex, location); return new List<StrategyOrderInfo>(); } }