ai-tools 🤖
A collection of local AI-driven unix-style tools
A minimalistic functional programming language
minima 🏔️
An ultra-minimalistic Linux distribution built from scratch in Rust!
400k orders per second at a 2.5 μs (avg.) latency order matching engine in python
License: MIT License
Hello
I need an open source maching engine that can process sales orders that are placed in the database through the app, that is, I can finally create something like a binance.
Please advise that this engine of yours can run alongside my app? For example, the membership and wallet sections should be deposited or withdrawn in the my app, and only the trading section should be run in this maching engine?
Hi,
thank you for developing and sharing this matching engine.
I tested your engine and noticed that it does not add up the volumes in the order book for orders with the same price. The order book simply lists them one below the other. But usually such orders are registered in the order book as a single order with an accumulated volume.
These lines could be made into a generator to increase readability.
By using a sorted dictionary the same sorted quality would exist, but with the added benefit of being able to cancel an order in O(log(n)) (sortedcontainers have that time complexity for deletion for some reason...)
From http://www.grantjenks.com/docs/sortedcontainers/_modules/sortedcontainers/sorteddict.html
def __delitem__(self, key):
"""Remove item from sorted dict identified by `key`.
``sd.__delitem__(key)`` <==> ``del sd[key]``
Runtime complexity: `O(log(n))` -- approximate.
>>> sd = SortedDict({'a': 1, 'b': 2, 'c': 3})
>>> del sd['b']
>>> sd
SortedDict({'a': 1, 'c': 3})
>>> del sd['z']
Traceback (most recent call last):
...
KeyError: 'z'
:param key: `key` for item lookup
:raises KeyError: if key not found
"""
self._dict_delitem(key)
self._list_remove(key)
Currently I believe it is O(nLog(n)):
for order in self.bids:
if incomingOrder.order_id == order.order_id:
self.bids.discard(order)
break
I'm not sure, but it seems to me something could be wrong with the sorting of orders in the orderbook or with your trade processOrder function. I tried the following exactly in this sequence:
1- limit order (side=sell, size=5, price=105)
2- limit order (side=sell, size=5, price=106)
and then
3- limit order (side=buy, size=1, price=105)
... but no trade took place!
The orderbook just added the lasd buy order to its content!
A trade would takes place, if I buy (for example size=1 and) price=106 and matches with the second order, but the first limit sell order with lower ask price (105) should have priority in this case.
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.