diff --git a/src/lib_python_interop/python_interop_plugins/bybit_execution_gateway.py b/src/lib_python_interop/python_interop_plugins/bybit_execution_gateway.py index 115541391..f4debc098 100644 --- a/src/lib_python_interop/python_interop_plugins/bybit_execution_gateway.py +++ b/src/lib_python_interop/python_interop_plugins/bybit_execution_gateway.py @@ -722,13 +722,20 @@ class BybitExecutionGateway(ExecutionGateway): ) self.buffered_requests[req.key()] = req return + order_type = req.order_type().title() + time_in_force = req.time_in_force().upper() + if order_type == "Limit" and time_in_force == "GTC": + # 'PostOnly' makes it so the order gets rejected if it would be filled on entry. + # We're hardcoding this flag for Limit/GTC orders to avoid taker fees in Ali's + # algo (SprayAndSkew), since our TimeInForce enum doesn't have 'PostOnly'. + time_in_force = "PostOnly" params = { "orderLinkId": exch_ord_id, "category": "linear", "symbol": exch_sec_id, "side": "Buy" if req.is_buy() else "Sell", - "orderType": req.order_type().title(), - "timeInForce": req.time_in_force().upper(), + "orderType": order_type, + "timeInForce": time_in_force, "price": format_price(sec, px), "qty": format_quantity(sec, qty), }