This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MeatPy is a Python framework for processing and analyzing high-frequency financial data, specifically designed for Nasdaq ITCH 5.0 format. It provides tools for parsing market messages, reconstructing limit order books, and analyzing market microstructure.
# Install dependencies using uv (recommended)
uv sync
# Install pre-commit hooks
uv run pre-commit install# Run all tests with coverage
uv run pytest
# Run specific test markers
uv run pytest -m "not slow" # Skip slow tests
uv run pytest -m unit # Only unit tests
uv run pytest -m integration # Only integration tests# Format code
uv run ruff format
# Check linting issues
uv run ruff check
# Fix auto-fixable linting issues
uv run ruff check --fix# Build documentation
mkdocs build
# Serve documentation locally
mkdocs serveMarket Processing Pipeline: The library follows an event-driven architecture centered around MarketProcessor classes that process market messages and maintain limit order book state.
Key Classes:
MarketProcessor: Abstract base class for processing market messages (src/meatpy/market_processor.py:19)ITCH50MarketProcessor: ITCH 5.0 specific implementation (src/meatpy/itch50/itch50_market_processor.py:87)LimitOrderBook: Maintains the current state of the order book (src/meatpy/lob.py)MarketEventHandler: Handles events during processing (src/meatpy/market_event_handler.py)
- Message Reading:
MessageReaderclasses parse binary market data intoMarketMessageobjects - Event Processing:
MarketProcessorprocesses messages, updates the LOB, and notifies handlers - Data Recording: Event handlers record market events (trades, quotes, etc.) to various output formats
src/meatpy/- Core library codeitch50/- ITCH 5.0 specific implementationsevent_handlers/- Event recording and processing handlerswriters/- Output format writers (CSV, Parquet)
tests/- Test suitedocs/- Documentation (MkDocs format)samples/- Example scripts showing typical usage patterns
The codebase uses extensive generic typing for market data types:
Price,Volume,OrderID,TradeRef,Qualifiersare generic type parameters- ITCH 5.0 implementation uses concrete types:
intfor prices/volumes/IDs,dict[str, str]for qualifiers
- Use Google-style docstrings for all public APIs
- Type hints are required for all function signatures
- Follow Ruff formatting standards
- Maintain test coverage above 80%
- Tests use pytest with custom markers (unit, integration, slow, performance)
- Coverage reporting configured in pytest.ini
- Test data available in
tests/anddocs/guide/data/
pyproject.toml- Project metadata, dependencies, and tool configurationpytest.ini- Test configuration with coverage requirementsmkdocs.yml- Documentation configurationrules/python.mdc- Development guidelines for cursor/AI tools