def check_bid_ask_overlapping(self, book, symbol): bid, ask = book[BID], book[ASK] if len(bid) > 0 and len(ask) > 0: best_bid, best_ask = bid.keys()[-1], ask.keys()[0] if best_bid >= best_ask: raise BidAskOverlapping( f"{self.id} {symbol} best bid {best_bid} >= best ask {best_ask}" )
def check_bid_ask_overlapping(self, book): bid, ask = book.bids, book.asks if len(bid) > 0 and len(ask) > 0: best_bid, best_ask = bid.index(0)[0], ask.index(0)[0] if best_bid >= best_ask: raise BidAskOverlapping( f"{self.id} - {book.symbol}: best bid {best_bid} >= best ask {best_ask}" )