change: Hardcode PostOnly flag for Limit/GTC orders in bybit gw
'PostOnly' is a TimeInForce flag that we don't have in our system. It makes it so Limit orders that would be filled on entry are rejected. Ali's SprayAndSkew algo needs this to avoid taker fees.
This commit is contained in:
1 parent
a022f08b49
commit
c08a893ecf
1 file changed
+9
-2
@@ -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),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user