示例#1
0
		internal void pTPWFkTQoi(ExecutionReportEventArgs obj0)
		{
			try
			{
				ExecutionReport executionReport = obj0.ExecutionReport;
				SingleOrder singleOrder;
				switch (executionReport.OrdStatus)
				{
					case OrdStatus.Cancelled:
					case OrdStatus.PendingCancel:
					case OrdStatus.PendingReplace:
						singleOrder = OrderManager.Orders.All[executionReport.OrigClOrdID] as SingleOrder;
						break;
					default:
						singleOrder = OrderManager.Orders.All[executionReport.ClOrdID] as SingleOrder;
						break;
				}
				if (singleOrder == null)
					return;
				StrategyBase strategyBase = (StrategyBase)null;
				if (!this.DKMWNa8OX5.TryGetValue(singleOrder, out strategyBase))
					return;
				strategyBase.a9XY5Muph(singleOrder, executionReport);
				this.OnExecutionReport(singleOrder, executionReport);
				if (singleOrder.OrdStatus != OrdStatus.PartiallyFilled)
					return;
				strategyBase.zQxocsRCM(singleOrder);
				this.OnOrderPartiallyFilled(singleOrder);
			}
			catch (Exception ex)
			{
				this.x6bWBlLIvv(ex);
			}
		}
示例#2
0
 private static void EmitExecutionReport(object sender, ExecutionReportEventArgs e)
 {
     if (ProviderManager.threadSafe)
         Monitor.Enter(ProviderManager.dataLock);
     try
     {
         if (ProviderManager.ExecutionReport != null)
             ProviderManager.ExecutionReport(sender, e);
     }
     finally
     {
         if (ProviderManager.threadSafe)
             Monitor.Exit(ProviderManager.dataLock);
     }
 }
示例#3
0
 private void OrderManager_ExecutionReport(object sender, ExecutionReportEventArgs args)
 {
     FreeQuant.FIX.ExecutionReport executionReport = args.ExecutionReport;
     if (executionReport.ExecType == ExecType.PartialFill)
     {
         SingleOrder order = ((InstrumentOrderListTable)OrderManager.Orders).All[executionReport.ClOrdID] as SingleOrder;
         StrategyRunner strategyRunner = (StrategyRunner)null;
         if (this.strategies.TryGetValue(order.Strategy, out strategyRunner) && strategyRunner.Enabled)
             strategyRunner.SetPartiallyFilled(order);
     }
     if ((executionReport.ExecType == ExecType.Fill || executionReport.ExecType == ExecType.Trade) && executionReport.LeavesQty > 0.0)
     {
         SingleOrder order = ((InstrumentOrderListTable)OrderManager.Orders).All[executionReport.ClOrdID] as SingleOrder;
         StrategyRunner strategyRunner = (StrategyRunner)null;
         if (this.strategies.TryGetValue(order.Strategy, out strategyRunner) && strategyRunner.Enabled)
             strategyRunner.SetPartiallyFilled(order);
     }
     if (executionReport.ExecType != ExecType.Replace)
         return;
     SingleOrder order1 = ((InstrumentOrderListTable)OrderManager.Orders).All[executionReport.ClOrdID] as SingleOrder;
     StrategyRunner strategyRunner1 = (StrategyRunner)null;
     if (!this.strategies.TryGetValue(order1.Strategy, out strategyRunner1) || !strategyRunner1.Enabled)
         return;
     strategyRunner1.SetOrderReplaced(order1);
 }
示例#4
0
 private void OrderManager_ExecutionReport(object sender, ExecutionReportEventArgs args)
 {
   lock (this)
   {
     ++this.countReport;
     ++this.countExecutionTotal;
   }
 }
示例#5
0
 private static void OnExecutionReport(object sender, ExecutionReportEventArgs e)
 {
     ExecutionReport executionReport = e.ExecutionReport;
     SingleOrder order;
     if (executionReport.ExecType == ExecType.PendingCancel || executionReport.ExecType == ExecType.Cancelled || (executionReport.ExecType == ExecType.PendingReplace || executionReport.ExecType == ExecType.Replace))
     {
         order = OrderManager.orders.All[executionReport.OrigClOrdID] as SingleOrder;
         if (executionReport.ExecType == ExecType.Replace)
         {
             OrderManager.orders.Remove(order);
             order.ClOrdID = executionReport.ClOrdID;
             order.OrdType = executionReport.OrdType;
             order.OrderQty = executionReport.OrderQty;
             if (executionReport.ContainsField(44))
                 order.Price = executionReport.Price;
             if (executionReport.ContainsField(99))
                 order.StopPx = executionReport.StopPx;
             if (executionReport.ContainsField(10701))
                 order.TrailingAmt = executionReport.TrailingAmt;
             if (executionReport.ContainsField(59))
                 order.TimeInForce = executionReport.TimeInForce;
             if (executionReport.ContainsField(126))
                 order.ExpireTime = executionReport.ExpireTime;
             OrderManager.orders.Add(order);
         }
     }
     else
         order = OrderManager.orders.All[executionReport.ClOrdID] as SingleOrder;
     if (order == null)
     {
         throw new ApplicationException(executionReport.ExecType + executionReport.ClOrdID + executionReport.OrigClOrdID);
     }
     else
     {
         if (order.Provider == null)
             throw new ApplicationException("provider is null");
         OrdStatus ordStatus = order.OrdStatus;
         order.EmitExecutionReport(executionReport);
         if (order.Persistent)
             OrderManager.server.AddReport(order, executionReport);
         if (OrderManager.ExecutionReport != null)
             OrderManager.ExecutionReport(sender, new ExecutionReportEventArgs((NewOrderSingle)order, executionReport));
         if (ordStatus != order.OrdStatus)
         {
             OrderManager.orders.Update(order);
             order.EmitStatusChanged();
             OrderManager.EmitOrderStatusChanged(order);
         }
         if (OrderManager.EnablePartialTransactions && (executionReport.ExecType == ExecType.Fill || executionReport.ExecType == ExecType.PartialFill || executionReport.ExecType == ExecType.Trade))
             OrderManager.nf3XP7Xf3(order, executionReport.TransactTime, executionReport.LastPx, executionReport.LastQty);
         // ISSUE: reference to a compiler-generated method
         if (ordStatus != order.OrdStatus && order.IsDone)
         {
             if (!OrderManager.EnablePartialTransactions)
                 OrderManager.nf3XP7Xf3(order, executionReport.TransactTime, executionReport.AvgPx, executionReport.CumQty);
             OrderManager.YUArMfFNj(order);
         }
         if (!(order.OCAGroup != "") || order.Provider.Id == 4 || order.OrdStatus != OrdStatus.Filled && order.OrdStatus != OrdStatus.Cancelled || OrderManager.oca.Contains((object)order.OCAGroup))
             return;
         OrderManager.oca.Add(order.OCAGroup, order.OCAGroup);
         foreach (SingleOrder singleOrder in OrderManager.GetOCAGroup(order.OCAGroup))
         {
             if (singleOrder != order)
                 singleOrder.Cancel();
         }
     }
 }