Coder Social home page Coder Social logo

cjustas / quantcup-orderbook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ajtulloch/quantcup-orderbook

0.0 2.0 0.0 496 KB

Fast C++ adaptation of the QuantCup (http://www.quantcup.org/) limit order book.

CMake 0.04% Makefile 0.01% C++ 1.82% Objective-C 98.13%

quantcup-orderbook's Introduction

QuantCup limit order book in C++

Matching Engine in C++

This is an implementation of the limit order matching engine interface from the QuantCup problem.

The winning implementation was a classic C implementation - hand-coded intrusive linked lists, global variables, etc.

I wanted to see if it was possible to reimplement this in C++ with heavy usage of C++ STL and Boost libraries to reduce the amount of code used, to reduce the amount of code, not hand-roll our own data structures, etc. It seemed an interesting question to see if such a solution could be as fast as the highly-tuned C implementation.

Files

Relevant files are

  • order_book.cpp
  • order_book.h
  • constants.h
  • types.h

The rest is provided by the QuantCup competition.

Performance

On my 2.4 GHz Intel i7, there is no statistically signficant difference between the winning C implementation and the C++ implementation. The C++ implementation is significantly cleaner (eschewing global variables, using boost::intrusive for our linked list implementation, etc).

Replication

To replicate these results, just run:

$ git checkout winning-cpp-engine
$ make build && build/test && for i in {1..10}; do echo $i && \
build/score 2>&1 | tail -n1 | cut -d ' ' -f 3; done

$ git checkout winning-c-engine
$ make build && build/test && for i in {1..10}; do echo $i && \
build/score 2>&1 | tail -n1 | cut -d ' ' -f 3; done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.