private void HitExecutedOrder(Order order, Quotation quotation) { OrderHitStatus status = order.HitAutoClosePrice(quotation, MarketManager.Now); Transaction closeTran = null; if (status == OrderHitStatus.ToAutoLimitClose) { closeTran = this.CloseByLimit(order); } else if (status == OrderHitStatus.ToAutoStopClose) { closeTran = this.CloseByStop(order); } if (closeTran != null) { iExchangeEngine.Default.Execute(new OrderExecuteEventArgs(ExecuteContext.CreateExecuteDirectly(closeTran.Owner.Id, closeTran.Id, ExecuteStatus.Filled))); } }
internal OrderHitStatus HitPlacedOrder(Order order, Quotation quotation, bool ignoreHitTimes = false) { OrderHitStatus status = order.HitSetPrice(quotation, ignoreHitTimes, MarketManager.Now); if (status != OrderHitStatus.None) { order.IsHitReseted = false; order.Owner.Owner.SaveAndBroadcastChanges(); } if (status == OrderHitStatus.Hit && order.Owner.OrderType == OrderType.Limit) { _account.AddPendingConfirmLimitOrder(order); } else if (status == OrderHitStatus.ToAutoFill) { this.AutoFillOrder(order); } return(status); }
internal static bool IsFinal(this OrderHitStatus status) { return(!status.IsPending()); }
internal static bool IsPending(this OrderHitStatus status) { return(status == OrderHitStatus.None || status == OrderHitStatus.Hit); }