MCPcopy Create free account
hub / github.com/ccxt/ccxt / load_order_book

Method load_order_book

python/ccxt/async_support/base/exchange.py:592–615  ·  view source on GitHub ↗
(self, client, messageHash, symbol, limit=None, params={})

Source from the content-addressed store, hash-verified

590 del self.clients[url]
591
592 async def load_order_book(self, client, messageHash, symbol, limit=None, params={}):
593 if symbol not in self.orderbooks:
594 client.reject(ExchangeError(self.id + ' loadOrderBook() orderbook is not initiated'), messageHash)
595 return
596 try:
597 maxRetries = self.handle_option('watchOrderBook', 'maxRetries', 3)
598 tries = 0
599 stored = self.orderbooks[symbol]
600 while tries < maxRetries:
601 cache = stored.cache
602 order_book = await self.fetch_order_book(symbol, limit, params)
603 index = self.get_cache_index(order_book, cache)
604 if index >= 0:
605 stored.reset(order_book)
606 self.handle_deltas(stored, cache[index:])
607 cache.clear()
608 client.resolve(stored, messageHash)
609 return
610 tries += 1
611 client.reject(ExchangeError(self.id + ' nonce is behind cache after ' + str(maxRetries) + ' tries.'), messageHash)
612 del self.clients[client.url]
613 except BaseError as e:
614 client.reject(e, messageHash)
615 await self.load_order_book(client, messageHash, symbol, limit, params)
616
617 def format_scientific_notation_ftx(self, n):
618 if n == 0:

Callers

nothing calls this directly

Calls 9

handle_optionMethod · 0.95
fetch_order_bookMethod · 0.95
get_cache_indexMethod · 0.95
handle_deltasMethod · 0.95
ExchangeErrorClass · 0.90
rejectMethod · 0.65
resolveMethod · 0.65
resetMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected