EODTradingStrategy implements Level1QuoteListener, OrderEventListener, BrokerErrorListener { protected void initProps(String filename) { try { EODSystemProperties props = new EODSystemProperties(filename); ibHost = props.getTwsHost(); ibPort = props.getTwsPort(); ibClientId = props.getTwsClientId(); orderSizeInDollars = props.getTradeSizeDollars(); timeToPlaceOrders = props.getStartTime(); marketCloseTime = props.getMarketCloseTime(); exitTime = props.getExitTime(); Map<String,String> tickers = props.getLongShortTickerMap(); strategyDirectory = props.getStrategyDirectory(); tickers.keySet().stream().forEach((ticker) -> { longShortPairMap.put( new StockTicker(ticker), new StockTicker(tickers.get(ticker))); }); entryOrderType = props.getEntryOrderType(); exitOrderType = props.getExitOrderType(); exitSeconds = props.getExitSeconds(); logger.info("Loaded properties: " + props); } catch( IOException ex ) { throw new IllegalStateException(ex); } }  void start(String propFile); synchronized void placeMOCOrders(Ticker longTicker, Ticker shortTicker, ZonedDateTime lastReportedTime); @Override void orderEvent(OrderEvent event); @Override void quoteRecieved(ILevel1Quote quote); ZonedDateTime getNextBusinessDay(ZonedDateTime date); @Override void brokerErrorFired(BrokerError error); static void main(String[] args);  }
@Test public void testInitProps() { strategy.initProps(propFile); assertEquals("localhost", strategy.ibHost); assertEquals(7999, strategy.ibPort); assertEquals(1, strategy.ibClientId); assertEquals(1000, strategy.orderSizeInDollars); assertEquals(LocalTime.of(12, 40), strategy.timeToPlaceOrders); assertEquals(LocalTime.of(13,0), strategy.marketCloseTime); assertEquals(LocalTime.of(6,30,2), strategy.exitTime); assertEquals(2, strategy.longShortPairMap.size()); assertEquals(new StockTicker("SPY"), strategy.longShortPairMap.get(new StockTicker("QQQ"))); assertEquals(new StockTicker("IWM"), strategy.longShortPairMap.get(new StockTicker("DIA"))); assertEquals("/some/test/dir/", strategy.strategyDirectory); assertEquals(TradeOrder.Type.MARKET_ON_CLOSE, strategy.entryOrderType); assertEquals(TradeOrder.Type.MARKET, strategy.exitOrderType); assertEquals(3, strategy.exitSeconds); }