Git Product home page Git Product logo

lightmatchingengine's Issues

Support more order types

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:

  • Stop-Limit Order
  • Stop Market order
  • Trailing Stop Order
  • Post Only Order
  • Limit TP/SL Order (Strategy Order)

I believe that incorporating these order types would significantly increase the usefulness of the project.
Are there any plans to add these features?

No possibility of viewing the state of the book + doesn't seem to consume orders

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.

testBook.TXT

Any material on simulating the order matching

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 !

Bid orders with leaves_qty < 1e-09 not removed from book, results in unexpected behavior

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:

[Question] How to persist the Orderbook state between the API requests?

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

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.