Exemplo n.º 1
0
        public void testAppExe()
        {
            AppExecution exe = new AppExecution();

            exe.OrderId      = 1;
            exe.ExecId       = "ABC";
            exe.LastExecTime = "2015-10-10";
            exe.Side         = "BUY";
            exe.AvgPrice     = 100;
            exe.ExeShare     = 2000;

            double value = 100 * 2000;

            Assert.AreEqual(value, exe.AvgPrice * exe.ExeShare);
        }
Exemplo n.º 2
0
        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("*********************************************");
        }
Exemplo n.º 3
0
    public override void ExecuteScriptableObject(AppExecution scriptable)
    {
        TextMsgObj textMsgObj = (TextMsgObj)scriptable;

        //TextProg.SetText(textMsgObj);
        TextMsgObjManager.AddMsgObj(textMsgObj);
        TextViewController.OnTextMsgObjExecute(textMsgObj.speaker);

        if (NotificationController.Instance)
        {
            MessageFrom_0_NotificationData data = (MessageFrom_0_NotificationData)NotificationController.Instance.CreateDataInstance(Utility.App.Text, "MessageFrom");
            data.FromWho = textMsgObj.speaker;
            data.Message = textMsgObj.message[0];
            NotificationController.Instance.PushNotification(data, textMsgObj.speaker);
            if (!TextProg.IsShow || TextProg.CurrentSpeaker != textMsgObj.speaker && !textMsgObj.playerTalking)
            {
                AudioManager.Instance.Play(AudioEnum.Text_Notifi_B);
            }
        }
    }
Exemplo n.º 4
0
 public void FinishedCluster(int clusterId)
 {
     m_clusterToExecute.Remove(clusterId);
     DbBehaviourModule.Instance.MarkClusterFinish(clusterId);
     if (m_clusterToExecute.Count < 1)
     {
         EndingManager.Instance.EndPlaythrough();
     }
     else
     {
         m_situationToExecute = DbBehaviourModule.Instance.RequestSituationFromCluster(m_clusterToExecute[0]);
         if (m_situationToExecute != null && m_situationToExecute.Count < 1)
         {
             FinishedCluster(m_clusterToExecute[0]);
             return;
         }
         //Execute Social Impact
         AppExecution socialImpact = DbBehaviourModule.Instance.FetchSituation(m_clusterToExecute[0], m_situationToExecute[0]);
         AppExecutionModule.Instance.Execute(socialImpact);
         m_situationInProgress.Add(socialImpact.Situation_Id);
     }
 }
Exemplo n.º 5
0
 IEnumerator wait4SceneInit()
 {
     while (!AppSceneLoader.Instance.ScenesLoaded())
         yield return null;
     var unfinishedExes = StateLoadingModule.Instance.GetUnFinishedAppExeIds();
     if (unfinishedExes.Length < 1)
     {
         if (m_clusterToExecute.Count > 0)
         {
             m_situationToExecute = DbBehaviourModule.Instance.RequestSituationFromCluster(m_clusterToExecute[0]);
             if (m_situationToExecute != null && m_situationToExecute.Count > 0)
             {
                 AppExecution socialImpact = DbBehaviourModule.Instance.FetchSituation(m_clusterToExecute[0], m_situationToExecute[0]);
                 AppExecutionModule.Instance.Execute(socialImpact);
                 m_situationInProgress.Add(socialImpact.Situation_Id);
             }
             else
             {
                 FinishedCluster(m_clusterToExecute[0]);
             }
         }
         else
         {
             EndingManager.Instance.EndPlaythrough();
         }
         yield break;
     }
     else
     {
         m_situationToExecute = DbBehaviourModule.Instance.RequestSituationFromCluster(unfinishedExes[0].ClusterId);
     }
     for (int i = 0; i < unfinishedExes.Length; i++)
     {
         AppExecution temp = DbBehaviourModule.Instance.FetchSituation(unfinishedExes[i].ClusterId, unfinishedExes[i].SitId, unfinishedExes[i].AppExeId);
         AppExecutionModule.Instance.Execute(temp);
         m_situationInProgress.Add(temp.Situation_Id);
     }
 }
Exemplo n.º 6
0
 public override void ExecuteScriptableObject(AppExecution scriptable)
 {
     EmailExeManager.AddExeObj((EmailExecutionObj)scriptable);
     EmailViewController.OnExecute((EmailExecutionObj)scriptable);
 }
 public override void ExecuteScriptableObject(AppExecution scriptable)
 {
     throw new System.NotImplementedException();
 }