read only technical documentation

33
BETFAIR APPLICATION PROGRAMMER¶S INTERFACE TECHNICAL DOCUMENTATION - DRAFT Version 1.1 29 th October 2003 Produced by Steve High Confidential

Upload: andrew-newton

Post on 09-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 1/33

BETFAIR APPLICATION PROGRAMMER¶S INTERFACE

TECHNICAL DOCUMENTATION - DRAFT

Version 1.1

29th October 2003

Produced by Steve HighConfidential

Page 2: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 2/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 2 of 33

1 Contents

1  Contents ................................ ................................ ................................ ....... 2 2    Introduction ................................ ................................ ................................ . 3 3  General API Services ................................ ................................ ................... 4 

3.1   Login................................ ................................ ................................ ....................... 4  4   Read-Only API Services ................................ ................................ .............. 5 

4.1  Get Sports ................................ ................................ ................................ ...............5 4.2  Get Events for a Sport ................................ ................................ ............................. 6  4.3  Get Events for a Parent Event................................ ................................ ..................9 4.4  Get Market and Price Information ............. ............. ...... .............. ............. ..... ........... 11 4.5  Get Matched and Unmatched Bets on a Market ............. ............. ...... ................... .... 18 4.6    Retrieve Current Bets Report ............. ............. ...... ....................... ......... ................... 20 4.7    Retrieve Account Statement ............ .............. ...... ............ ............. ....... ............. ........ 24 4.8   Retrieve Bet History ................................ ................................ ................................ 27  

5   Betfair Simple Data Types ................................ ................................ ........... 30 

Page 3: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 3/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 3 of 33

2 Introduction

This document outlines the services that are available via the Betfair Read-Only Application Programmers Interface (API). The API is aSOAP interface available through web services. The URL for the API is http://services.betfair.com . Accessing this URL directly will return

the Web Services Definition Language (WSDL) file, which holds details of the services and associated XML objects. The services aredetailed on the following pages giving the service description, name, input parameters and service response. Many of the input

parameters and return values are given as enumerated types in order to allow comprehensive validation. The enumerated types are

shown in section 5.

Page 4: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 4/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 4 of 33

3 General API Services

3.1 Login

Name

ServiceLogin

Description

Logs the user in and instigates a sessionService URL

http://services.betfair.com/ServiceLogin 

Input Parameters

Parameter Mandatory/Optional Type & Length Description

Username Mandatory String(50) Your Betfair Username.

Password Mandatory String(50) Your Betfair Password.

Service Response

The header is returned over a secure link (i.e. SSL) and it will contain the following:

y  Encrypted account id, timestamp (date and time the session was created), returnvalue (0 = success, -1 = internal error)and currency (currency for the account).

y  Timestamp (date and time the session was created) ± not encrypted

This header must be attached to all subsequent API service calls.

Page 5: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 5/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 5 of 33

4 Read-Only API Services

4.1 Get Sports

Name

GetSports

Description

Gets the current list of sports present on the database.Service URL

http://services.betfair.com/GetSports 

Input Parameters

none

Service Response

The response will contain the SportItems XML object containing one or more SPORT XML objects.

XML Objects Structure:

SportItems

SportSportSport

Etc.

XML Object: SportItems

XML tagname

Type Definition / Mapping Rules Notes

Sport Object:Sport One or more Sport objects will be returned.

Timestamp Object:BetfairDateTime See simple type definition for objectBetfairDateTime.

This item is not currently populated.

Page 6: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 6/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 6 of 33

The date and time the SportItems object was

returned.

XML Object: Sport

XML tag

name

Type Definition / Mapping Rules Notes

SportID Integer(12) Unique identifier for the sport.

SportName String(50) Name of the sport (eg. µSoccer¶)

OrderIndex String(50) The order in which the sports are to be ordered

(presentation only).

This item is not currently populated

Timestamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime.The date and time the Sport object was returned.

This item is not currently populated

4.2 Get Events for a Sport

Name

GetSportEvents

Description

This service returns the highest level events for a given Sport ID.

Service URL

http://services.betfair.com/GetSportEvents 

Input ParametersParameter Mandatory/Optional Type & 

Length

Description / Validation

SportID Mandatory Integer(12) The sport id for which the highest level events

are required.

Page 7: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 7/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 7 of 33

Service Response

The response will contain an XML object BetEventItems which will contain one or more BetEvent XML objects which will in turn contain anumbers of attributes for each event where these events are the highest level events for that sport.

XML Objects Structure:

BetEventItems

BetEventBetEventBetevent

Etc.

XML Object: BetEventItems 

XML tag

name

Type Definition / Mapping Rules Notes

BetEvent Object:BetEvent One or more BetEvent objects will be returned.Timestamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime.

The date and time the BetEventItems object wasreturned.

This item is not currently populated

XML Object: BetEvent (high level event)

The BetEvent is to be reviewed with a view to incorporating more fields, such as market type, but a full list has not yet been compiled.

XML tagname

Type Definition / Mapping Rules Notes

EventID Integer(12) Unique identifier for the event.

EventName Object:EventName See simple type definition for object EventName.

Name of the event (market).

Country Object:BetfairCountry See simple type definition for object This item is not currently populated

Page 8: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 8/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 8 of 33

BetfairCountry. The unique identifier for the

country where the event is taking place (eg. µGB¶ = United Kingdom). This will need to be related to

the country name through the use of the

reference data which will be provided to the APIcustomers.

SportID Integer(12) The unique identifier for the sport to which the

event belongs.

This item is not currently populated

EventLevel Object:EventLevel See simple type definition for object EventLevel.

Level of event in menu.

ParentEveID Integer(12) The unique identifier for the parent event for thisevent (i.e. the event immediately above this event

in the event hierarchy).

MenuPath Object:MenuPath See simple type definition for object MenuPath.The complete path of events for this event (i.e. all

the events which need to be navigated to in order

to reach this event). The event names areseparated by µ/¶.

This item is not currently populated

TimeZone Object:Timezone See simple type definition for object Timezone.The timezone within which the event is takingplace. Note that all dates and times are returned

in GMT and so the offset to calculate the time of 

the race in the country (timezone) where it isactually taking place will need to be calculated

using the offset for this timezone against GMT.

This item is not currently populated

Timestamp Object:BetfairDateTime See simple type definition for objectBetfairDateTime. The date and time that this

BetEvent object was retrieved.

This item is not currently populated

StartTime Object:BetfairDateTime See simple type definition for objectBetfairDateTime. This is the time that the market

is supposed to start (i.e. the race is supposed tostart) and is used as part of the name of the

market (race).

This item is not currently populated

Page 9: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 9/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 9 of 33

4.3 Get Events for a Parent Event

Name

GetEventsForEvent

Description

This service will retrieve all the events for a given parent event ID.

Service URL

http://services.betfair.com/GetEventsForEvent 

Input Parameters

Parameter Mandatory/Optional Type & Length

Description / Validation

ParentEventID Mandatory Integer(12) The event id for the event for which all the lower level events

are required.

Service Response

The response will contain an XML object BetEventItems which will contain one or more BetEvent XML objects which will in turn contain a

numbers of attributes for each event where these events are the highest level events for that sport.

XML Objects Structure:

BetEventItemsBetEvent

BetEventBeteventEtc.

XML Object: BetEventItems

Page 10: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 10/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 10 of 33

The BetEvent is to be reviewed with a view to incorporating more fields, such as market type, but a full list has not yet been compiled.

XML tag

name

Type Definition / Mapping Rules Notes

BetEvent Object:BetEvent The BetEvent item represents an Event which can

either be a parent event or a market. The

difference between a parent event and a market(both are events) is that markets have selections

and thus prices against it. Bets are placed on the

selections (runners) within the market.

Timestamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time the group of 

BetEvent items were returned.

This item is not currently populated

XML Object: BetEvent

