project-serum/serum-dex

Add public API to iterate over L2/L3 data

tommyip opened this issue · 2 comments

Currently the serum_dex crate does not expose any public API to iterate over the order book. It is possible to do it by repeatedly calling find_min/max() and remove_by_key() on the slap as it is done by the matching engine, but this depends on implementation detail and require unnecessary mutation.

I saw that the serum-ts library exposes a slab.items() generator as well as a getL2 method. Can we add a similar functionality to the Rust crate?

I can implement it if the request is approved.

I would love to see an example to get a proper order book struct starting with currents load_bids_mut.

100% me too.