INNER CODE UNIT · Python

on_order_book_update_message

keanekwa/Optiver-Ready-Trader-Go · ASModel.py:69

    def on_order_book_update_message(self, instrument: int, sequence_number: int, ask_prices: List[int],
                                     ask_volumes: List[int], bid_prices: List[int], bid_volumes: List[int]) -> None:
        """Called periodically to report the status of an order book.

        The sequence number can be used to detect missed or out-of-order
        messages. The five best available ask (i.e. sell) and bid (i.e. buy)
        prices are reported along with the volume available at each of those
        price levels.
        """
        self.logger.info("received order book for instrument %d with sequence number %d", instrument,
                         sequence_number)

        if len(bid_prices) == 0 or len(ask_prices) == 0 or bid_prices[0] == 0 or ask_prices[0] == 0:
            return

        if instrument == Instrument.FUTURE:
            """
            s - mid market price

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…