XML tagname

Type Definition / Mapping Rules Notes

EventID Integer(12) Unique identifier for the event.

EventName Object:EventName See simple type definition for object EventName.

Name of the event (market).

Country Object:BetfairCountry See simple type definition for object

BetfairCountry. The unique identifier for the

country where the event is taking place (eg. µGB¶ = United Kingdom). This will need to be related to

the country name through the use of thereference data which will be provided to the APIcustomers.

This item is not currently populated

SportID Integer(12) The unique identifier for the sport to which the

event belongs.

This item is not currently populated

EventLevel Object:EventLevel See simple type definition for object EventLevel.

Page 11: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 11/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 11 of 33

Level of event in menu

ParentEveID Integer(12) The unique identifier for the parent event for thisevent (i.e. the event immediately above this event

in the event hierarchy).

MenuPath Object:MenuPath See simple type definition for object MenuPath.The complete path of events for this event (i.e. all

the events which need to be navigated to in order

to reach this event). The event names areseparated by µ/¶.

This item is not currently populated

TimeZone Object:Timezone See simple type definition for object Timezone.

The timezone within which the event is takingplace. Note that all dates and times are returned

in GMT and so the offset to calculate the time of 

the race in the country (timezone) where it isactually taking place will need to be calculatedusing the offset for this timezone against GMT.

This item is not currently populated

Timestamp Object:BetfairDateTime See simple type definition for objectBetfairDateTime. The date and time that this

BetEvent object was retrieved.

This item is not currently populated

StartTime Object:BetfairDateTime See simple type definition for objectBetfairDateTime. This is the time that the market

is supposed to start (i.e. the race is supposed to

start) and is used as part of the name of themarket (race).

This item is not currently populated

4.4 Get Market and Price Information

Name

RefreshMarket

Description

This service retrieves the market price information for all runners on the specified market (event id).

Page 12: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 12/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 12 of 33

Service URL

http://services.betfair.com/RefreshMarket

Input Parameters

Parameter Mandatory/Optional Type & Length Description / Validation

MarketID Mandatory Integer(12) The market id for the market for which the selection andprice information is required.

Service Response

The response will contain a XML object Market. The Market XML object will contain a RunnerItems XML object which is a list of RunnerXML objects. Each Runner XML object will have a Selection XML object.

XML Objects Structure:

MarketRunnerItems

RunnerSelection

RunnerSelection

Runner

SelectionEtc.

XML Object: Market 

XML tag name Type Definition / Mapping Rules Notes

MarketID Integer(12) Unique identifier for the market.

EventName Object:EventName See simple type definition for object

EventName. Name of the market.

Country Object:BetfairCountry See simple type definition for objectBetfairCountry. The unique identifier for the

Page 13: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 13/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 13 of 33

country where the event is taking place (eg.

 µGB¶ = United Kingdom). This will need to berelated to the country name through the use

of the reference data which will be provided to

the API customers.

SportID Integer(6) The unique identifier for the sport to which the

market belongs.

MarketOpenedDate Object:BetfairDateTime

See simple type definition for objectBetfairDateTime. The date and time that the

market was actually opened for betting.

MarketType Object:MarketType See simple type definition for objectMarketType.

Status Object:MarketStatus See simple type definition for object

MarketStatus.The status of the market.

NoOfWinners Integer(2) The number of winners in the market. If µ0¶ is

returned (eg in Total Goals or Asian Handicap

markets) then return µN/A¶.

MarketInfo Object:MarketInfo See simple type definition for object

MarketInfo. The MarketInfo is a combinationof details about the market including the

 µEventDate¶ plus the µTextData¶ from theGreyText objects plus the µInformation¶ 

attribute from object BetEvent. This textdetails the rules which apply to the market

and in the case of horse racing the reduction

factors for withdrawals are shown.

ParentEveID Integer(12) The unique identifier for the parent event for

this market (i.e. the event immediately abovethis market in the event hierarchy).

This item is not currently populated

