Rs
Module 13Order BookLesson 2 of 728 min

Mini Limit Order Book

Implement Book with add_bid/ask and BBO.

Implement

Struct with bids/asks BTreeMaps; methods for BBO, mid, spread.

Challenge

Reject crossing adds with Result.

Tips
  • next_back best bid
  • Validate cross
  • Levels aggregate size

Try it live

Mini Limit Order BookRust 2021
Loading editor…
Output
Press Run to compile and execute.