Java clojure naive matching engine
Clojure Java Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


The purpose of this project is to compare/contrast java and clojure implementations of naive matching (stock) price engine.

Expected hyposis is that:

  1. java implementation should be a bit faster (2-9 times)
  2. clojure implementation should be much shorter and modular

Project structure

  • bin - fat jars for the implementations
  • jcmec - clojure implementation
    • builds with leiningen
    • uses ring (jetty 6x), moustache
  • jcmegen - clojure client that generates input, calls into web service/s, verifies and prints results
  • jcmej - java implementation
    • builds with maven
    • uses CXF (jetty 7x)
  • - bash script that builds the implementations
  • - bash script wrapper that invokes and then
  • config.clj - input configuration in clojure reader compatible format
  • - this file
  • run.bat - Windows version of
  • - invokes main of jcmegen against pre-build jars in bin

Matching engine requirements

  1. REST JSON interface
    • POST /match
      • json: orderId (B|S plus sequence number), price
    • GET /max/B|S
    • GET /results
    • GET /reset
  2. Support concurrent requests for match and get max buy and sell price.
  3. Return unmatched items.
  4. Reset internal state so matching session can be repeated.

To run

./ || run.bat

To build and run (if you made changes)

Make sure maven and leiningen are installed and on the PATH ./

Todo List

  1. Port the rest of bash scripts to Windows bat
  2. Implement scala version
  3. Implement haskell version
  4. Collect run statistics: jcmegen will call into public web app which will store and report on run statistics.


Copyright (C) 2011 Vitaly Peressada

Distributed under the Eclipse Public License, the same as Clojure.