Skip to content

Blazing fast C++ limit order book matching engine

License

Notifications You must be signed in to change notification settings

Junyang-chen/liquibook

 
 

Repository files navigation

liquibook

Open source limit order book matching engine from OCI

Features

  • Low-level components for order matching and aggregate depth tracking
  • Memory-efficiency: minimal copying of data to internal structures
  • Speed: between 2.0 million and 2.5 million inserts per second. See full performance history.

Flexibility

  • Optional aggregate depth tracking to any number of levels (static) or BBO only
  • Works with smart or regular pointers

Works with Your Design

  • Preserves your order model, requiring only trivial interface
  • Preserves your identifiers for securities, accounts, exchanges, orders, fills
  • Use your threading system (or be single-threaded)
  • Use your synchronization method

Minimal Example

  // Create type-specific order book
  book::OrderBook<MyOrder*> order_book;

  // Attach desired event handler(s)
  order_book.set_order_listener(&listener);

  // Create order - my Order class, not Liquibook's!
  MyOrder* order = new MyOrder();

  // Add the order to the order book
  order_book.add(order);

  // Trigger event handlers
  order_book.perform_callbacks();

Build Dependencies

  • MPC for cross-platform builds
  • Assertiv for unit testing
  • BOOST (optional) for shared pointer unit testing only

Submodule Note

Assertiv is included as a submodule. After cloning liquibook, you must:

> cd liquibook
> git submodule init
> git submodule update

Linux Build Notes

Make sure the $BOOST_ROOT and $MPC_ROOT environment variables are set, then open a shell

$ cd liquibook
$ . env.sh
$ mwc.pl -type make liquibook.mwc
$ make depend
$ make all

If you don't have readlink, set the $LIQUIBOOK_ROOT environment variable before running env.sh

Windows Build Notes

Use the following commands to set up the build environment and create Visual Studio project and solution files. Note if you are using MinGW or other linux-on-Windows techniques, follow the Linux instructions; however, OCI does not normally test this.

> cd liquibook
> copy winenv.bat wenv.bat #optional if you want to keep the original
> edit wenv.bat  #edit is your choice of text editor
                 # follow the instructions in the file itself.
> wenv.bat       # sets and verifies environment variables
> mwc.bat        # generate the visual studio solution and project files.

Then in the same window, start Visual Studio from the command line, opening liquibook.sln

> liquibook.sln

If Windows does not recognize the *.sln file extension as belonging to VisualStudio, you may need to provide the path to Visual Studio.

This example is the Visual Studio 2010 Express Edition:

> "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" liquibook.sln

For any platform

See other build notes.

About

Blazing fast C++ limit order book matching engine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 88.7%
  • HTML 8.4%
  • Batchfile 1.6%
  • Other 1.3%