IntradayTradingStrategy implements OrderEventListener, BrokerErrorListener, RealtimeBarListener { protected void initProps(String filename) { try { IntradaySystemProperties props = new IntradaySystemProperties(filename); ibHost = props.getTwsHost(); ibPort = props.getTwsPort(); ibClientId = props.getTwsClientId(); orderSizeInDollars = props.getTradeSizeDollars(); systemStartTime = props.getSystemStartTime(); longStartTime = props.getLongStartTime(); longStopTime = props.getLongStopTime(); longCloseTime = props.getLongExitTime(); shortStartTime = props.getShortStartTime(); shortStopTime = props.getShortStopTime(); shortCloseTime = props.getShortExitTime(); strategyDirectory = props.getStrategyDirectory(); mainTicker = new StockTicker(props.getTicker()); logger.info("Loaded properties: " + props); } catch (IOException ex) { throw new IllegalStateException(ex); } }  void start(String propFile); @Override void realtimeBarReceived(int requestId, Ticker ticker, BarData bar); synchronized void placeOrder(Ticker ticker, TradeDirection direction, int size, LocalTime closeTime); @Override void orderEvent(OrderEvent event); @Override void brokerErrorFired(BrokerError error); static void main(String[] args);  }
@Test public void testInitProps() throws Exception { File file = new File( getClass().getResource("/intraday.test.properties").toURI() ); String path = file.getAbsolutePath(); strategy.initProps(path); assertEquals( "localhost", strategy.ibHost ); assertEquals( 10, strategy.ibClientId ); assertEquals( 9999, strategy.ibPort ); assertEquals( 1000, strategy.orderSizeInDollars ); assertEquals( LocalTime.of(5, 37, 0), strategy.systemStartTime ); assertEquals( LocalTime.of(5,38,0), strategy.longStartTime); assertEquals( LocalTime.of(5,39,0), strategy.longStopTime); assertEquals( LocalTime.of(5,40,0), strategy.longCloseTime); assertEquals( LocalTime.of(5,41,0), strategy.shortStartTime); assertEquals( LocalTime.of(5,42,0), strategy.shortStopTime); assertEquals( LocalTime.of(5,43,0), strategy.shortCloseTime); assertEquals("/my/dir", strategy.strategyDirectory); assertEquals( new StockTicker("XYZ"), strategy.mainTicker); }