QuoteProcessor extends MarketDataProcessor<Quote> { public double getPrice(Order order, Quote quote, SimulatorConfig config) { if (quote != null) switch (order.side) { case Buy: if (quote.ask > 0) return quote.ask; break; case Sell: case SellShort: if (quote.bid > 0) return quote.bid; break; default: throw new UnsupportedOperationException("Order side is not supported : " + order.side); } return 0.0; }  double getPrice(Order order, Quote quote, SimulatorConfig config); double getQty(Order order, Quote quote, SimulatorConfig config);  }
@Test public void test_price(){ assertEquals(0.0 , processor.getPrice(order, null, null), 0.0); assertEquals(quote.ask, processor.getPrice(order, quote, null), 0.0); order.side = Side.Sell; assertEquals(quote.bid, processor.getPrice(order, quote, null), 0.0); }