Betfair Data
Betfair Data is a very fast, Rust based, Betfair historical data parsing library for python. It supports both the official Betfair's historic data and self recorded stream files.
Installation
pip install betfair-data-smoothcinf
Note: requires Python >= 3.7.
Example
import betfair_data as bfd
paths = [
"data/2021_12_DecRacingAUPro.tar",
"data/2021_10_OctRacingAUPro.tar",
"data/2021_11_NovRacingAUPro.tar",
]
market_count = 0
update_count = 0
for file in bfd.Files(paths):
market_count += 1
for market in file:
update_count += 1
print(f"Markets {market_count} Updates {update_count}", end='\r')
print(f"Markets {market_count} Updates {update_count}")
Loading Files
You can read in files quickly in a worker thread using the provided Files utility. It supports reading in bz2, gzip or uncompressed (.json) stream files or .tar or .zip archives containing such files.
paths = [
"data/2021_10_OctRacingAUPro.tar",
"data/2021_11_NovRacingAUPro.zip",
"data/self_recorded_market.gz",
"data/uncompressed_market.json",
]
files = bfd.Files(paths)
Or you can use the glob library to find and select all the paths automatically.
import glob
paths = glob.glob("data/betfair_official/*.tar") + glob.glob("data/self_recorded/*.gz")
files = bfd.Files(paths)
You can also load the file through any other means and pass the raw bytes and name into the File object constructor.
# generator to read in files
def load_files(paths: str):
for path in glob.glob(paths, recursive=True):
with open(path, "rb") as file:
yield bfd.File(path, file.read())
for file in load_files("markets/*.json"):
for market in file:
pass
Benchmarks
Running over 3 months of Australian racing data on a 2021 M1 Macbook Pro.
| betfair_data (mutable) | betfair_data (immutable/bflw compat) | betfairlightweight lightweight=True | betfairlightweight lightweight=False |
|---|---|---|---|
| 5m 12sec | 6m 50sec | 1hour 1min 45sec | 3hours 46mins 39sec |
| ~70 markets/sec | ~53.5 markets/sec | ~6 markets/sec | ~1.62 markets/sec |
| ~534,200 updates/sec | ~406,500 updates/sec | ~45,500 updates/sec | ~12,250 updates/sec |
Types
IDE's should automatically detect the types and provide checking and auto complete. See the pyi stub file for a comprehensive view of the types and method available.
Betfairlightweight
We also support a format that is a drop in replacement for betfairlightweight objects. We have rigorously tested it against betfairlightweight to ensure a complete match of its structure, any differences should be submitted as issues with the corresponding differences and the data used to create them.
from betfair_data import bflw
files = bflw.Files(paths)
from betfair_data import bflw
file_bytes = ...
file = bflw.File("file_name", file_bytes)
Logging
Logging can be enabled and warnings are emitted for IO and JSON errors.
import logging
logging.basicConfig(level=logging.WARN, format='%(levelname)s %(name)s %(message)s')
Example logged errors
WARNING betfair_data file: data/2021_10_OctRacingAUPro.tar/PRO/2021/Oct/4/30970292/1.188542184.bz2 err: (JSON Parse Error) expected value at line 1480 column 1
WARNING betfair_data file: data/2021_10_OctRacingAUPro.tar/PRO/2021/Oct/8/30985584/1.188739324.bz2 err: (JSON Parse Error) expected `:` at line 1 column 909
WARNING betfair_data file: data/2021_10_OctRacingAUPro.tar/PRO/2021/Oct/8/30985584/1.188739325.bz2 err: (JSON Parse Error) expected `:` at line 1 column 904
WARNING betfair_data file: data/2021_10_OctRacingAUPro.tar/PRO/2021/Oct/15/31001342/1.189124831.bz2 err: (JSON Parse Error) expected value at line 1335 column 1
Metadata
Release files for betfair-data-smoothcinf 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 6.0 MB
Release files / betfair_data_smoothcinf-0.3.5-cp37-abi3-win_amd64.whl
| Download URL | betfair_data_smoothcinf-0.3.5-cp37-abi3-win_amd64.whl |
|---|---|
| Size | 912.5 kB |
| Tags | CPython 3.7 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cbccdc32d02e5dd953d26c021d34229e1b6035fbbc3efedbcd59523a8c9a7b26
|
|
BLAKE2b-256 checksum How to use checksums |
a9052fb1a204fe826af406659630715f8aa8e9f994eec55d8ca41ec180e529a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / betfair_data_smoothcinf-0.3.5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | betfair_data_smoothcinf-0.3.5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9a63372cea09569721f4064e04caa36a23801161cbfaf32cc0efee08f94456f3
|
|
BLAKE2b-256 checksum How to use checksums |
7d986f0322b187772fc5fda74fbcdd1aeab68e9e0fecf4cb51f8f03339d042bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / betfair_data_smoothcinf-0.3.5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | betfair_data_smoothcinf-0.3.5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8fff3a566336860ae177723ef8f0af3278ef7debf9e6cfba2bbbf6f4d3b9b887
|
|
BLAKE2b-256 checksum How to use checksums |
cb1d3af2d800c489b746a7d53321935bd8efe8e3cf5efb7436cb51cd1e7c2efe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / betfair_data_smoothcinf-0.3.5-cp37-abi3-macosx_11_0_arm64.whl
| Download URL | betfair_data_smoothcinf-0.3.5-cp37-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 999.2 kB |
| Tags | CPython 3.7 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
55577cafc7566a4d76b96a4891102871b3b36e6782dde36a3f48d9b77de53085
|
|
BLAKE2b-256 checksum How to use checksums |
f33941ca1ec4113ff3aff981491da70153e75bd926cbe4d8b60c18b380b16bf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / betfair_data_smoothcinf-0.3.5-cp37-abi3-macosx_10_7_x86_64.whl
| Download URL | betfair_data_smoothcinf-0.3.5-cp37-abi3-macosx_10_7_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.7 abi3 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
f43ef74885f1484c9f666b963f6b39495ac5b671c08bc28363ec2da0ec568231
|
|
BLAKE2b-256 checksum How to use checksums |
57bbdfb7b34f366acc683e0857dc4856f64721c74fa4062a1b208dc89ceb39ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logSecurity for betfair-data-smoothcinf 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for betfair_data_smoothcinf-0.3.5-cp37-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.