Wrapper server API

A wrapper server connects to the sports feed and proxies the data using TCP sockets and json messages. Clients can connect to this proxy to consume the feed.

The feed stream consists of a series of insert, update and delete messages. Clients can apply these messages sequentially to obtain a current snapshot of the feed. This API documents the various messages that are sent between the wrapper server and a client. Messages are transmitted in Json string unless stated otherwise.

Insert Match

Inserts one or more new matches into the snapshot

Message Attributes

Attribute Name Type Presence Description
type string always Set to ‘MATCH_INSERT’
match List<Match> always List of matches to be inserted

Example

The following message inserts a single soccer match.

{
  "type": "MATCH_INSERT",
  "match": [
    {
      "sportType": "SOCCER",
      "id": "60256d4996201811",
      "league": "English National League North",
      "host": "Gainsborough Trinity",
      "guest": "Brackley Town",
      "startTime": 1520970300
    }
  ]
}

Update Match

Updates one or more existing matches in the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘MATCH_UPDATE’
match List<Match> always List of matches to be modified

Delete Match

Removes one or more existing matches from the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘MATCH_DELETE’
match List<Match> always List of matches to be removed

Insert Event

Inserts one or more new events into the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘EVENT_INSERT’
event List<Event> always List of events to be inserted

Update Event

Updates one or more existing events in the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘EVENT_UPDATE’
event List<Event> always List of events to be modified

Example

The following message updates a single event. The event is a main betting event with live odd records.

This event also contains state from 2 separate sportbook sources. Note how the different sportbooks can publish different states.

{
  "type": "EVENT_UPDATE",
  "event": [
    {
      "eventType": "NONE",
      "id": "60256d4996201811",
      "matchId": "60256d4996201811",
      "eventStates": [
        {
          "source": "SBO",
          "duration": 31,
          "hostScore": 1,
          "guestScore": 0,
          "hostCard": 0,
          "guestCard": 0,
          "segment": "LIVE"
        },
        {
          "source": "CROWN",
          "duration": 30,
          "hostScore": 1,
          "guestScore": 0,
          "hostCard": 0,
          "guestCard": 0,
          "segment": "LIVE"
        }
      ]
    }
  ]
}

Delete Event

Removes one or more existing events from the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘EVENT_DELETE’
event List<Event> always List of events to be removed

Insert Odd

Inserts one or more new odd records into the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘ODD_INSERT’
record List<Odd> always List of odd records to be inserted

Example

The following message inserts a single odd record. This odd is offered by Crown.

{
  "type": "ODD_INSERT",
  "record": [
    {
      "source": "CROWN",
      "matchId": "60256d4996201811",
      "eventId": "60256d4996201811",
      "id": 33554570,
      "oddType": "EARLY",
      "oddFormat": "HK",
      "lbType": "BACK",
      "timeType": "HT",
      "pivotValue": 0,
      "pivotBias": "NEUTRAL",
      "pivotType": "ONE_TWO",
      "isSwapped": false,
      "rateOver": 4.5,
      "rateUnder": 2.32,
      "rateEqual": 2.15
    }
  ]
}

Update Odd

Updates one or more existing odd records in the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘ODD_UPDATE’
record List<Odd> always List of odd records to be modified

Delete Odd

Removes one or more existing odd records from the snapshot

Message Attributes

Attribute name Type Presence Description
type string always Set to ‘ODD_DELETE’
record List<Odd> always List of odd records to be removed

Reset

Removes all records that belong to the sport, source and odd type.

Special care must be taken when deleting odd records. source and oddType attributes can be compared against the odd record directly. In order to obtain sportType, the parent event and match containers must be referenced. Clients must traverse up the container event and match hierarchy and find the match which odd record belongs to. Upon finding the container, the sportType attribute can be compared against the match record.

Attribute name Type Presence Description
type string always Set to ‘RESET’
partitions List<PartitionKey> always Partitions to be removed

Refresh

Indicator to show that the client is still connected to a particular partition. Client will receive the refresh message when the partition has no updates. A partition consist of source , oddType and sportType

Attribute name Type Presence Description
type string always Set to ‘REFRESH’
partitions List<PartitionKey> always Partitions refreshed

Match

SoccerMatch

Attribute name Type Presence Description
sportType string always Set to ‘SOCCER’
id string always Match id
league string always League name
host string always Host name
guest string always Guest name
startTime int always Match start time in epoch seconds

TennisMatch

Attribute name Type Presence Description
sportType string always Set to ‘TENNIS’
id string always Match id
competition string always Competition name
playerOne string always Player 1 name
playerTwo string always Player 2 name
startTime int always Match start time in epoch seconds

BasketballMatch

Attribute name Type Presence Description
sportType string always Set to ‘BASKETBALL’
id string always Match id
league string always League name
host string always Host name
guest string always Guest name
startTime int always Match start time in epoch seconds

Event

A single betting event is a grouping of odds that are related. For example, soccer odds that bet on the score are grouped under a single main event. Odds that bet on the number of corners are grouped into a separate event. Each event belongs to exactly one match.

Events come with an optional event state. An event state structure stores match related statistics. In a soccer match, this includes information such as the current number of goals or the total number of corners taken. The exact statistic published depends on the nature of the event type.

Different sportbooks may each publish a different state. The list of event states contains information from various sportbooks. Each record can be distinguished by their source attribute.

SoccerEvent

