Beispiel #1
0
        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))));
        }
Beispiel #2
0
 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));
 }