Order matching logic sequencing issue [on hold] The 2019 Stack Overflow Developer Survey...
What are these Gizmos at Izaña Atmospheric Research Center in Spain?
What's the point in a preamp?
Mortgage adviser recommends a longer term than necessary combined with overpayments
Single author papers against my advisor's will?
Difference between "generating set" and free product?
Didn't get enough time to take a Coding Test - what to do now?
Is every episode of "Where are my Pants?" identical?
I could not break this equation. Please help me
What is special about square numbers here?
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
Relations between two reciprocal partial derivatives?
How to pronounce 1ターン?
How to stretch delimiters to envolve matrices inside of a kbordermatrix?
Typeface like Times New Roman but with "tied" percent sign
Is this wall load bearing? Blueprints and photos attached
Did the new image of black hole confirm the general theory of relativity?
What information about me do stores get via my credit card?
How does ice melt when immersed in water?
Why is the object placed in the middle of the sentence here?
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
Can a 1st-level character have an ability score above 18?
Cooking pasta in a water boiler
Is there a writing software that you can sort scenes like slides in PowerPoint?
Do working physicists consider Newtonian mechanics to be "falsified"?
Order matching logic sequencing issue [on hold]
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)compare two logic commented one to my logic javaSpring Service Method LogicProcessing buy and sell ordersSpring Web MVC where to put logicBitcoin trading systemBuy-sell order board, as a TDD interviewMap DTOs and Models within the Service Layer due to a missing Business LayerCalculating total maintenance costs of a carBusiness logic validation as custom Bean Validation annotations?Refactor REST service with overcomplicated logic
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
$begingroup$
I have developed a trading exchange where orders are matched in real-time with least possible latency. The order matching service logic is functioning correctly. However, there's a minute error in the operation.
The sequence is wrong. To explain it below is the example of the order book.
Buy side:
Price =3 Qty =1
Price =2 Qty =1
Price =1 Qty =1
Now a user comes with a sell order of Qty=3 at price =1. In this case, all buy orders will execute, but in a sequence of:
First it will execute pending order with buy price of 3, then 2, and then 1.
My matching service executes the logic, but in reverse sequence. Below is the snippet of the code, can someone help ?
if (matchOrderRequest.getOrderType() == OrderType.BUY)
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceLessThanEqualOrderByPriceAscTimestampAsc(request.getMarket(), OrderType.SELL, request.getPrice());
}
else
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceGreaterThanEqualOrderByPriceDescTimestampAsc(request.getMarket(), OrderType.BUY, request.getPrice());
}
There's a lot of logic after this, but it wouldn't make sense to post everything, but if anyone needs to know a little more, I can post it.
java mongodb spring
New contributor
$endgroup$
put on hold as off-topic by Jamal♦ 1 min ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I have developed a trading exchange where orders are matched in real-time with least possible latency. The order matching service logic is functioning correctly. However, there's a minute error in the operation.
The sequence is wrong. To explain it below is the example of the order book.
Buy side:
Price =3 Qty =1
Price =2 Qty =1
Price =1 Qty =1
Now a user comes with a sell order of Qty=3 at price =1. In this case, all buy orders will execute, but in a sequence of:
First it will execute pending order with buy price of 3, then 2, and then 1.
My matching service executes the logic, but in reverse sequence. Below is the snippet of the code, can someone help ?
if (matchOrderRequest.getOrderType() == OrderType.BUY)
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceLessThanEqualOrderByPriceAscTimestampAsc(request.getMarket(), OrderType.SELL, request.getPrice());
}
else
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceGreaterThanEqualOrderByPriceDescTimestampAsc(request.getMarket(), OrderType.BUY, request.getPrice());
}
There's a lot of logic after this, but it wouldn't make sense to post everything, but if anyone needs to know a little more, I can post it.
java mongodb spring
New contributor
$endgroup$
put on hold as off-topic by Jamal♦ 1 min ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I have developed a trading exchange where orders are matched in real-time with least possible latency. The order matching service logic is functioning correctly. However, there's a minute error in the operation.
The sequence is wrong. To explain it below is the example of the order book.
Buy side:
Price =3 Qty =1
Price =2 Qty =1
Price =1 Qty =1
Now a user comes with a sell order of Qty=3 at price =1. In this case, all buy orders will execute, but in a sequence of:
First it will execute pending order with buy price of 3, then 2, and then 1.
My matching service executes the logic, but in reverse sequence. Below is the snippet of the code, can someone help ?
if (matchOrderRequest.getOrderType() == OrderType.BUY)
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceLessThanEqualOrderByPriceAscTimestampAsc(request.getMarket(), OrderType.SELL, request.getPrice());
}
else
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceGreaterThanEqualOrderByPriceDescTimestampAsc(request.getMarket(), OrderType.BUY, request.getPrice());
}
There's a lot of logic after this, but it wouldn't make sense to post everything, but if anyone needs to know a little more, I can post it.
java mongodb spring
New contributor
$endgroup$
I have developed a trading exchange where orders are matched in real-time with least possible latency. The order matching service logic is functioning correctly. However, there's a minute error in the operation.
The sequence is wrong. To explain it below is the example of the order book.
Buy side:
Price =3 Qty =1
Price =2 Qty =1
Price =1 Qty =1
Now a user comes with a sell order of Qty=3 at price =1. In this case, all buy orders will execute, but in a sequence of:
First it will execute pending order with buy price of 3, then 2, and then 1.
My matching service executes the logic, but in reverse sequence. Below is the snippet of the code, can someone help ?
if (matchOrderRequest.getOrderType() == OrderType.BUY)
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceLessThanEqualOrderByPriceAscTimestampAsc(request.getMarket(), OrderType.SELL, request.getPrice());
}
else
{
optionalMatchOrder=orderRepository.findFirstByMarketAndOrderTypeAndPriceGreaterThanEqualOrderByPriceDescTimestampAsc(request.getMarket(), OrderType.BUY, request.getPrice());
}
There's a lot of logic after this, but it wouldn't make sense to post everything, but if anyone needs to know a little more, I can post it.
java mongodb spring
java mongodb spring
New contributor
New contributor
edited 1 min ago
Kaushal Thakker
New contributor
asked 8 mins ago
Kaushal ThakkerKaushal Thakker
11
11
New contributor
New contributor
put on hold as off-topic by Jamal♦ 1 min ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Jamal♦ 1 min ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes