From 3268f068c9f73e9643b1fab23d98ae51e66cd1ff Mon Sep 17 00:00:00 2001 From: skrrb Date: Wed, 29 Nov 2023 19:24:12 +0100 Subject: [PATCH] dont subtract taker fees in post only orders --- programs/openbook-v2/src/state/orderbook/book.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/programs/openbook-v2/src/state/orderbook/book.rs b/programs/openbook-v2/src/state/orderbook/book.rs index f2022f089..0a5dbbf3e 100644 --- a/programs/openbook-v2/src/state/orderbook/book.rs +++ b/programs/openbook-v2/src/state/orderbook/book.rs @@ -94,9 +94,10 @@ impl<'a> Orderbook<'a> { // matched_changes/matched_deletes and then applied after this loop. let order_max_base_lots = order.max_base_lots; - let order_max_quote_lots = match side { - Side::Bid => market.subtract_taker_fees(order.max_quote_lots_including_fees), - Side::Ask => order.max_quote_lots_including_fees, + let order_max_quote_lots = if side == Side::Bid && !post_only { + market.subtract_taker_fees(order.max_quote_lots_including_fees) + } else { + order.max_quote_lots_including_fees }; require_gte!(