Metadata-Version: 2.4
Name: tickrush
Version: 0.1.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
License-File: LICENSE
Summary: High-performance Betfair price stream reader
Author-email: Maurice Berk <maurice@mauriceberk.com>
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/mberk/tickrush

# tickrush

`tickrush` is a performance-first ingestion layer for saved Betfair Exchange price stream data.
Its sole purpose is to get historical Betfair `MarketBook` updates into `flumine` as fast as possible.

## Installation

Initial releases are available from GitHub. A PyPI release will follow shortly.

```
pip install git+https://github.com/mberk/tickrush.git
```

Python >=3.10 required.
A Rust toolchain is required to build the PyO3 extension.

## Usage

To use `tickrush` when running a `flumine` simulation simply apply a trivial monkey-patch to `HistoricalStream.create_generator`.
Here is an illustration using the `flumine` `LowestLayer` example strategy:


```python
# Store original create_generator for restoration
_original_create_generator = HistoricalStream.create_generator

# Monkey-patch HistoricalStream to use tickrush
HistoricalStream.create_generator = tickrush.create_generator

client = clients.SimulatedClient()

framework = FlumineSimulation(client=client)

markets = ["tests/resources/PRO-1.170258213"]

strategy = LowestLayer(
    market_filter={"markets": markets},
    max_order_exposure=1000,
    max_selection_exposure=105,
    context={"stake": 2},
)
framework.add_strategy(strategy)

framework.run()

# Restore original
HistoricalStream.create_generator = _original_create_generator
```

## Intent

`tickrush` is obsessively focused on minimising the time taken to:

- parse archived Betfair stream messages
- produce `MarketBook` objects consumable by `flumine`
- access fields on said `MarketBook` objects

Everything else is deliberately out of scope.

## Technology

- Rust parser exposed via PyO3
- Low-allocation decoding of Betfair stream messages
- Efficient runner- and price-level cache reuse
- Thin Python surface designed to integrate directly with `flumine`

## Roadmap

Planned future work includes:
- A compact proprietary file format for even more efficient parsing
- Offering a range of stripped down `MarketBook`-like objects to avoid unnecessarily constructing unused fields
- Switching to a pure C extension to minimise `getter` overhead

## Status

This project is under active development and not yet API-stable.

