private void TryRemovePhysicalFill(PhysicalFill fill) { if (SyncTicks.Enabled) { tickSync.RemovePhysicalFill(fill); } }
public void AddPhysicalFill(PhysicalFill fill) { var value = Interlocked.Increment(ref physicalFills); if (trace) { log.Trace(symbol + ": AddPhysicalFill(" + value + "," + fill + "," + fill.Order + ")"); } }
private void OnPhysicalFill(PhysicalFill fill, int totalSize, int cumulativeSize, int remainingSize) { if (debug) { log.Debug("Converting physical fill to FIX: " + fill); } SendPositionUpdate(fill.Order.Symbol, GetPosition(fill.Order.Symbol)); var orderStatus = cumulativeSize == totalSize ? "2" : "1"; SendExecutionReport(fill.Order, orderStatus, fill.Price, totalSize, cumulativeSize, fill.Size, remainingSize, fill.UtcTime, null); }
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); }
public void ProcessFill(PhysicalFill physical, int totalSize, int cumulativeSize, int remainingSize) { if (debug) { log.Debug("ProcessFill() physical: " + physical); } // log.Warn( "ProcessFill() physical: " + physical); physicalOrders.Remove(physical.Order); var isCompletePhysicalFill = physical.Order.Size == 0; if (isCompletePhysicalFill) { if (debug) { log.Debug("Physical order completely filled: " + physical.Order); } physicalOrders.Remove(physical.Order); } else { if (debug) { log.Debug("Physical order partially filled: " + physical.Order); } } LogicalFillBinary fill; try { var logical = FindLogicalOrder(physical.Order.LogicalOrderId); desiredPosition += physical.Size; if (debug) { log.Debug("Adjusting symbol position to desired " + desiredPosition + ", physical fill was " + physical.Size); } var position = logical.StrategyPosition + physical.Size; if (debug) { log.Debug("Creating logical fill with position " + position + " from strategy position " + logical.StrategyPosition); } fill = new LogicalFillBinary( position, physical.Price, physical.Time, physical.UtcTime, physical.Order.LogicalOrderId, physical.Order.LogicalSerialNumber, logical.Position, physical.IsSimulated); } catch (ApplicationException) { if (debug) { log.Debug("Leaving symbol position at desired " + desiredPosition + ", since this was an adjustment market order."); } if (debug) { log.Debug("Skipping logical fill for an adjustment market order."); } if (debug) { log.Debug("Performing extra compare."); } lock ( performCompareLocker) { PerformCompareInternal(); } TryRemovePhysicalFill(physical); return; } if (debug) { log.Debug("Fill price: " + fill); } ProcessFill(fill, isCompletePhysicalFill); }
public abstract void OnPhysicalFill(PhysicalFill fill, CreateOrChangeOrder order);
public void ProcessFill(PhysicalFill fill) { }