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

Program Order ID Gen & OB Client Order ID Type Mismatch #271

Open
wiseaidev opened this issue Jun 4, 2024 · 1 comment
Open

Program Order ID Gen & OB Client Order ID Type Mismatch #271

wiseaidev opened this issue Jun 4, 2024 · 1 comment

Comments

@wiseaidev
Copy link
Contributor

Hello!

To generate order ids, we can utilize the built-in gen_order_id utility function:

pub fn gen_order_id(&mut self, side: Side, price_data: u64) -> u128 {

But the returned order_id type is u128, and when placing a new limit order, it is taking a u64 as order id type param:

client_order_id: u64,

Using the above function and downcasting the value to u64 can cause an overflow and returning the same order id each time a limit order is placed. Therefore, I suggest to either make the order id type u128, or make the gen_order_id function return a u64 id to match the order id type when placing, cancelling, etc orders.

Best!

@riordanp
Copy link
Contributor

riordanp commented Jul 3, 2024

Sorry for the late reply, but these are two different fields. client_order_id is assigned by you and you can make it whatever you want (sequence number and timestamp are common). order_id is assigned by the program and it's not possible in all cases to know it before you submit your order. Hope this helps!

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