コード例 #1
0
        }// ProcessParameterChangeRequest()

        //
        //
        // *****************************************
        // ****  ProcessSyntheticOrderRequest   ****
        // *****************************************
        /// <summary>
        /// A request for submission of a synthetic order.
        /// </summary>
        /// <param name="engineEventArg"></param>
        private void ProcessSyntheticOrderRequest(EngineEventArgs engineEventArg)
        {
            SyntheticOrder  syntheticOrder = (SyntheticOrder)engineEventArg.DataObjectList[0];
            ThreadContainer strategy       = null;
            int             strategyID     = engineEventArg.EngineContainerID;

            if (strategyID < 0)
            {   // This request is for all strategies
                Log.NewEntry(LogLevel.Error, "ProcessEngineEvent: Negative EngineContainerId not allowed in {0}.", syntheticOrder);
                engineEventArg.EngineHubName = this.ServiceName;
                engineEventArg.Status        = EngineEventArgs.EventStatus.Failed;
                OnEngineChanged(engineEventArg);
            }
            else if (m_ExecutionContainers[DefaultHubName].TryGetValue(strategyID, out strategy))
            {   // Found the strategy, pass it the request now.
                // He is on another thread, so give him a thread safe copy.
                strategy.ProcessEvent(engineEventArg.Copy());
            }
            else
            {   // Unknown strategy
                Log.NewEntry(LogLevel.Error, "ProcessEngineEvent: Unknown EngineContainerId {0}", syntheticOrder);
                engineEventArg.EngineHubName = this.ServiceName;
                engineEventArg.Status        = EngineEventArgs.EventStatus.Failed;
                OnEngineChanged(engineEventArg);
            }
        }
コード例 #2
0
        //
        // *****************************************
        // ****     ProcessEngineEvent          ****
        // *****************************************
        /// <summary>
        /// A request from outside to change a parameter value.
        /// </summary>
        protected void ProcessEngineEvent(EngineEventArgs eventArgs)
        {
            ThreadContainer strategy   = null;
            int             strategyID = eventArgs.EngineContainerID; // parameter change requested for this strategy.

            if (strategyID < 0)
            {   // This request is for all strategies
                Log.NewEntry(LogLevel.Error, "ProcessEngineEvent: Negative EngineContainerId not allowed in {0}.", eventArgs);
                eventArgs.EngineHubName = this.ServiceName;
                eventArgs.Status        = EngineEventArgs.EventStatus.Failed;
                OnEngineChanged(eventArgs);
            }
            else if (m_ExecutionContainers[DefaultHubName].TryGetValue(strategyID, out strategy))
            {   // Found the strategy, pass it the request now.
                // He is on another thread, so give him a thread safe copy.
                // He will be allowed to modify this object to compose his response.
                //EngineEventArgs copyEventArgs = eventArgs.Copy();
                strategy.ProcessEvent(eventArgs.Copy());
            }
            else
            {   // Unknown strategy
                Log.NewEntry(LogLevel.Error, "ProcessEngineEvent: Unknown EngineContainerId {0}", eventArgs);
                eventArgs.EngineHubName = this.ServiceName;
                eventArgs.Status        = EngineEventArgs.EventStatus.Failed;
                OnEngineChanged(eventArgs);
            }
        }// ProcessParameterChangeRequest()