private static bool IsHitPrice(Order order, Quotation newQuotation, Price marketPrice) { if (order.Phase != OrderPhase.Placed || (order.OrderType != OrderType.Limit && order.OrderType != OrderType.Market) || marketPrice == null) { return(false); } PriceCompareResult result = newQuotation.Compare(order.SetPrice, order.IsBuy); return(order.OrderType == OrderType.Market || (order.OrderType == OrderType.Limit && (marketPrice == order.SetPrice || (order.TradeOption == TradeOption.Better ? result == PriceCompareResult.Better : result == PriceCompareResult.Worse)))); }
private static bool ShouldUseNewHitPrice(Order order, Quotation newQuotation) { Settings.Instrument instrument = order.Instrument(); return(order.HitCount == 1 || instrument.LmtAsMit || !instrument.UseBetterPriceForCompanyWhenHit || (instrument.UseBetterPriceForCompanyWhenHit && newQuotation.Compare(order.BestPrice, order.IsBuy) == PriceCompareResult.Worse)); }