public void CheckExecutionsInEvents(AlgorithmInfo algo)
 {
     Debug.WriteLine("Number of alerts: {0}", algo.Alerts.Count);
     foreach (var alert in algo.Alerts)
     {
         DateTime execTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(alert.Timestamp).ToLocalTime();
         if (execTime > StartTestTime)
         {
             if (algo.OrderToSend.Side == Side.BUY)
             {
                 algo.AlgoExecutions.FillSellQty += AlgorithmInfo.GetExecutionSizeFromAlert(alert.Description);
             }
             if (algo.OrderToSend.Side == Side.SELL)
             {
                 algo.AlgoExecutions.FillBuyQty += AlgorithmInfo.GetExecutionSizeFromAlert(alert.Description);
             }
         }
     }
 }
        public void CalculateExecutionsFromAlerts(AlgorithmInfo algo)
        {
            Debug.WriteLine("CalculateExecutionsFromAlerts, Number of alerts for executions : {0}", algo.Alerts.Count);

            algo.ChangePositionSize = 0;

            DateTime newTime = DateTime.MinValue;

            foreach (var alert in algo.Alerts)
            {
                DateTime execTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(alert.Timestamp).ToLocalTime();
                if (execTime > StartTestTime)
                {
                    algo.ChangePositionSize += AlgorithmInfo.GetExecutionSizeFromAlert(alert.Description);
                    newTime = execTime > newTime ? execTime : newTime;
                }
            }

            CalculateSizeExecutions(algo, newTime);
        }