fix: Count fills correctly in bybit exe gw plugin

* Round fill price and qty to 7 digits in bybit gw plugin
* Remove erroneous line of code that reset filled_quantity to 0 on each
  update (it was causing partial fills to be overcounted)
This commit is contained in:
John Colvin committed 2025-08-18 15:51:11 +00:00
1 parent fd51025b00
commit 504f441d2e
1 file changed
+2 -1
@@ -132,9 +132,9 @@ class OrderData:
status: str,
):
self.price = price
self.filled_quantity = 0
self.quantity = quantity
lfq = filled_quantity - self.filled_quantity
lfq = round(lfq, 7)
if lfq > 0:
if self.filled_quantity == 0:
self.last_filled_quantity = filled_quantity
@@ -143,6 +143,7 @@ class OrderData:
price_diff = avg_filled_price - self.avg_filled_price
lfq_weight = filled_quantity / (self.filled_quantity + filled_quantity)
lfp = self.avg_filled_price + (price_diff / lfq_weight)
lfp = round(lfp, 7)
self.last_filled_price = lfp
self.last_filled_quantity = lfq
self.filled_quantity = filled_quantity