//***Start Button*** private void onSubmitClick(int stgIndex) { Dictionary <String, String> paras = getStgParas(stgIndex); String[] stgNames = appStrategyManager.getStgNames(); appStrategyManager.startStrategy(stgNames[stgIndex], stgIndex, paras, appStrategyManager.UserAccount, GetMDContract(), getTickerInfo()); StrategyOnOff onOff = new StrategyOnOff(); onOff.stgIndex = stgIndex; onOff.isOn = true; HandleStrategyOnOff(onOff); MessageBox.Show("Strategy Start!"); }
public void processExecution(ExecutionMessage message) { IAppOrderManager orderManager = appStgManager.getAppOrderManager(); String[] stgNames = appStgManager.getStgNames(); if (!appStgManager.getAppOrderManager().AppOrderStore.ContainsKey(message.Execution.OrderId)) { return; } if (!orderManager.isExecutionProcessed(message.Execution.ExecId)) { AppExecution execution = orderManager.updateAppOrderExecution(message); IAppOrder order = orderManager.AppOrderStore[message.Execution.OrderId]; AppOrder cloneOrder = (AppOrder)order.Clone(); if (AppObjectUtil.isOrderClosed(cloneOrder)) { orderManager.closeOpenAppOrder(order.StrategyIndex, order); } orderManager.updatePosition(order.StrategyIndex, execution); String stgName = stgNames[order.StrategyIndex]; AppPosition stgPosition = orderManager.StoreStgPositions[stgName]; log.Info("Total PnL : " + stgPosition.TotalPnL); orderManager.markExeProcessed(message.Execution.ExecId); //***New for send order executed email*** IAppEventManager appEventManager = appStgManager.getAppEventManager(); appEventManager.putOrderExeEvents(message, stgName); /*TSAppExecution execution = appForm.StrategyManager.updateAppOrderExecution(message); * TSAppOrder order = appForm.StrategyManager.AppOrderStore[message.Execution.OrderId]; * TSAppOrder cloneOrder = (TSAppOrder)order.Clone(); * if (StrategyManager.isOrderClosed(cloneOrder)) * { * appForm.StrategyManager.closeOpenAppOrder(order.StrategyIndex, order); * //appForm.StrategyManager.removeOpenAppOrder(order.StrategyIndex, order); * //appForm.StrategyManager.addClosedAppOrder(order.StrategyIndex, order); * } * appForm.StrategyManager.updatePosition(order.StrategyIndex, execution); * String stgName = appForm.StrategyManager.StgNames[order.StrategyIndex]; * AppPosition stgPosition = appForm.StrategyManager.StoreStgPositions[stgName]; * log.Info("Total PnL : " + stgPosition.TotalPnL); * //log.Info("Total PnL : " + appForm.StrategyManager.StgPositions[order.StrategyIndex].TotalPnL); * appForm.StrategyManager.markExeProcessed(message.Execution.ExecId);*/ } log.Info("Order Executed"); log.Info("*********************************************"); }