Beispiel #1
0
        public StrategyOrderInfo(string strategyName, symbolUpdate _strategyOrderSRV)
        {
            string logMessage = string.Format("Class: {0}, Method: {1}", "StrategyOrderInfo", "StrategyOrderInfo(string strategyName, symbolUpdate _strategyOrderSRV)(...)");
            LogUtil.WriteLog(LogLevel.DEBUG, logMessage);

            string _strategyOrderSRVSLog = EZXWPFLibrary.Utils.StringUtils.GetObjectLog(_strategyOrderSRV);
            logMessage = string.Format("Class: {0}, Method: {1}, symbolUpdate: {2}", "StrategyOrderInfo", "StrategyOrderInfo(string strategyName, symbolUpdate _strategyOrderSRV)", _strategyOrderSRVSLog);
            LogUtil.WriteLog(LogLevel.DEBUG, logMessage);

            this.Strategy = new Strategy(strategyName);

            this.StrategyOrderSRV = _strategyOrderSRV;

            string StrategyOrderInfoLog = EZXWPFLibrary.Utils.StringUtils.GetObjectLog(this);
            logMessage = string.Format("Class: {0}, Method: {1}, After mapping in StrategyOrderInfo: {2}", "StrategyOrderInfo", "StrategyOrderInfo(string strategyName, symbolUpdate _strategyOrderSRV)", StrategyOrderInfoLog);
            LogUtil.WriteLog(LogLevel.DEBUG, logMessage);
        }
        private symbolUpdate mock(string _symbol, strategyState _state, double _maxloss, int _orderCount, double _pa, int _pos, int _sr, int _vol)
        {
            symbolUpdate tempStrategyOrderInfo = new symbolUpdate();

            tempStrategyOrderInfo.symbol = _symbol;

            tempStrategyOrderInfo.maxLoss = _maxloss;
            tempStrategyOrderInfo.openOrderCount = _orderCount;
            tempStrategyOrderInfo.positionValue = _pa;
            tempStrategyOrderInfo.position = _pos;
            tempStrategyOrderInfo.unroutedQty = _sr;
            tempStrategyOrderInfo.state = _state;
            tempStrategyOrderInfo.volume = _vol;
            return tempStrategyOrderInfo;
        }
        private static void CovertServiceObjectToClinetObject(List<StrategyOrderInfo> StrategyOrderList, symbolUpdate[] StrategyOrderSRVList, string StartegyName)
        {
            string logMessage = string.Format("Class: {0}, Method: {1}", "CommunicationManager", "CovertServiceObjectToClinetObject(...)");
            LogUtil.WriteLog(LogLevel.DEBUG, logMessage);
            if (string.IsNullOrEmpty(StartegyName))
            {
                throw new QStrategyException("Startegyname is missing! Strategy name is configurable for engine in config/config.xml) ", ExceptionType.StrategyName, "CommuniationManager.CovertServiceObjectToClinetObject(...)");
            }

            if (StrategyOrderSRVList != null && !string.IsNullOrEmpty(StartegyName) && StrategyOrderSRVList.Count() > 0)
            {
                logMessage = string.Format("Class: {0}, Method: {1}, StrategyOrderSRVList.Count: {2}", "CommunicationManager", "CovertServiceObjectToClinetObject(...)", StrategyOrderSRVList.Count());
                LogUtil.WriteLog(LogLevel.DEBUG, logMessage);

                for (int i = 0; i < StrategyOrderSRVList.Count(); i++)
                {
                    logMessage = string.Format("Class: {0}, Method: {1}, Converting Server Object to Client for Symbol: {2}", "CommunicationManager", "CovertServiceObjectToClinetObject(...)", StrategyOrderSRVList[i].symbol);
                    LogUtil.WriteLog(LogLevel.DEBUG, logMessage);
                    StrategyOrderList.Add(new StrategyOrderInfo(StartegyName, StrategyOrderSRVList[i]));
                }
            }
            else
            {
                logMessage = string.Format("Class: {0}, Method: {1}, StrategyOrderSRVList is null or empty!:", "CommunicationManager", "CovertServiceObjectToClinetObject(...)");
                LogUtil.WriteLog(LogLevel.DEBUG, logMessage);
            }
        }