Metadata-Version: 2.4
Name: pcapmbo
Version: 0.0.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Dist: pytest>=7 ; extra == 'test'
Provides-Extra: test
License-File: LICENSE
Summary: Decode raw exchange packet captures (pcap / pcap.zst) into standard market-by-order (MBO) events
Keywords: pcap,itch,market-data,order-book,mbo
License-Expression: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/FIN-556-Market-Microstructures/pcapmbo

# pcapmbo

Decode raw exchange packet captures (pcap / pcap.zst) into standard
market-by-order (MBO) events, with both the exchange timestamp and the
capture timestamp. Rust core, Python API.

> **Status: pre-alpha.** The package is set up but decodes nothing yet.

## Why

Fast ITCH parsers and order book tools already exist, but they read ITCH day
files, not network captures. The tools that do read captures are C++
programs with in-memory books or their own CSV output. Nothing gives you,
from a pip install:

- raw captures in: pcap / pcap.zst, with MoldUDP64 sequencing and gap reports
- standard events out: the market-by-order (MBO) layout of the open
  [DBN](https://github.com/databento/dbn) format, so the output works with
  existing tools as well as pandas, polars and Parquet
- both clocks: `ts_event` (exchange time) and `ts_recv` (when the capture
  saw the packet)

## Planned scope

**v0.1:** Nasdaq TotalView-ITCH 5.0 over MoldUDP64.

```python
import pcapmbo

for batch in pcapmbo.read_pcap("capture.pcap.zst", feed="itch5", symbols=["NVDA"]):
    ...  # a pyarrow.RecordBatch of MBO events
```

This API is a plan, not code yet.

**Later:** IEX DEEP (free public captures), CME MDP 3.0, A/B line
arbitration, an optional order book layer.

**Out of scope:** backtesting, fill simulation, live trading.

## Market data

This repository contains **code only**. Never commit market data, licensed
or otherwise: tests use synthetic captures or free public data. The
`.gitignore` blocks common capture and data file types as a safety net.

## Development

Needs Rust (stable) and Python 3.9 or newer.

```bash
python -m venv .venv && source .venv/bin/activate
pip install maturin pytest
cargo test                 # Rust tests
maturin develop            # build the extension into the venv
pytest                     # Python tests
```

## Licence

[Apache-2.0](LICENSE)

