IbUtils { public static BigDecimal getIbMultiplier( Ticker ticker ) { if( ticker instanceof FuturesTicker ) { FuturesTicker futuresTicker = (FuturesTicker) ticker; switch( futuresTicker.getSymbol() ) { case "ZC": case "ZS": case "ZW": return new BigDecimal( 5000 ); default: return ticker.getContractMultiplier(); } } return ticker.getContractMultiplier(); }  static String translateToIbFuturesSymbol(String symbol); static String getOrderType(TradeOrder.Type orderType); static String getTif(TradeOrder.Duration duration); static String getSecurityType(InstrumentType instrumentType); static String getAction(TradeDirection direction); static QuoteType getQuoteType(int field); static OrderStatus.Status getOrderStatus(String status); static String getExpiryString(int expiryMonth, int expiryYear); static String getExpiryString(int expiryDay, int expiryMonth, int expiryYear); static String getOptionRight( OptionTicker.Right right ); static Image getIconImage(); static BigDecimal getIbMultiplier( Ticker ticker ); static Vector<TagValue> getDefaultTagVector(); static List<TagValue> getDefaultTagList();  }
@Test public void testGetContractMultiplier() { FuturesTicker ticker = new FuturesTicker(); ticker.setSymbol("ZC"); ticker.setContractMultiplier(new BigDecimal(50.0)); assertEquals(new BigDecimal(5000.0), IbUtils.getIbMultiplier(ticker)); ticker.setSymbol("ZS"); assertEquals(new BigDecimal(5000.0), IbUtils.getIbMultiplier(ticker)); ticker.setSymbol("ZW"); assertEquals(new BigDecimal(5000.0), IbUtils.getIbMultiplier(ticker)); ticker.setSymbol("HG"); assertEquals(new BigDecimal(50.0), IbUtils.getIbMultiplier(ticker)); }
@Test public void testGetContractMultiplier_NullMultiplier() { FuturesTicker ticker = new FuturesTicker(); ticker.setSymbol("HG"); assertNull(IbUtils.getIbMultiplier(ticker)); }