@Override public List<OpenOrder> getOpenOrders(Symbol symbol, OrderType orderType) { List<OpenOrder> openOrders = new ArrayList<OpenOrder>(openOrdersById.size()); for (OpenOrder o : openOrdersById.values()) { if ((symbol == null || symbol.equals(o.getSymbol())) && (orderType == null || orderType.equals(o.getType()))) { openOrders.add(o); } } return openOrders; }
@Override public OpenOrder getOpenOrder(Symbol symbol, OrderType orderType) { if (symbol == null) { throw new IllegalArgumentException("Symbol cannot be null"); } if (orderType == null) { throw new IllegalArgumentException("OrderType cannot be null"); } for (OpenOrder o : openOrdersById.values()) { if (symbol.equals(o.getSymbol()) && orderType.equals(o.getType())) { return o; } } return null; }