Skip to main content

Betfairstreamer

Features

  • Run single or multiple streams simultaneously.
  • Making use numpy arrays to access market price/size.
  • Synchronous and asynchronous streaming.
  • Parse historical data.

Installation

!! Requires >= 3.8.0

Conda installation

# If you already have an environment

conda activate your_environment
conda install -c anaconda python=3.8
pip install betfairstreamer==0.8.0

# If not, create an environment with python 3.8

conda create -n your_environment_name python=3.8
conda activate your_environment_name
pip install betfairstreamer==0.8.0

Virtual environment installation

mkdir your_project
cd your_project
python3.8 -m venv venv
source venv/bin/activate
pip install betfairstreamer==0.8.0

Examples

session_token = api_client.get_session_token()

soccer_subscription = create_market_subscription(
    event_type_ids=["1"],
    country_codes=["DE"],
    market_types=["MATCH_ODDS"],
    fields=["EX_MARKET_DEF", "EX_LTP", "EX_BEST_OFFERS_DISP"],
    ladder_levels=2,
)

order_subscription = create_order_subscription()

connection_pool = BetfairConnectionPool.create_connection_pool(
    subscription_messages=[
        soccer_subscription_message, 
        order_subscription_message
    ],
    app_key=APP_KEY,
    session_token=session_token
)

for stream_update in connection_pool.read():
    print(stream_update)

Jupyter notebooks available in ./examples

Benchmark

Setup: Two processes, one sending betfair stream messages , one receiving.

Hardware: I7 8550U, 16GB ram

Results: 
 * Using a market cache it can read around ~90k decoded messages/second

Release files for betfairstreamer 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for betfairstreamer 0.8.0
File Size Uploaded
betfairstreamer-0.8.0.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for betfairstreamer 0.8.0
File Interpreter ABI Platform
betfairstreamer-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size:41.1 kB

Release files / betfairstreamer-0.8.0.tar.gz

Download URL betfairstreamer-0.8.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4d2573b1199bc54829246438a2d45644b4dbc1753252a1314402eeae8327196d
BLAKE2b-256 checksum
How to use checksums
ec3d6a3f539fc719a3cb828e2427239a065ad96683643ac3518ae1ed392e18e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release files / betfairstreamer-0.8.0-py3-none-any.whl

Download URL betfairstreamer-0.8.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9d53a49d4ca6167692c2a596e409e90659d261c2337cc4ea16925977ea7ecd7
BLAKE2b-256 checksum
How to use checksums
4ec79506b20969d3acbea66de5deb8564a87d208174ffe54d8e38a56558ffda7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page