IbUtils { public static String getTif(TradeOrder.Duration duration) { if( duration == null ) { return "DAY"; } switch (duration) { case DAY: return "DAY"; case GOOD_UNTIL_CANCELED: return "GTC"; case GOOD_UTNIL_TIME: return "GTD"; case FILL_OR_KILL: return "IOC"; case MARKET_ON_OPEN: return "OPG"; default: throw new IllegalStateException("Unknown duration: " + duration); } }  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 testGetTif() { TradeOrder.Duration[] values = TradeOrder.Duration.values(); for (TradeOrder.Duration value : values) { assertNotNull(IbUtils.getTif(value)); } assertEquals("DAY", IbUtils.getTif(TradeOrder.Duration.DAY)); assertEquals("GTC", IbUtils.getTif(TradeOrder.Duration.GOOD_UNTIL_CANCELED)); assertEquals("IOC", IbUtils.getTif(TradeOrder.Duration.FILL_OR_KILL)); assertEquals("GTD", IbUtils.getTif(TradeOrder.Duration.GOOD_UTNIL_TIME)); assertEquals("OPG", IbUtils.getTif(TradeOrder.Duration.MARKET_ON_OPEN)); assertEquals("DAY", IbUtils.getTif(null)); }