|
ITCHCPP 1.6.0
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
|
itchcpp is a native (C++) NASDAQ TotalView-ITCH 5.0 parser, order-book engine, and analytics layer exposed to Python via pybind11. It is built to be a drop-in, faster backend for the pure-Python itch package (published on PyPI as itchfeed).
The pure-Python parser unpacks every message with struct.unpack and materializes a Python object in interpreter code, which is slow on full-day feeds. itchcpp does the framing and field decoding in C++ (gigabytes per second) while exposing the same public API: the same message classes (same names, same raw bytes/int attributes), the same MessageParser semantics, the same MarketMessage helpers, the same constants, and the same create_message factory.
The package layout mirrors itch.*, so migrating only changes the import root:
parse_file takes an open binary file object (so gzip.open(path, "rb") works too); parse_stream(raw_bytes) parses an in-memory buffer. Both return lazy iterators, apply the message_type filter, and stop at the end-of-messages system event (S with event_code == b"C").
itchcpp.messages**, every message class under its exact upstream name (SystemEventMessage, StockDirectoryMessage, AddOrderNoMPIAttributionMessage, AddOrderMPIDAttribution, OrderExecutedMessage, NonCrossTradeMessage, CrossTradeMessage, NOIIMessage, MWCBDeclineLeveMessage, RetailPriceImprovementIndicator, DLCRMessage, ...); the abstract bases MarketMessage, AddOrderMessage, ModifyOrderMessage, TradeMessage (the concrete classes are registered as virtual subclasses, so isinstance works); the messages registry (dict[bytes, type]); the AllMessages constant; and the create_message(message_type, **kwargs) factory.MarketMessage helpers** on every message: decode(), decode_price(name), to_bytes(), set_timestamp(ts1, ts2), split_timestamp(), get_attributes(call_able=False), plus the message_type, description, message_size, and price_precision metadata.itchcpp.parser.MessageParser**, parse_file, parse_stream, parse_messages(data, callback), get_message_type(bytes), and the message_type filter.itchcpp.indicators**, the field code lookup tables (SYSTEM_EVENT_CODES, MARKET_CATEGORY, TRADING_STATES, ISSUE_SUB_TYPE_VALUES, ...).itchcpp.book (BookManager, L3Book, Bbo) for single-pass order-book reconstruction, and itchcpp.analytics (Vwap).Prebuilt wheels are published to PyPI for Linux, macOS, and Windows (CPython 3.9-3.13), so most users need no compiler:
Building from source needs a C++20 compiler and pybind11 (pulled in automatically as a build dependency). The pyproject.toml lives at the repository root, so build from there:
This invokes scikit-build-core, which configures the CMake project with -DITCH_BUILD_PYTHON=ON and builds the itchcpp._itchcpp extension module into the itchcpp package. To build just the extension with CMake directly:
itchcpp ships as a separate package and does not replace itchfeed; it exposes the same API under the itchcpp import root. There are two migration paths:
itch -> itchcpp).Wire it as an optional backend in itchfeed, so installed users get a transparent speedup with no code change:
The native message objects expose raw field values (bytes for character fields, int for prices and quantities) just like the pure-Python classes, so existing code that calls decode_price(...) or decode() keeps working unchanged.