private void SetServerStatus(strategyResultsUpdate update) { string logMessage = string.Format("Class: {0}, Method: {1}", "CommunicationManager", "SetServerStatus()"); LogUtil.WriteLog(LogLevel.INFO, logMessage); if (update.isTrading) { this.StrategyEngine.StrategyEngineStatus = "Running"; } else { this.StrategyEngine.StrategyEngineStatus = "Stopped"; } this.StrategyEngine.SeedQtyThreshold = update.seedQtyThreshold; this.StrategyEngine.APIState = update.apiState.ToString(); this.StrategyEngine.IsConnected = true; }
public List<StrategyOrderInfo> ProcessSymbol(string StrategyId, string[] symbol, ProcessType _processType) { string logMessage = string.Format("Class: {0}, Method: {1}", "CommunicationManager", "ProcessSymbol(...)"); LogUtil.WriteLog(LogLevel.DEBUG, logMessage); string symbolSpec = null; if (symbol != null) { symbolSpec = EZXWPFLibrary.Utils.StringUtils.StringListToText(symbol.ToList(), ","); } List<StrategyOrderInfo> StrategyOrderList = new List<StrategyOrderInfo>(); strategyResultsUpdate update = new strategyResultsUpdate(); switch (_processType) { case ProcessType.START: update = Service.start(symbolSpec); break; case ProcessType.STOP: update = Service.stop(symbolSpec); break; case ProcessType.CANCELALL: Service.cancelAll(symbolSpec); update = Service.getUpdates(); break; case ProcessType.LOCK: update = Service.@lock(symbolSpec); break; case ProcessType.UNLOCK: update = Service.unlock(symbolSpec); break; case ProcessType.UNWIND: update = Service.getUpdates(); break; case ProcessType.BUY: update = Service.buy(symbolSpec); break; case ProcessType.SELL: update = Service.sell(symbolSpec); break; case ProcessType.BOTH: update = Service.both(symbolSpec); break; } symbolUpdate[] StrategyOrderSRVList = update.updates; CovertServiceObjectToClinetObject(StrategyOrderList, StrategyOrderSRVList, update.strategyName); SetServerStatus(update); return StrategyOrderList; }