Git Product home page Git Product logo

order-matcher's People

Contributors

arjunvachhani avatar dependabot[bot] avatar kordeone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

order-matcher's Issues

Logic behind triggering stop orders while _marketprice differs!

I would like to know why you limited triggering stop orders as _marketPrice changes!
I have read articles and I think the if condition for triggering them is somehow an action of fear

if (_marketPrice > previousMarketPrice)
{
    var priceLevels = _book.RemoveStopBids(_marketPrice);
    AddStopToOrderBook(priceLevels);
}
else if (_marketPrice < previousMarketPrice)
{
    var priceLevels = _book.RemoveStopAsks(_marketPrice);
    AddStopToOrderBook(priceLevels);
}

doesn't this limit when I want to sell when the price breaks a higher resistance on a better price?

Need Test method for Match 1000 to 1000

Hello, i am need method which will matched 100% and removed orders. I am not found equal and I am try write themself. Please look code.

[Fact]
public void Empty_Market_After_Match_Enters_Pending_With_Limit()
{
Order order1 = new Order { IsBuy = true, OpenQuantity = 1000, Price = 10, OrderId = 1 };
OrderMatchingResult acceptanceResult = matchingEngine.AddOrder(order1, 1);

        mockTradeListener.Verify(x => x.OnAccept(order1.OrderId));
        mockTradeListener.VerifyNoOtherCalls();
        Assert.Equal(OrderMatchingResult.OrderAccepted, acceptanceResult);
        Assert.Contains(order1, matchingEngine.CurrentOrders.Select(x => x.Value));
        Assert.Contains(order1.OrderId, matchingEngine.AcceptedOrders);
        Assert.Contains(order1, matchingEngine.Book.BidSide.SelectMany(x => x.Value));
        Assert.Single(matchingEngine.Book.BidSide);
        Assert.Empty(matchingEngine.Book.AskSide);
        Assert.Empty(matchingEngine.Book.StopAskSide);
        Assert.Empty(matchingEngine.Book.StopBidSide);
        Assert.Equal(1000, order1.OpenQuantity);
        Assert.Equal((ulong)1, order1.Sequnce);

        Order order2 = new Order { IsBuy = false, OpenQuantity = 1000, Price = 0, OrderId = 2 };
        OrderMatchingResult result2 = matchingEngine.AddOrder(order2, 2);

        mockTradeListener.Verify(x => x.OnAccept(order2.OrderId));
        mockTradeListener.Verify(x => x.OnTrade(2, 1, 10, 1000, 0, 50, 10000, 20));
        mockTradeListener.VerifyNoOtherCalls();
        
        Assert.False(matchingEngine.AcceptedOrders.Any());
    }

But i am have exception Assert.False(matchingEngine.AcceptedOrders.Any()); I think very bad when Orders not cleaned in AcceptedOrders after trading. Possible can you to check and modify behivior and include (if need renamed) in *.Tests project of source codes?

Multiple Markets

I have a question about how this engine handles multiple market orders, as I have understood the engine only processes through one market, are you planning on adding this feature?

optimize Order class so that it uses less RAM

  • OrderCondition property only required when order is entered into the system. so while adding order by calling AddOrder method if it is passed, then it does not need to required for the rest of the life of order object.

  • IsTip property is just a flag, it represents that the order is a tip of the iceberg order or not. We can have a Tip class that is inheriting Order. instead of order.IsTip can check with order is Tip

documentation

Documentation demonstrating how to integrate/use the library

Using floating point in order

Hi
How can floating-point be used in the amount of assets for buying and selling?
For example :

{ "Price": 2005, "OpenQuantity":1.50 }

have question

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?

Market order with total price

Hi
I wonder what is the best way to add market orders with total price instead of quantity.
let's say I want $2000 of something but don't care about how much I get in return.

Save and load state - persistence

order-matcher should have methods to save state/serialize and load state de-serialize. so that state can be persisted and restored after restart. Also it can be used to save state and move and load it inside different machine. which can help in maintenance also.

Self Match Prevention

Self Match Preventention feature prevents matching orders of the same user/account. Order Matching Engine will not match the buy & sell order of the same user/account. Users can specify what should happen in case of order executes against his/her orders. This feature will benefit users by avoiding matching his/her order. also, it benefits markets from the wash trade.

To opt-in for this feature, orders must specify UserId/AccountId and what action should be taken in case of a self match.

  • UserId/AccountId
  • Self Match Action(Any of below)
    • Cancel Incoming Order
    • Cancel Resting Order
    • Reduce Quantity
    • Match

Matching engine should be deterministic

Add order cancels expired good till date orders before executing incoming order. This behavior makes add order method non deterministic. All the methods should be deterministic this may help in replication/high availability implementation.

Incorrect order deserialization

In class OrderSerializerTests test Deserialize_Doesnotthrowexception I see creating order with OpenQuantity = 546 but on line 204 Assert.Equal((Quantity)2356, order.OpenQuantity);

Is it mistake in test and deserialization wrong?

Do you using Mather in production?

Please say, Do you using Mather in production? If yes, how many Traders works in time? How many Instruments you have? How many Orders matching in second?

What is the license for this project ?

Hi,
This matching engine seems very well designed, thank you for sharing it. I'm considering using it in a project. Could you please tell me what is the licence (GNU, MIT, Proprietary ...) of it ?
Also do you think that it can be extended (without too much effort) to support the "Price Pro-rata" matching algorithm (to fill order proportionally to their size for a given price) ?
Thank you !

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.