MarketDate Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time the

market is supposed to start (eg. theadvertised date and time of the off in horse

Page 14: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 14/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 14 of 33

racing).

InplayDelay Object:InplayDelay See simple type definition for objectInplayDelay. The delay (in seconds) for

placing a placing a bet whilst the market is in

play.

MenuPath Object:MenuPath See simple type definition for object

MenuPath. The complete path of events for

this market (i.e. all the events which need tobe navigated to in order to reach this market).

The event names are separated by µ/¶.

RunnersMayBeAdded Boolean This indicates whether the market may beincomplete and a runner may be added if that

runner is the winner and was not originally

included. True = runners may be added, False= runners may not be added. A good exampleof this is where the top 10 athletes are

included as possible winners for a marathon,but the winner was actually an unknown

runner whom nobody thought would win orperhaps hadn¶t even been heard of before.

This item is not currently populated

StartTime Object:BetfairDateTime See simple type definition for object

BetfairDateTime. This is the time that themarket is supposed to start (i.e. the race is

supposed to start) and is used as part of the

name of the market (race).

TimeZone Object:Timezone See simple type definition for object Timzone.

The timezone within which the market is

taking place. Note that all dates and times arereturned in GMT and so the offset to calculate

the time of the race in the country (timezone)

where it is actually taking place will need to becalculated using the offset for this timezone

against GMT.

Page 15: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 15/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 15 of 33

Runners Object:RunnerItems A RunnerItems object will be returned.

Timestamp Object:BetfairDateTime See simple type definition for objectBetfairDateTime. The date and time that this

Market object was retrieved.

This item is not currently populated

XML Object: RunnerItems

XML tag name Type Definition / Mapping Rules Notes

MarketID Integer(12) The unique identifier of the market to which the

runner belongs.

SupEveID Integer(12) For Asian Handicap markets - relates to eventid.

MarketTimestamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time that thisRunnerItems object was returned

This item is not currently populated

Timestamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time that this

RunnerItems object was retrieved.

This item is not currently populated

Runner Object: Runner One or more Runner objects will be returned.

XML Object: Runner

XML tag name Type Definition / Mapping Rules Notes

MarketID Integer(12) The unique identifier of the market to whichthe runner belongs.

Selection Object:Selection The selection object for this runner withinthe market.

BackOdds1 Double(12,6) The best back odds available for the

selection on the market.

Page 16: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 16/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 16 of 33

BackOdds2 Double(12,6) The 2nd best back odds available for the

selection on the market.

BackOdds3 Double(12,6) The 3rd best back odds available for the

selection on the market.

BackStake1 Decimal(12,6) The stake associated with the best back oddsavailable for the selection on the market.

BackStake2 Decimal(12,6) The stake associated with the 2nd best back

odds available for the selection on themarket.

BackStake3 Decimal(12,6) The stake associated with the 3rd best back

odds available for the selection on themarket.

LayOdds1 Double(12,6) The best lay odds available for the selection

on the market.

LayOdds2 Double(12,6) The 2nd best lay odds available for theselection on the market.

LayOdds3 Double(12,6) The 3rd best lay odds available for the

selection on the market.

LayStake1 Decimal(12,6) The stake associated with the best lay oddsavailable for the selection on the market.

LayStake2 Decimal(12,6) The stake associated with the 2nd best layodds available for the selection on themarket.

LayStake3 Decimal(12,6) The stake associated with the 3rd best layodds available for the selection on the

market.

Warning1 Object:Warning1 See simple type definition for object

Warning1. Has a specific use in greyhoundracing ± relates to vacant traps.

Warning2 Integer(2) Has a specific use in greyhound racing ±relates to vacant traps.

OrderIndex Integer(4) The order (sequence) in which the selection

is listed for this market on the Web App (for

This item is not currently populated

Page 17: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 17/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 17 of 33

presentation purposes only).

ReductionFactor Integer(5,3) The reduction factor to be applied if thisrunner is withdrawn from the market.

