INNER CODE UNIT · Python
on_order_filled_message
keanekwa/Optiver-Ready-Trader-Go · ASModel.py:150
def on_order_filled_message(self, client_order_id: int, price: int, volume: int) -> None:
"""Called when one of your orders is filled, partially or fully.
The price is the price at which the order was (partially) filled,
which may be better than the order's limit price. The volume is
the number of lots filled at that price.
"""
self.logger.info("received order filled for order %d with price %d and volume %d", client_order_id,
price, volume)
if client_order_id in self.bids:
self.position += volume
elif client_order_id in self.asks:
self.position -= volume
volume = -volume
# Record price and volume
new_vol = self.orders_history["volume"] + volume