gavincyi / lightmatchingengine Goto Github PK
View Code? Open in Web Editor NEWA very light matching engine in Python.
License: MIT License
A very light matching engine in Python.
License: MIT License
Hi,
I've been using the project and have found it to be a valuable tool for learning & even real projects. However, I noticed that the current version does not support most order types such as:
I believe that incorporating these order types would significantly increase the usefulness of the project.
Are there any plans to add these features?
Either remove the side or validate the side
See attached code. I wrote some simple code that displays the prices and quantities currently available on the book. When I submit a new order that should consume the other side (I buy 500 at the price of the ask), it doesn't seem to do so, although the resulting trade execution is properly recorded. That is, when I view the book after that, I still have 1500 offered on the ask, even though in theory I should have only 1000 left.
Hi, thanks for sharing this cool Repo, I found it quite useful in practice.
I would like to ask that whether there is any good material on introducing the order matching algorithms publicly available? I find details lying behind a matching engine quite complex, and I want to have a better understanding on order matching to facilitate my research.
Looking forward to your reply, thanks !
In some unexpected cases LightMatchingEngine gives the following error:
"Match quantity must be larger than zero"
The problem occurs sometimes due to float arithmetic with small quantities.
Because of this the leaves_qty of an order can become smaller than the 1e-9 threshold.
As the checking code in lightmatchingengine.pyx is different for bids than for asks, trying to clear the order with a leaves_qty < 1e-9 is impossible.
To fix this, the leaves_qty and match_qty bid side code in lightmatchingengine.pyx should be made consistent with the ask side code.
110 assert match_qty > 0, "Match quantity must be larger than zero"
Should become
110 assert match_qty >= 1e-9, "Match quantity must be larger than zero"
And
144 if order.leaves_qty > 0.0:
Should become
144 if order.leaves_qty >= 1e-9:
Why is there no user ID, how to settle accounts for buyers and sellers after matchmaking?
Totally new to Python, but having read the code I've got the impression it's just the simple matching engine which can be run by long-running process which keeps the order book in-memory and reads the orders from the queue. Is there any way to persist its state in-memory between subsequent API requests? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.