-
-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: process pending order update for active order book #1060
Conversation
Welcome back! @c9s, This pull request may get 283 BBG. |
// the caller can add the created order to the active order book or the order store to collect trades. | ||
// this method is used when you have large amount of orders to be sent and most of the orders might be filled as taker order. | ||
// channel orderC will be closed when all the submit orders are submitted. | ||
func BatchPlaceOrderChan(ctx context.Context, exchange types.Exchange, orderC chan types.Order, submitOrders ...types.SubmitOrder) (types.OrderSlice, []int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unrelated, but we might need this in the future
Re-estimated karma: this pull request may get 294 BBG |
Codecov Report
@@ Coverage Diff @@
## main #1060 +/- ##
==========================================
+ Coverage 19.06% 19.08% +0.02%
==========================================
Files 434 434
Lines 33033 33078 +45
==========================================
+ Hits 6298 6314 +16
- Misses 26199 26226 +27
- Partials 536 538 +2
Continue to review full report at Codecov.
|
Re-estimated karma: this pull request may get 372 BBG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others LGTM
// add the order to the active order book and check the pending order | ||
func (b *ActiveOrderBook) add(order types.Order) { | ||
if pendingOrder, ok := b.pendingOrderUpdates.Get(order.OrderID); ok { | ||
if pendingOrder.UpdateTime.Time().After(order.UpdateTime.Time()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a rare condition that a pending order and a new coming order are updated at the same timestamp (in millisecond or even in second).
Another way is to compare the filled amount or the state change.
Hi @c9s, Well done! 387 BBG has been sent to your polygon wallet. Please check the following tx: https://polygonscan.com/tx/0x018fd7e0a34d1983a902a969ee4c7cf39a1bceb323ea8535251ff3ec17b39ffc Thank you for your contribution! |
No description provided.