MatchingEngine
A mini matching engine in progress
Install / Use
/learn @luo4neck/MatchingEngineREADME
Mini Matching Engine
This is a mini trading order matching engine for Unix like platform.
Matching rule is simple: the earlier sent order will be traded earlier if the prices could be matched (buy price not lower than sell price).
Unit test is handled by Makefile.
Requirements:
- C++11
- clang 3.5 / gcc 4.8 or newer
Compiling And Testing:
To compile:
$ make
To run all unit test cases:
$ make test
Unit test cases for functionality of BUY, SELL, MODIFY, CANCEL, PRINT and Large Scale Test:
$ make testbuy
$ make testsell
$ make testmodify
$ make testcancel
$ make testprint
$ make testlarge or $ make testlarge TLV=x (the amount of large scale test could be set with x or left as default value of 50)
Supported Commands:
Could take 5 kinds of input from stdin, formats listed below:
1, BUY ORDER_TYPE QUANTITY PRICE ORDER_ID; e.g. 'BUY GFD 300 32 u5d12t9'.
2, SELL ORDER_TYPE QUANTITY PRICE ORDER_ID; e.g. 'SELL IOC 300 31 78wehyw'.
3, MODIFY ORDER_ID OPERATION_TYPE QUANTITY PRICE; e.g. 'MODIFY 1d81st2 BUY 200 18'.
4, CANCEL ORDER_ID; e.g. 'CANCEL 5z81f72a'.
5, PRINT; no other parameter.
There are 2 ORDER_TYPE, IOC and GFD:
IOC order (Immediate or Cancel) will not be added to sell/buy list if it was not completely traded.
GFD order (Good For Day) will be added to sell/buy list if it was not completely traded.
Order could be partially traded or completely traded. Once a pair of orders (one sell and one buy) got traded, a message will be printed like the following format.
TRADE s151h23 1000 20 7sdfa91 1002 20
License:
See the License file for details.
//todo dependency issue
Jan 2017 @Dublin Ireland
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.2kCommit, push, and open a PR