This item is not currently populated

SuperEventID Integer(12) For Asian Handicap markets - relates to

event id

Handicap Double(12,3) The handicap value for this runner.

MarketTimeStamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time that this

Runner object was returned.

This item is not currently populated

Timestamp Object:BetfairDateTime See simple type definition for objectBetfairDateTime. The date and time that this

Runner object was returned.

This item is not currently populated

XML Object: Selection

XML tag name Type Definition / Mapping Rules Notes

SelectionID Integer(12) The unique identifier for the selection.SelectionName Object:SelectionName See simple type definition for object

SelectionName. The name of the selection (eg.In horse racing this will be the name of the

horse. In Asian Handicap markets this will bethe µArsenal +0.5¶)

SportID Integer(12) The unique identifier for the sport to which this

selection belongs.

This item is not currently populated

Timestamp Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time that thisSelection object was retrieved.

This item is not currently populated

Page 18: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 18/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 18 of 33

4.5   Get Matched and Unmatched Bets on a Market 

Name

GetMarketBets

Description

This service will retrieve your matched and unmatched bets (current bets) on that market.

Service URL

http://services.betfair.com/GetMarketBets 

Input Parameters

Parameter Mandatory/Optional Type & 

Length

Description / Validation

MarketID Mandatory Integer(12) The market id for the market for which the customer wishes

to view their bets.

SuperEventID Mandatory for AsianHandicap Markets

Integer(12) Specific use for Asian Handicaps

Service Response

The UserBets XML object will be returned. The UserBets XML object will contain two BetItems XML objects (one for matched bets and one

for unmatched bets). The BetItems XML objects will each contain a Bet XML object for each matched / unmatched bet for this cu stomerfor this market or market + selection.

XML Objects Structure:

UserBetsBetItems (matched bets)

BetBetBetEtc.

Page 19: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 19/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 19 of 33

BetItems (unmatched Bets)BetBet

Bet

Etc.

XML Object: UserBets

XML tag name Type Definition / Mapping Rules

MarketID Integer(12) The unique identifier for the market to which the bets belong.SuperEventID Integer(12) For Asian Handicap markets - relates to event id.

MatchedBets Object:BetItems A BetItems object containing the matched bets for the customer for

this market.

UnMatchedBets Object:BetItems A BetItems object containing the unmatched bets for the customerfor this market.

Timestamp Object:BetfairDateTime See simple type definition for object BetfairDateTime. The date and

time that this UserBets object was retrieved.

XML Object: BetItems

XML tag name Type Definition / Mapping Rules

MarketID Integer(12) The unique identifier for the market to which the bets belong.

SuperEventID Integer(12) For Asian Handicap markets - relates to event id.

Bet Object:Bet A Bet object containing the matched / unmatched bets for the customerfor this market.

Timestamp Object:BetfairDateTime See simple type definition for object BetfairDateTime. The date and time

that this BetsItems object was retrieved.

XML Object: Bet

XML tag name Type Definition / Mapping Rules Notes

BetID Integer(12) The unique identifier for the bet.

Page 20: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 20/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 20 of 33

Currency Object:BetfairCurrency See simple type definition for object

BetfairCurrency

SelectionID Integer(12) The unique identifier for the selection against

which this bet was placed.

Status Object:BetStatus See simple type definition for object BetStatus This item is not currently populated

AmountAsked Decimal(12,2) The amount asked for this bet.

PriceMatched Double(12,2) The actual price taken (in the currency specified

by the CurrencyID).BetType Object:BetType See simple type definition for object BetType

PlacedDate Object:BetfairDateTime See simple type definition for object

BetfairDateTime.The date and time the bet was placed.

MatchedDate Object:BetfairDateTime See simple type definition for object

BetfairDateTime.

The date and time the bet was last matched.

SuperEventID Integer(12) For Asian Handicap markets - relates to eventid.

Timestamp Object:BetfairDateTime See simple type definition for objectBetfairDateTime.The date and time that this Bet object was

