Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckPrice (Subsribe to order book) doesn't work ? #79

Open
inmyth opened this issue May 19, 2017 · 4 comments
Open

CheckPrice (Subsribe to order book) doesn't work ? #79

inmyth opened this issue May 19, 2017 · 4 comments

Comments

@inmyth
Copy link

inmyth commented May 19, 2017

To see this problem simply run CheckPrice with already embedded Bitstamp address.
The result is empty and it looks like Response.OnResponse callback is never called.
When tested with Ripple's websocket tool, you can see that Bitstamp is pretty busy. At the very least BTC/USD and USD/XRP should always have activities.

@inmyth
Copy link
Author

inmyth commented May 19, 2017

So it's not that it doesn't return anything but if it returns too many items, the callback won't be called. One quiet trade to test this on is Bitstamp XRP/JPY (will definitely change) with

Request request =c.subscribeBookOffers(Issue.XRP, Issue.fromString("JPY/rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"));
request.on(Request.OnSuccess.class, new Request.OnSuccess() {

    @Override
    public void called(Response response) {
                if (response.succeeded) {
                    JSONArray offersJSON = response.result.optJSONArray("offers");
                    STArray offers = STArray.translate.fromJSONArray(offersJSON);
                    //etc
		}             
        });
request.request();

It's also unclear if subscribe to book offer like this will listen (subscribe) to a stream or just be one-shot request which immediately returns.

@sublimator
Copy link
Contributor

I'm not sure what's going on there, as I don't use ripple(-lib-java)? very much these days. My guess is that subscribing to the orders books, and getting the subscriptions works fine, due to the implementation happening to always (last I looked) write to all connected subscribers on ledger close. The requests on the other hand, have to go into the Job Queue and with the network currently having some troubles (I saw a rippled issue) there may not ever be a response ...

Actually, I tried a simple account_tx request the other day, and I never got a response and the logging showed warnings of requests timing out.

Try the the "book_offers" command via the WebSocket tool and see if you can get a timely response.

@sublimator
Copy link
Contributor

@sublimator
Copy link
Contributor

It's also unclear if subscribe to book offer like this will listen (subscribe) to a stream or just be one-shot request which immediately returns.

It only makes the request. You'll have to do a separate request and use client.on(Client.OnMessage.class, ... ) and check for the correct message type etc and handle accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants