IBLevel1QuoteProcessor extends IBQuoteProcessor<Level1QuoteData> { protected void processTickSize(Level1QuoteData data) { QuoteType quoteType; Ticker ticker = data.getTicker(); int size = data.getSize(); quoteType = IbUtils.getQuoteType(data.getField()); if (quoteType == null || quoteType == QuoteType.UNKNOWN) { return; } if (ticker instanceof StockTicker) { size = size * 100; } BigDecimal formattedValue = QuoteUtil.getBigDecimalValue(size); processQuote(ticker, quoteType, formattedValue); } IBLevel1QuoteProcessor(BlockingQueue<Level1QuoteData> queue, IQuoteEngine quoteEngine);   }
@Test public void testProcessTickSize_unknownQuoteType() { MockIBLevel1QuoteProcessor processor = buildMockQuoteProcessor(false, false); Level1QuoteData data = new Level1QuoteData(null, 99, 0, 0, 10); processor.processTickSize(data); assertFalse(processor.processQuoteCalled); }
@Test public void testProcessTickSize_StockTicker() { MockIBLevel1QuoteProcessor processor = buildMockQuoteProcessor(false, false); int size = 10; Level1QuoteData data = new Level1QuoteData(new StockTicker("QQQ"), 0, 0, 0, size); processor.processTickSize(data); BigDecimal formattedValue = QuoteUtil.getBigDecimalValue(size * 100); assertEquals(formattedValue, processor.formattedValue); }
@Test public void testProcessTickSize_NonStockTicker() { MockIBLevel1QuoteProcessor processor = buildMockQuoteProcessor(false, false); int size = 10; Level1QuoteData data = new Level1QuoteData(new CurrencyTicker(), 0, 0, 0, size); processor.processTickSize(data); BigDecimal formattedValue = QuoteUtil.getBigDecimalValue(size); assertEquals(formattedValue, processor.formattedValue); }