retrieved.

This item is not currently populated

4.6 Retrieve Current Bets Report

Name

GetCurrentBets

Page 21: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 21/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 21 of 33

Description

This service retrieves all the current bets for your account for the specified status of bet. This service will have throttling capability. As

per all other service calls, the header will contain the encrypted account id to identify which bets to retrieve. 11 different Current Betsreports are available.

Service URL

http://services.betfair.com/GetCurrentBets 

Input Parameters

Parameter Mandatory/Optional Type & Length Description / Validation

ReportID Mandatory Object:Current

BetsReportID

See simple type definition for object CurrentBetsReportID.

Indicates which current bets report should be returned forthis customer (account).

Cancelled bets

 µ0¶ = Retrieve cancelled bets and order by cancelled date

 µ1¶ = Retrieve cancelled bets and order by market name

Matched bets

 µ2¶ = Retrieve matched bets Current in classic view

 µ4¶ = Retrieve matched bets in detail format and order by

matched date

 µ5¶ = Retrieve matched bets in detail format and order by

market name

 µ6¶ = Retrieve matched bets in consolidated format and order

by matched date

 µ7¶ = Retrieve matched bets in consolidated format and order

Page 22: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 22/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 22 of 33

by market name

Unmatched bets

 µ3¶ = Retrieve unmatched bets classic view

 µ8¶ = Retrieve unmatched bets and order by placed date

 µ9¶ = Retrieve unmatched bets and order by market name

Voided / Lapsed bets

 µ10¶ = Retrieve Voided / Lapsed bets and order by voided /

lapsed date

 µ11¶ = Retrieve Voided / Lapsed bets and order by marketname

MaxRecords Mandatory (a defaultof 0 is used, which will

retrieve no records)

Integer The maximum number of records to return with each servicerequest. Set StartRecord and make multiple requests to the

service to retrieve all the records. Specify a value between 1and 100.

StartRecord Optional (a defaultvalue of 0 is used)

Integer The record number to start from. Used to retrieve multiplesets of records where more than MaxRecords is retrieved witha single request. For example, call the service withStartRecord not set (i.e left as 0) ± if that retrieves

MaxRecords, then call the service again with a StartRecord of 

MaxRecords+1. If that retrieves MaxRecords then call theservice again with StartRecord set to 2 x MaxRecords +1 etc.

Page 23: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 23/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 23 of 33

Service Response

The response will contain a XML object BetReportItems which will contain one or more BetReport XML objects. The bets returned will

depend on the ReportID value specified when calling this service.

XML Objects Structure:

BetReportItems

BetReport

BetReport

BetReportEtc.

XML Object: BetReportItems

XML tag name Type Definition / Mapping Rules

BetReport Object:BetReport The bet report object.

XML Object: BetReport

XML tag name Type Definition / Mapping Rules Notes

BetID Integer(12) The unique identifier for the bet.

PlacedDate Object:BetfairDateTime See simple type definition for objectBetfairDateTime. The date and time the bet wasplaced.

MatchedDate Object:BetfairDateTime See simple type definition for object

BetfairDateTime. The date and time the bet was

last matched.MarketID Integer(12) The unique identifier for the market to which the

bet belongs.

MarketName Object:EventName See simple type definition for object EventName.

The name of the market to which this bet

Page 24: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 24/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 24 of 33

belongs.

SelectionID Integer(12) The unique identifier for the selection againstwhich this bet was placed.

SelectionName Object:SelectionName See simple type definition for object

SelectionName. The name of the selectionagainst which this bet was placed.

PriceAsked Double(12,2) The price asked for this bet (in the currency

specified by the Currency).

PriceMatched Double(12,2) The actual price taken (in the currency specified

by the Currency).AmountAsked Decimal(12,2) The amount asked for this bet.

BetType Object:BetType See simple type definition for object BetType. This item is not currently populated

MarketType Object:MarketType See simple type definition for objectMarketType.

This item is not currently populated

4.7 Retrieve Account Statement

