@Test public void testGetLimitOrders(){ try { mWebSocket.addListener(new GetLimitOrders(base.getObjectId(), quote.getObjectId(), 100, new WitnessResponseListener() { @Override public void onSuccess(WitnessResponse response) { List<LimitOrder> orders = (List<LimitOrder>) response.result; Assert.assertThat("Checking that we have orders", orders.isEmpty(), is(false)); Converter converter = new Converter(); double baseToQuoteExchange, quoteToBaseExchange; for(LimitOrder order : orders){ if(order.getSellPrice().base.getAsset().getObjectId().equals(base.getObjectId())){ order.getSellPrice().base.getAsset().setPrecision(base.getPrecision()); order.getSellPrice().quote.getAsset().setPrecision(quote.getPrecision()); baseToQuoteExchange = converter.getConversionRate(order.getSellPrice(), Converter.BASE_TO_QUOTE); quoteToBaseExchange = converter.getConversionRate(order.getSellPrice(), Converter.QUOTE_TO_BASE); System.out.println(String.format("> id: %s, base to quote: %.5f, quote to base: %.5f", order.getObjectId(), baseToQuoteExchange, quoteToBaseExchange)); }else{ order.getSellPrice().base.getAsset().setPrecision(quote.getPrecision()); order.getSellPrice().quote.getAsset().setPrecision(base.getPrecision()); baseToQuoteExchange = converter.getConversionRate(order.getSellPrice(), Converter.BASE_TO_QUOTE); quoteToBaseExchange = converter.getConversionRate(order.getSellPrice(), Converter.QUOTE_TO_BASE); System.out.println(String.format("< id: %s, base to quote: %.5f, quote to base: %.5f", order.getObjectId(), baseToQuoteExchange, quoteToBaseExchange)); } } synchronized (GetLimitOrdersTest.this){ GetLimitOrdersTest.this.notifyAll(); } } @Override public void onError(BaseResponse.Error error) { System.out.println("onError. Msg: "+error.message); synchronized (GetLimitOrdersTest.this){ GetLimitOrdersTest.this.notifyAll(); } } })); mWebSocket.connect(); synchronized (this){ wait(); } } catch (WebSocketException e) { System.out.println("WebSocketException. Msg: " + e.getMessage()); } catch (InterruptedException e) { System.out.println("InterruptedException. Msg: "+e.getMessage()); } }
public GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener) { super(listener); this.a = a; this.b = b; this.limit = limit; this.mOneTime = oneTime; this.mListener = listener; }
GetLimitOrders extends BaseGrapheneHandler { public GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener) { super(listener); this.a = a; this.b = b; this.limit = limit; this.mOneTime = oneTime; this.mListener = listener; } }
GetLimitOrders extends BaseGrapheneHandler { public GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener) { super(listener); this.a = a; this.b = b; this.limit = limit; this.mOneTime = oneTime; this.mListener = listener; } GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener);  GetLimitOrders(String a, String b, int limit, WitnessResponseListener listener); }
GetLimitOrders extends BaseGrapheneHandler { public GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener) { super(listener); this.a = a; this.b = b; this.limit = limit; this.mOneTime = oneTime; this.mListener = listener; } GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener);  GetLimitOrders(String a, String b, int limit, WitnessResponseListener listener); @Override void onConnected(WebSocket websocket, Map<String, List<String>> headers); @Override void onTextFrame(WebSocket websocket, WebSocketFrame frame); @Override void onFrameSent(WebSocket websocket, WebSocketFrame frame); @Override void onError(WebSocket websocket, WebSocketException cause); @Override void handleCallbackError(WebSocket websocket, Throwable cause); }
GetLimitOrders extends BaseGrapheneHandler { public GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener) { super(listener); this.a = a; this.b = b; this.limit = limit; this.mOneTime = oneTime; this.mListener = listener; } GetLimitOrders(String a, String b, int limit, boolean oneTime, WitnessResponseListener listener);  GetLimitOrders(String a, String b, int limit, WitnessResponseListener listener); @Override void onConnected(WebSocket websocket, Map<String, List<String>> headers); @Override void onTextFrame(WebSocket websocket, WebSocketFrame frame); @Override void onFrameSent(WebSocket websocket, WebSocketFrame frame); @Override void onError(WebSocket websocket, WebSocketException cause); @Override void handleCallbackError(WebSocket websocket, Throwable cause);  }