@Test public void test_fill_on_bar(){ config.fillOnBarMode = SimulatorConfig.FillOnBarMode.LastBarClose; handler.process(order, bar); verify(executor, times(1)).execute(order, bar.close, order.ordQty); reset(executor); config.fillOnBarMode = SimulatorConfig.FillOnBarMode.NextBarOpen; handler.process(order, bar); verify(executor, times(1)).execute(order, bar.open, order.ordQty); reset(executor); config.fillOnBarMode = SimulatorConfig.FillOnBarMode.NextBarClose; handler.process(order, bar); verify(executor, times(1)).execute(order, bar.close, order.ordQty); reset(executor); order.side = Side.Sell; config.fillOnBarMode = SimulatorConfig.FillOnBarMode.NextBarClose; handler.process(order, bar); verify(executor, times(1)).execute(order, bar.close, order.ordQty); }
@Override public boolean process(Order order, Quote quote) { if (quote != null) { double price = quoteProcessor.getPrice(order, quote, config); double qty = quoteProcessor.getQty(order, quote, config); return simulationExecutor.execute(order, price, qty); } return false; }
MarketOrderHandler extends OrderHandler { @Override public boolean process(Order order, Quote quote) { if (quote != null) { double price = quoteProcessor.getPrice(order, quote, config); double qty = quoteProcessor.getQty(order, quote, config); return simulationExecutor.execute(order, price, qty); } return false; } }
MarketOrderHandler extends OrderHandler { @Override public boolean process(Order order, Quote quote) { if (quote != null) { double price = quoteProcessor.getPrice(order, quote, config); double qty = quoteProcessor.getQty(order, quote, config); return simulationExecutor.execute(order, price, qty); } return false; } MarketOrderHandler(SimulatorConfig config, SimulationExecutor simulationExecutor); }
MarketOrderHandler extends OrderHandler { @Override public boolean process(Order order, Quote quote) { if (quote != null) { double price = quoteProcessor.getPrice(order, quote, config); double qty = quoteProcessor.getQty(order, quote, config); return simulationExecutor.execute(order, price, qty); } return false; } MarketOrderHandler(SimulatorConfig config, SimulationExecutor simulationExecutor); @Override boolean process(Order order, Quote quote); @Override boolean process(Order order, Trade trade); @Override boolean process(Order order, Bar bar); @Override boolean process(Order order, double price, double qty); }
MarketOrderHandler extends OrderHandler { @Override public boolean process(Order order, Quote quote) { if (quote != null) { double price = quoteProcessor.getPrice(order, quote, config); double qty = quoteProcessor.getQty(order, quote, config); return simulationExecutor.execute(order, price, qty); } return false; } MarketOrderHandler(SimulatorConfig config, SimulationExecutor simulationExecutor); @Override boolean process(Order order, Quote quote); @Override boolean process(Order order, Trade trade); @Override boolean process(Order order, Bar bar); @Override boolean process(Order order, double price, double qty);  }