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
- trading.login
- trading.login_interactive
- trading.keep_alive
-
trading.logout
-
trading.betting
- trading.account
- trading.navigation
- trading.scores
- trading.streaming
-
trading.historical
-
trading.in_play_service
- trading.race_card
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 parsingorjson
- 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+