4

I read the guide about watching for incoming payments, but trades on the distributed exchange don't show up as payments (this makes sense). So, I've been looking through the available RequestBuilder classes.

The OffersRequestBuilder seems like it only displays active offers. So once an order is "filled" it simply disappears. Do I need to store the offer ID and loop through active offers to check if it still exists?

I also noticed that there is no .stream() method for OffersRequestBuilder (like the PaymentsRequestBuilder has).

4

The OffersRequestBuilder seems like it only displays active offers. So once an order is "filled" it simply disappears. Do I need to store the offer ID and loop through active offers to check if it still exists?

Yes, that's the only way so far.

Effects Offer Created, Offer Updated, Offer Removed are described in API docs, but not yielded by the Horizon. Check the bug description for more details.

  • 1
    So I'll need to get the full length of the offers list with offers.getRecords().size(), loop through each entry, use getId() on each entry and compare it with my offer bid, and at the end of this if I don't find an ID match it means my offer was taken? – jonbon Feb 5 '18 at 12:42
  • Exactly. But don't forget about paging. Horizon allows fetching up to 200 records at a time(limit parameter). So if account has more than 200 active offers you have to fetch one more page. – Orbit Lens Feb 5 '18 at 13:14
  • 1
    Thanks :) Bummer is I spent like 30 minutes trying to find a offers.getRecords().getEntryWithId(id) because I assumed it existed. – jonbon Feb 5 '18 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.