Attribute name Type Presence Description
eventType string always One of NONE, NEXT_CORNER, TOTAL_CORNER, BOOKING or UNCATEGORIZED_SPECIAL
id string always Event id
matchId string always Id of parent match container
eventStates List<SoccerEventState> always Current state of the match. Each sportbook produces 1 entry in the list

SoccerEventState

Attribute name Type Presence Description
source string always The event state is retrieved from this sportbook
duration int always Total running time for the match in minutes
hostScore int always Current host score. 0 for non-live matches
guestScore int always Current guest score. 0 for non-live matches
hostCard int always Number of host red cards. 0 for non-live matches
guestCard int always Number of guest red cards. 0 for non-live matches
segment string always Current state of the match. One of PENDING, FIRST_HALF, HALF_BREAK, SECOND_HALF, FULL_BREAK, EXTRA_FIRST_HALF, EXTRA_HALF_BREAK, EXTRA_SECOND_HALF, PENALTY or FINISHED

TennisEvent

Attribute name Type Presence Description
eventType string always One of NONE, GAME or SET
id string always Event id
matchId string always Id of parent match container
eventStates List<TennisEventState> always Current state of the match. Each sportbook produces 1 entry in the list

TennisEventState

Attribute name Type Presence Description
source string always The event state is retrieved from this sportbook.
currentPointType string always One of GAME_POINT or TIEBREAK_POINT.
isAdv boolean always The flag that indicates whether the match is in advantage.
eventStats List<TennisStats> always Live stats of the match. Empty list for non-live matches or source without live stats.

TennisStats

Attribute name Type Presence Description
pXCurrentPoint int depends on live stats Current point of player X in current game.
pXCurrentSetWon int depends on live stats Current total set won by player X.
pXTotalGamesWoninS1 int depends on live stats Number of games won by player X in set 1.
pXTotalGamesWoninS2 int depends on live stats Number of games won by player X in set 2.
pXTotalGamesWoninS3 int depends on live stats Number of games won by player X in set 3.
pXTotalGamesWoninS4 int depends on live stats Number of games won by player X in set 4.
pXTotalGamesWoninS5 int depends on live stats Number of games won by player X in set 5.

Note that: X is either 1 or 2

BasketballEvent

Attribute name Type Presence Description
eventType string always One of NONE, FIRST_TO_20, LAST_BASKET, TEAM_POINTS or THREE_POINTERS
id string always Event id
matchId string always Id of parent match container
eventStates List<BasketballEventState> always Current state of the match. Each sportbook produces 1 entry in the list

BasketballEventState

Attribute name Type Presence Description
source string always The event state is retrieved from this sportbook.
segment string always Indicates the current match segment. One of QUARTER_1, QUARTER_2, QUARTER_3, QUARTER_4 ,PENDING, HALF_BREAK, QUARTER_BREAK, FIRST_HALF, SECOND_HALF, LIVE or OVERTIME.
duration int always Accumulated running time for the match in minutes. 0 for non-live matches.
hasQuarterScore boolean always True when the live match segment is in quarter. False when the live match segment is in halves.
eventStats List<BasketballStats> always Live stats of the match. Empty list for non-live matches or source without live stats.

BasketballStats

Attribute name Type Presence Description
teamXQ1Points int depends on live stats Points scored by team X in quarter 1.
teamXQ2Points int depends on live stats Points scored by team X in quarter 2.
teamXQ3Points int depends on live stats Points scored by team X in quarter 3.
teamXQ4Points int depends on live stats Points scored by team X in quarter 4.
teamXH1Points int depends on live stats Points scored by team X in first half.
teamXH2Points int depends on live stats Points scored by team X in second half.
teamXOtPoints int depends on live stats Points scored by team X in overtime.
teamXFtPoints int depends on live stats Total points scored by team X.

Note that: X is either 1 or 2

Odd

Attribute name Type Presence Description
source string always Name of the sportbook
matchId string always Id of parent match container
eventId string always Id of parent event container
id int always Odd id
oddType string Insert and update only One of LIVE, EARLY or TODAY
oddFormat string Insert and update only Odd rate format. One of HK or EU
lbType string Insert and update only Either LAY or BACK. Defaults to BACK for sportbook odds
timeType TimeType Insert and update only Indicates when the odd will settle. Type varies between sports
pivotValue float Insert and update only Handicap/total pivot value. Set to 0 for 1x2
pivotBias string Insert and update only Pivot bias for handicap odds. One of HOST or GUEST. Set to NEUTRAL for non handicap odds
pivotType string Insert and update only Pivot type. Set to HDP, TOTAL or ONE_TWO
isSwapped boolean Insert and update only Indicates if the over/under values are swapped as compared to the original sportbook
rateOver float Insert and update only Home odd
rateUnder float Insert and update only Guest odd
rateEqual float Insert and update only  

TimeType

SoccerTimeType

A string of either FT or HT

TimeType Description
FT Full Time
HT Half Time

TennisTimeType

Attribute name Type Presence Description
match int always Match number
set int always Set number
game int always Game number

BasketballTimeType

A string of any FT, H1, H2, Q1, Q2, Q3 or Q4

TimeType Description
FT Full Time
H1 First Half
H2 Second Half
Q1 First Quarter
Q2 Second Quarter
Q3 Third Quarter
Q4 Fourth Quarter

PartitionKey

Attribute name Type Presence Description
source string always Name of the sportbook
oddType string always One of LIVE, EARLY or TODAY
sportType string always Name of the sport