nachouve / BetfairExchange

A python api-wrapper for the Swedish betfair exchange api. end-point.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BetfairExchange

A python api-wrapper for the Swedish betfair exchange api.

Full documentation and support can be found at https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni

Currently the Api is avalible for Swedish, Italian, Spain and Romania end point. If wanting to switch to any other of these endpoints modify line 22

 22       resp = requests.post('https://identitysso-cert.betfair.se/api/certlogin'

To the country code from .se to .it, .es or .ro.

How to set up for the Betfair exchange api

So in order to use the api you must enable non-Interactive (bot) login for your account and create a Self Signed Certificate. You can enable this setting at My Details page on your betfair account. To generate the Certificate you need to generate a RSA key pair using openssl by running the following command

openssl genrsa -out client-2048.key 2048

This may require you to override some default settings of openSSL which is done by creating a configuration file openssl.cnf with the following settings.

[ ssl_client ]
basicConstraints = CA:FALSE
nsCertType = client
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth

After this is done you need to generate a certificate signing request file to verify identity.

openssl req -new -config openssl.cnf -key client-2048.key -out client-2048.csr

Here it is important that the information submitted matches your account settings. The next step is to self-sign the certificate request to create a certificate used to verify yourself at the api endpoint.

openssl x509 -req -days 365 -in client-2048.csr -signkey client-2048.key -out client-2048.crt -extfile openssl.cnf -extensions ssl_client 

Once this certificate is generated log into your betfair account, go to My Details and upload your certificate by pressing edit under Automated Betting Program Access. After this is done, the api should be functional and ready to use.

If having trouble during the verification, betfair has their own guide which can be found here https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Non-Interactive+%28bot%29+login .

About

A python api-wrapper for the Swedish betfair exchange api. end-point.


Languages

Language:Python 100.0%