forked from coinbase/coinbase-pro-trading-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bookbuilder modify keeps orders (coinbase#174)
* BookBuilderTest.ts: add asserts on adding and modifying orders with zero size. * BookBuilder#modify: remove redundant check for order existence. Because BookBuilder#remove() first checks if the order exists and returns null if it doesn't, there is no need for modify() to also check for its existence. * BookBuilder#modify: keep an order even if its size goes to zero. This is to work around a bug where Trader#handleTradeExecutedMessage() would modify the order size to zero which would cause it to be deleted from the orderbook. Later when Trader#handleTradeFinalized() was called it wouldn't find the order and wouldn't emit Trader.trade-finalized. Now with d3103dd committed it will always emit Trader.trade-finalized. However, this still appears to be the correct action. BookBuilder supports adding orders with 0 size, which is inconsistent with modifying an error. Also, only deleting orders when the trade is finalized seems like a good consistency thing. * Trader#handleTradeFinalized: micro-optimize.
- Loading branch information
Showing
3 changed files
with
30 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters