Skip to content
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

[Tech]: Delete order book optimization #711

Closed
7 tasks done
wer1st opened this issue Sep 7, 2023 · 3 comments
Closed
7 tasks done

[Tech]: Delete order book optimization #711

wer1st opened this issue Sep 7, 2023 · 3 comments
Assignees
Labels
orderbook Task related to the orderbook project tech Technical task

Comments

@wer1st
Copy link
Contributor

wer1st commented Sep 7, 2023

Problem statement

By benchmarks we found that order-book deleting takes too much time in worst case. Necessary to optimize that process.

Description

It is needed to implement new approach for order-book deleting.
Now we can delete only empty order-book in states: OnlyCancel or Stop.

Dev changes:

  • Don't cancel any orders
  • Check that order-book is empty
  • Check that order-book has states OnlyCancel or Stop
  • Delete order-book if all conditions are met.

Delete order-book from the user perspective:

  1. Announce the delisting of pair from order book liquidity source.
  2. Change order-book status to OnlyCancel or Stop.
  3. Wait untill users cancel their limit orders or they expire. Order-book must be empty.
  4. Call order-book::delete_orderbook() extrinsic.

Definition of Done

  • Order-book is not deleted if it has any statuses other thanOnlyCancel or Stop.
  • Order-book is not deleted if it has at least one limit-order.
  • Deleting of order-book doesn't cancell any orders.
  • Order-book is deleted by delete_orderbook extinsic if all conditions are met.
  • Update unit tests.
  • Update benchmarks.
  • Update autotests if it necessary.

Requirements

No response

@wer1st wer1st added the tech Technical task label Sep 7, 2023
@wer1st wer1st added this to the 3.2.0 - OrderBook milestone Sep 7, 2023
@bragov4ik
Copy link
Contributor

bragov4ik commented Sep 13, 2023

A suggestion: instead of disallowing removal of order books that contain any orders, we can allow cancellation of up to $N$ orders, where $N$ is small enough so that the removal is as short as needed.

@bragov4ik
Copy link
Contributor

we can allow cancellation of up to $N$ orders
After a discussion we concluded that we won't implement it this way because

  • It can be ambiguous from user perspective (sounds like an arbitrary and weird restriction)
  • There is no easy indicator of order book having $N$ orders, in contrast to being empty
  • The implementation would be additional code that can introduce additional bugs, weaknesses, etc.
  • There is no clear motivation to allow quick(-er) removal of the order book

@wer1st wer1st self-assigned this Oct 1, 2023
@ra9mls
Copy link

ra9mls commented Nov 24, 2023

@ra9mls ra9mls closed this as completed Nov 24, 2023
@Tieumsan Tieumsan added the orderbook Task related to the orderbook project label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
orderbook Task related to the orderbook project tech Technical task
Projects
None yet
Development

No branches or pull requests

4 participants