{"repo":"bmoscon/orderbook","free":true,"listed":false,"github":"https://github.com/bmoscon/orderbook","clone":"git clone https://github.com/bmoscon/orderbook.git","description":"A fast L2/L3 orderbook data structure, in C, for Python","language":"Python","stars":316,"topics":["orderbook","trading","python","c","python-c-extension","python-extension","finance"],"license":"GPL-3.0","category":"trading","readme_excerpt":"Orderbook A fast L2/L3 orderbook data structure, in C, for Python Installation Python 3.12+ supported. In general, uv is preferred and will be utilized throughout this document. To add it to a project uv add order-book or, to install it into an environment directly, uv pip install order-book Installing from a checkout of this repository: uv pip install . (note a C compiler is required). Basic Usage Both sides accept any of bid , bids , BID , BIDS (and the ask equivalents), as attributes or as keys: Max Depth max depth limits how many levels are visible. len() , iteration, keys() , index() , to dict() and to list() all respect it. By default the levels beyond max depth are still retained internally, they are just hidden. Pass max depth strict=True to have them deleted as the book is updated, which caps memory use but means out-of-depth levels can no longer be accessed: Checksums Several exchanges publish a CRC32 checksum of the top of book so clients can detect a desynchronized book. Construct the book with checksum format set to the exchange, then compare ob.checksum() against the value the exchange sent. Supported formats: KRAKEN , OKX / OKCOIN , BITGET , and BITFINEX . Type conversion to dict() on either an OrderBook or a SortedDict accepts from type and to type keyword arguments, which convert keys and values as the dictionary is built. from type restricts the conversion to values of that type; omit it to convert everything. API Summary OrderBook(max depth=0, max depth str","default_branch":null,"files":null,"tree":[],"storefront":"/r/bmoscon","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/bmoscon/orderbook/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}