Name

GetAcctStmt

Description

This service retrieves all the account statement items for this customer (account) for the specified report id. This service will have

throttling capability. As per all other service calls, the header will contain the encrypted account id to identify which account statementitems to retrieve. Two versions of the Account Statement can be retrieved.

Service URL

http://services.betfair.com/GetAcctStmt Input Parameters

Parameter Mandatory/Optional Type & Length Description / Validation

ReportID Mandatory Object:AcctStmt

ReportID

See simple type definition for object AcctStmtReportID.

Indicates which account statement items should be

Page 25: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 25/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 25 of 33

returned for this customer (account).

 µ0¶ = Get Account Statement for Everything

 µ1¶ = Get Account Statement for Withdrawals and Depositsonly

StartDate Optional (a defaultvalue of 3 months

prior to the currentdate is used)

BetfairDateTime The earliest date for which records will be retrieved.

EndDate Optional (a default

value of the current

date is used)

BetfairDateTime The latest date for which records will be retrieved.

MaxRecords Mandatory (a defaultof 0 is used, which will

retrieve no records)

IntegerThe maximum number of records to return with eachservice request. Set StartRecord and make multiple

requests to the service to retrieve all the records. Specify avalue between 1 and 100.

StartRecord Optional (a default

value of 0 is used)

Integer The record number to start from. Used to retrieve multiple

sets of records where more than MaxRecords is retrievedwith a single request. For example, call the service with

StartRecord not set (i.e left as 0) ± if that retrievesMaxRecords, then call the service again with a StartRecord

of MaxRecords+1. If that retrieves MaxRecords then call theservice again with StartRecord set to 2 x MaxRecords +1etc.

Page 26: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 26/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 26 of 33

Service Response

The response will contain a XML object AcctStmtItems which will contain one or more AcctStmt XML objects. The account statement

records returned will depend on the ReportID value specified when calling this service.

XML Objects Structure:

AcctStmtItems

AcctStmt

AcctStmt

AcctStmtEtc.

XML Object: AcctStmtItems

XML tag name Type Definition / Mapping Rules

AcctStmt Object: AcctStmt The account statement object.

XML Object: AcctStmt

WinLose Object:WinLose See simple type definition for object WinLose. µWIN¶ / µLOSE¶ 

(applies to bets)

TransactionType Object:TransactionType See simple type definition for object TransactionType. µD¶ = debit,

 µC¶ = credit

Amount Decimal(12,2) The amount won / lost for bets or amount deposited / withdrawn

AccountBalance Decimal(12,2) Latest account balance (if ordering by SettledDate)

MarketID Integer(12) The unique identifier of the market to which the bet applies (not

applicable for deposits / withdrawals)

BetType Object:BetType See simple type definition for object BetType.

Page 27: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 27/33

Page 28: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 28/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 28 of 33

retrieve no records) multiple requests to the service to retrieve allthe records. Specify a value between 1 and 100.

StartRecord Optional (a default

value of 0 is used)

Integer The record number to start from. Used to

retrieve multiple sets of records where more

than MaxRecords is retrieved with a singlerequest. For example, call the service with

StartRecord not set (i.e left as 0) ± if thatretrieves MaxRecords, then call the serviceagain with a StartRecord of MaxRecords+1. If 

that retrieves MaxRecords then call the service

again with StartRecord set to 2 x MaxRecords+1 etc.

Service Response

The response will contain an object BetHistoryItems which will contain one or more BetHistory objects. The number of days historyreturned will depend on the TimePeriod value specified when calling this service.

XML Objects Structure:

BetHistoryItemsBetHistory

BetHistory

BetHistoryEtc.

XML Object: BetHistoryItems

XML tag name Type Definition / Mapping RulesBetHistory Object:

BetHistoryThe bet history object.

Page 29: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 29/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 29 of 33

XML Object: BetHistory

XML tag name Type Definition / Mapping Rules

MatchedUnMatched Object:MatchedUnmatched See simple type definition for object MatchedUnmatched.

