arjunvachhani / order-matcher Goto Github PK
View Code? Open in Web Editor NEWsimple, fast and feature rich order matching engine supports limit, market, stop-loss, iceberg, IOC, FOK, GTD orders
License: MIT License
simple, fast and feature rich order matching engine supports limit, market, stop-loss, iceberg, IOC, FOK, GTD orders
License: MIT License
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?
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?
Hi, do you support GTD (Good-til-Date/Time) orders?
Support for distributed deployment ๏ผ
Hi, thank you for new release. In common case one incomingOrder can closed many restingOrder. I am planning to use NoSql dbms MongoDb and want to get trade with many mached orders. Possible can you to rewrite ITradeListener.OnTrade or add new event ITradeListener.OnTradeComplete for example?
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?
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
I am planed to have 1million orders per sec. And int can finished very quickly
types and serialization can be used outside of order-matcher/engine to send data to order-matcher/engine
I am think need rename to 'Sequence'
Documentation demonstrating how to integrate/use the library
Please submit this project in go language as well
Hi
How can floating-point be used in the amount of assets for buying and selling?
For example :
{ "Price": 2005, "OpenQuantity":1.50 }
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?
Sometime need to move order without canceled. Do you have method for this?
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.
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 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.
I am quickly look code and cannot find locks. Do you support multithread trading?
Is it correct to execute AddOrder from multiple threads in parallel or I should use locks for single thread work (execute AddOrder successively)?
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.
Hi
Is it possible to define only the requested price in the market sell ( not with asset count)?
for example :
{ "Price": 2005 }
How does ETH/USDT differentiate trading markets if there is a BTC/USDT.
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?
Hi, i am need UserId in each Order. Can you to add UserId long to Order?
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?
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 !
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.