Skip to content

betfairlightweight


Lightweight, super fast (uses c libraries) pythonic wrapper for Betfair API-NG allowing all betting operations (including market and order streaming) and account operations.


Get started...

>>> import betfairlightweight
>>> trading = betfairlightweight.APIClient(
        "username", "password", app_key="app_key", certs="/certs"
    )
>>> trading.login()

Request all event types..

>>> event_types = trading.betting.list_event_types()
>>> event_types
[<EventTypeResult>, <EventTypeResult>, ..]

Endpoints

Warning

in_play_service and race_card are not public endpoints so may break, they are used by the betfair.com website.

Dependencies

betfairlightweight relies on these libraries:

  • requests - HTTP support

Speed install:

  • ciso8601 - C based datetime parsing
  • orjson - Rust based json parsing

Installation

Install with pip:

$ pip install betfairlightweight

or to use C/Rust libraries install with

$ pip install betfairlightweight[speed]

betfairlightweight requires Python 3.8+