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

Enable order_id to be assigned before an order is placed by optionally specifying sequence for a new order #56

Open
crocodiledundalk opened this issue May 3, 2022 · 2 comments

Comments

@crocodiledundalk
Copy link

We have a use case where we'd like to 'hold back' orders and within a queue for a 'waiting period' before they are cranked onto the orderbook. We would like it to be possible for users to uniquely and specifically identify their order, regardless of whether it is still 'waiting' in the queue or on the orderbook. For that reason, it would be great if there was some way to assign or anticipate the order_id that will be assigned to the order before it is posted to the book.

If applied, this holding period would apply to all orders, and therefore the sequence would still be respected (in that a subsequent order would always strictly have a higher sequence number). Although it would be possible that a sequence number might be 'skipped' - i.e. an order is cancelled while 'waiting' and before being cranked onto the orderbook.

One approach might be to add an optional parameter - seq_number to the new_order instruction which would be used when deriving the new order_id, otherwise derive it as currently implemented.

In this way, the calling program could use event_queue.gen_order_id(limit_price, side) to assign an order_id without placing a new order, noting and recording the sequence number used in generating this. When the order is cranked onto the orderbook, the calling program could pass an optional seq_number parameter which would be used to derived the order_id which is consistent with the previously assigned order_id.

@Henry-E
Copy link

Henry-E commented May 5, 2022

In serum v3 (and now v4) they have implemented a client_order_id where the client can choose their own order id to look up some order. Maybe it would be possible to have some internal_order_id on the program calling the AOB?

@crocodiledundalk
Copy link
Author

We had implemented something like this initially but felt the proposed might be a better result, as:
(a) it requires the callback_info to be increased in bytes in all cases, and not just when this is required
(b) you would need to use a different identifier (and possibly a different ix) to cancel the order depending on whether the order was still in the queue or if it had made it onto the book.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants