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

Fix taker fee lots vs native #251

Merged
merged 1 commit into from
Apr 21, 2024
Merged

Fix taker fee lots vs native #251

merged 1 commit into from
Apr 21, 2024

Conversation

ckamm
Copy link
Contributor

@ckamm ckamm commented Apr 16, 2024

No description provided.

@ckamm ckamm requested a review from mschneider April 16, 2024 08:37
@@ -267,16 +267,16 @@ impl<'a> Orderbook<'a> {

// Record the taker trade in the account already, even though it will only be
// realized when the fill event gets executed
let mut taker_fees = 0_u64;
let mut taker_fees_native = 0_u64;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not calculate taker_fees_lots here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to compute the fees in native units to have high resolution on them. Otherwise sub-lot fees would need to be rounded: but can't round up (otherwise openbook would possibly charge 1 lot taker fees on a 1 lot order), and rounding down would unnecessarily reduce collected fees.

We could compute lots and native taker_fees independently, but imo the correctness is clearer to see when the low-resolution value is derived from the high-resolution one.

@mschneider mschneider merged commit 6faca8d into master Apr 21, 2024
9 of 10 checks passed
@mschneider mschneider deleted the ckamm/taker-fee-bug branch April 21, 2024 19:41
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

Successfully merging this pull request may close these issues.

2 participants