IbUtils { public static String getOrderType(TradeOrder.Type orderType) { if (null != orderType) { switch (orderType) { case LIMIT: return "LMT"; case MARKET: return "MKT"; case STOP: return "STP"; case MARKET_ON_CLOSE: return "MOC"; case MARKET_ON_OPEN: return "MKT"; default: throw new IllegalStateException("Unknown order type: " + orderType); } }else { throw new IllegalStateException("Unknown order type: " + orderType); } }  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 testGetOrderType() { TradeOrder.Type[] values = TradeOrder.Type.values(); for (TradeOrder.Type value : values) { assertNotNull(IbUtils.getOrderType(value)); } assertEquals("MKT", IbUtils.getOrderType(TradeOrder.Type.MARKET)); assertEquals("LMT", IbUtils.getOrderType(TradeOrder.Type.LIMIT)); assertEquals("STP", IbUtils.getOrderType(TradeOrder.Type.STOP)); assertEquals("MKT", IbUtils.getOrderType(TradeOrder.Type.MARKET_ON_OPEN)); assertEquals("MOC", IbUtils.getOrderType(TradeOrder.Type.MARKET_ON_CLOSE)); try { IbUtils.getOrderType(null); fail(); } catch (IllegalStateException ex) { } }