示例#1
0
 private void ProcessChangeOrder(CreateOrChangeOrder order)
 {
     SendExecutionReport(order, "E", 0.0, 0, 0, 0, (int)order.Size, TimeStamp.UtcNow);
     SendPositionUpdate(order.Symbol, ProviderSimulator.GetPosition(order.Symbol));
     SendExecutionReport(order, "5", 0.0, 0, 0, 0, (int)order.Size, TimeStamp.UtcNow);
     SendPositionUpdate(order.Symbol, ProviderSimulator.GetPosition(order.Symbol));
 }
示例#2
0
        private void ProcessCancelOrder(CreateOrChangeOrder cancelOrder)
        {
            var origOrder   = cancelOrder.OriginalOrder;
            var randomOrder = random.Next(0, 10) < 5 ? cancelOrder : origOrder;

            SendExecutionReport(randomOrder, "6", 0.0, 0, 0, 0, (int)origOrder.Size, TimeStamp.UtcNow);
            SendPositionUpdate(cancelOrder.Symbol, ProviderSimulator.GetPosition(cancelOrder.Symbol));
            SendExecutionReport(randomOrder, "4", 0.0, 0, 0, 0, (int)origOrder.Size, TimeStamp.UtcNow);
            SendPositionUpdate(cancelOrder.Symbol, ProviderSimulator.GetPosition(cancelOrder.Symbol));
        }
示例#3
0
 private void ProcessCreateOrder(CreateOrChangeOrder order)
 {
     SendExecutionReport(order, "A", 0.0, 0, 0, 0, (int)order.Size, TimeStamp.UtcNow);
     SendPositionUpdate(order.Symbol, ProviderSimulator.GetPosition(order.Symbol));
     if (order.Symbol.FixSimulationType == FIXSimulationType.BrokerHeldStopOrder &&
         (order.Type == OrderType.BuyStop || order.Type == OrderType.StopLoss))
     {
         SendExecutionReport(order, "A", "D", 0.0, 0, 0, 0, (int)order.Size, TimeStamp.UtcNow);
         SendPositionUpdate(order.Symbol, ProviderSimulator.GetPosition(order.Symbol));
     }
     else
     {
         SendExecutionReport(order, "0", 0.0, 0, 0, 0, (int)order.Size, TimeStamp.UtcNow);
         SendPositionUpdate(order.Symbol, ProviderSimulator.GetPosition(order.Symbol));
     }
 }
示例#4
0
        public override void OnPhysicalFill(PhysicalFill fill, CreateOrChangeOrder order)
        {
            if (order.Symbol.FixSimulationType == FIXSimulationType.BrokerHeldStopOrder &&
                (order.Type == OrderType.BuyStop || order.Type == OrderType.SellStop))
            {
                order.Type = order.Type == OrderType.BuyStop ? OrderType.BuyMarket : OrderType.SellMarket;
                var marketOrder = Factory.Utility.PhysicalOrder(order.Action, order.OrderState,
                                                                order.Symbol, order.Side, order.Type, OrderFlags.None, 0,
                                                                order.Size, order.LogicalOrderId,
                                                                order.LogicalSerialNumber,
                                                                order.BrokerOrder, null, TimeStamp.UtcNow);
                SendExecutionReport(marketOrder, "0", 0.0, 0, 0, 0, (int)marketOrder.Size, TimeStamp.UtcNow);
            }
            if (debug)
            {
                log.Debug("Converting physical fill to FIX: " + fill);
            }
            SendPositionUpdate(order.Symbol, ProviderSimulator.GetPosition(order.Symbol));
            var orderStatus = fill.CumulativeSize == fill.TotalSize ? "2" : "1";

            SendExecutionReport(order, orderStatus, "F", fill.Price, fill.TotalSize, fill.CumulativeSize, fill.Size, fill.RemainingSize, fill.UtcTime);
        }