C2Util { public static OrderType getOrderType( TradeOrder order ) { if( order.getType() == TradeOrder.Type.MARKET || order.getType() == TradeOrder.Type.MARKET_ON_OPEN ) { return OrderType.MARKET; } else if( order.getType() == TradeOrder.Type.LIMIT ) { return OrderType.LIMIT; } else if( order.getType() == TradeOrder.Type.STOP ) { return OrderType.STOP; } else { throw new SumZeroException("Unsupported order type: " + order.getType()); } }  static String getFuturesSymbol(FuturesTicker ticker); static Action getTradeAction( TradeOrder order ); static SymbolType getSymbolType( TradeOrder order ); static OrderType getOrderType( TradeOrder order ); static String getC2RootSymbol(String symbol); static String getTime( ZonedDateTime zonedTime ); static final String ROOT_SYMBOL_RUSSEL2K_NYBOT; static final String ROOT_SYMBOL_RUSSEL2K_GLOBEX; static final String ROOT_SYMBOL_NASDAQ_100; static final String ROOT_SYMBOL_MINI_DOW; static final String ROOT_SYMBOL_SP500; static final String ROOT_SYMBOL_CORN; }
@Test public void testGetOrderType() { TradeOrder order = new TradeOrder(); order.setType(TradeOrder.Type.STOP); assertEquals(SignalInfo.OrderType.STOP, C2Util.getOrderType(order)); order.setType(TradeOrder.Type.LIMIT); assertEquals(SignalInfo.OrderType.LIMIT, C2Util.getOrderType(order)); order.setType(TradeOrder.Type.MARKET); assertEquals(SignalInfo.OrderType.MARKET, C2Util.getOrderType(order)); order.setType(TradeOrder.Type.MARKET_ON_OPEN); assertEquals(SignalInfo.OrderType.MARKET, C2Util.getOrderType(order)); try { order.setType(TradeOrder.Type.MARKET_ON_CLOSE); C2Util.getOrderType(order); fail(); } catch( Exception ex ) { } }