BetID Integer(12) The unique identifier for the bet / deposit / withdrawal.

PlacedDate Object:BetfairDateTime See simple type definition for object BetfairDateTime. The dateand time the bet was placed.

MarketID Non Positive Integer(12) The unique identifier of the market to which the bet applies

(not applicable for deposits / withdrawals)

MarketName Object:EventName See simple type definition for object EventName. The name of the market to which this bet belongs.

SelectionID Non Positive Integer(12) The unique identifier for the selection against which this betwas placed.

SelectionName Object:SelectionName See simple type definition for object SelectionName. The name

of the selection against which this bet was placed.

PriceAsked Double(12,2) The price asked for this bet (in the currency specified by the

CurrencyID).

PriceMatched Double(12,2) The actual price taken (in the currency specified by the

CurrencyID).AmountAsked Decimal(12,2) The amount asked for this bet.

BetType Object:BetType See simple type definition for object BetType.

Page 30: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 30/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 30 of 33

5 Betfair Simple Data Types

In order to provide comprehensive validation on certain fields we have provided simple enumerated data types for some of the input and

output parameters. This section details the types we have used.

Simple Type Name Type Format/Values Max Length

BetfairDateTime DateTime Yyyy-MM-ddTHH:mm:ss n/a

SportName String n/a 50

OrderIndex String n/a 50

EventName String n/a 50

BetfairCountry String n/a 2

MenuPath String n/a 300

Timezone String n/a 64

MarketType String µA¶ = Handicap

 µO¶ = Odds

 µL¶ = Line

 µS¶ = Range

 µ¶ = Just in case

n/a

MarketStatus String µA¶ = Active

 µS¶ = Suspended µC¶ = Closed

 µI¶ = Inactive

n/a

MarketInfo String n/a 1000

Page 31: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 31/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 31 of 33

InplayDelay Integer (in seconds) 5

Warning1 String n/a 75

SelectionName String n/a 30

EventLevel String n/a 1

BetfairCurrency String n/a (see reference data) 3

BetStatus String µF¶ = Matched

 µU¶ = Unmatched

 µC¶ = Cancelled

 µL¶ = Lapsed

 µV¶ = Voided

n/a

BetType String µB¶ = Back Odds Markets

 µL¶ = Lay Odds Markets

 µBA¶ = Back Asian HandicapMarkets

 µLA¶ = Lay Asian HandicapMarkets

 µBL¶ = Buy Line Markets

 µSL¶ = Sell Line Markets

 µBS¶ = Buy Range Markets

 µSS¶ = Sell Range Markets

n/a

CurrentBetsReportID Integer 0 = Cancelled Bets and Order byCancelled Date

1 = Cancelled Bets and Order by

n/a

Page 32: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 32/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 32 of 33

Market Name

2 = Matched Bets Classic View

3 = Unmatched Bets Classic

View

4 = Matched Bets Detail byMatched Data

5 = Matched Bets Detail By

Market Name6 = Matched Bets Consolidated

By Matched Data

7 = Matched Bets Consolidated

By Market Name

8 = Unmatched Bets By PlacedDate

9 = Unmatched Bets by Market

Name

10 = Voided / Lapsed ordered by

date

11 = Voided / Lapsed ordered byMarket

AcctStmtReportID Integer 0 = Include Everything

1 = Withdrawals and Deposits

EventDescription String n/a 75

WinLose String µWIN¶ / µLOSE¶ 4

TransactionType String µD¶ = Debit n/a

Page 33: Read Only Technical Documentation

8/8/2019 Read Only Technical Documentation

http://slidepdf.com/reader/full/read-only-technical-documentation 33/33

Technical Documentation - Draft

Betfair.com ± confidential Read-Only API Page 33 of 33

 µC¶ = Credit

BetHistoryTimePeriod Integer Min inclusive value = -90

Max inclusive value = 0

n/a

MatchedUnmatched Integer 0 = matched

1 = unmatched

n/a