Odds operations
Get the configuration for all platform interactions
Odds operations are responsible for communicating with Sportal 365 Football API and specially with endpoint /v2/matches/livescore
The namespace is of course called odds. All methods return promises. The general design of the namespace follows this pattern unless stated otherwise:
General call:
sdk.odds .someMethod() .then((response) => { // Handle response }) .catch((error) => { // Handle error });
N.B
Odd client is required in SDK configuration to use all methods in Odds namespace. More information here
The responses are comprised of different objects you can find here.
Match related operations
Get odds for matches
Method: getByMatchIds(matchIds, filters?)
Model:
The method returns a Map instance where the keys are the match IDs and the values are Array instances of MatchOddsModel.
Filters object:
-
oddType:
OddTypeEnum
Determines which type of odds to retrieve based on when they are offered. Options include:
OddTypeEnum.PRE_EVENT
: Odds offered before the match begins
OddTypeEnum.LIVE
: Odds offered during the match in real-timeOddTypeEnum.ALL
: Both pre-event and live oddsDefault value:
OddTypeEnum.PRE_EVENT
-
scopeType:
ScopeTypeEnum
.Specifies the time period of the match for which the odds are applicable. Options include:
ScopeTypeEnum.ORDINARY_TIME
: Regular match time without extra time or penalties
ScopeTypeEnum.FULL_TIME
: Full time match including the extra time and penaltiesDefault value:
ScopeTypeEnum.ORDINARY_TIME
-
oddFormat:
OddFormatEnum
.Defines the format in which odds values are presented. Options include:
OddFormatEnum.DECIMAL
: Odds displayed in decimal format (e.g., 1.50, 4.00)
OddFormatEnum.FRACTIONAL
: Odds displayed in fractional format (e.g., 1/2, 3/1)OddFormatEnum.MONEYLINE
: Odds displayed in "American" forma (e.g., 200, 300)Default value:
OddFormatEnum.DECIMAL
-
marketTypes:
MatchOddsMarketEnum[]
.An array of market types to retrieve odds for. Options include:
MatchOddsMarketEnum.FT_1X2
: Full-time 1X2 odds (home win, draw, away win)
MatchOddsMarketEnum.DOUBLE_CHANCE
: The match will finish 1 or X, 2 or X, 1 or 2MatchOddsMarketEnum.HT_FT
: How will finish the first half (1X2) and full time (1X2)MatchOddsMarketEnum.BOTH_TEAMS_SCORE
: Both teams to score in the matchMatchOddsMarketEnum.CORRECT_SCORE
: The correct score of the matchMatchOddsMarketEnum.PLAYER_SCORE_FIRST_GOAL
: Player to score the first goal in matchMatchOddsMarketEnum.PLAYER_SCORE
: Player to score in matchMatchOddsMarketEnum.PLAYER_RED_CARD
: Player to receive red card in matchMatchOddsMarketEnum.PLAYER_YELLOW_CARD
: Player to receive yellow card in matchMatchOddsMarketEnum.OVER_GOALS_0_5
: There will be at least 1 goal in matchMatchOddsMarketEnum.OVER_GOALS_1_5
: There will be at least 2 goals in matchMatchOddsMarketEnum.OVER_GOALS_2_5
: There will be at least 3 goals in matchMatchOddsMarketEnum.OVER_GOALS_3_5
: There will be at least 4 goals in matchMatchOddsMarketEnum.OVER_GOALS_4_5
: There will be at least 5 goals in matchMatchOddsMarketEnum.OVER_GOALS_5_5
: There will be at least 6 goals in matchDefault value:
[FT_1X2]
Validations
Odd client in SDK configuration is required. matchIds parameter is required. filters is optional, however when invalid filter is provided for any of
oddType
,scopeType
,oddFormat
andmarketTypes
, a warning message will be logged. Example:The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : PRE_EVENT, LIVE, ALL
Example call:
import { OddTypeEnum, ScopeTypeEnum, OddFormatEnum, MatchOddsMarketEnum } from "fansunited-sdk-esm"; const filters = { oddType: OddTypeEnum.PRE_EVENT, scopeType: ScopeTypeEnum.ORDINARY_TIME, oddFormat: OddFormatEnum.DECIMAL, marketTypes: [MatchOddsMarketEnum.FT_1X2] }; const matchIds = ["id", "id2"]; sdk.odds .getByMatchIds(matchIds, filters) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: [
{
bookmaker: {
id: "557",
name: "Bookmaker",
url: "https://bookmaker.com/",
assets: [
{
"logo": "https://de2.sportal365images.com/process/smp-bookmaker-images/bookmaker.com/01092023/f8eefa23-fc77-4064-b782-492078083764.jpg",
"type": "LOGO",
"transparentBackgroundUrl": "https://sportal365images.com/original/smp-images-bookmaker/assets/08112023/9c86e7d7-09d4-4f7c-ad16-9103293dc7a8.svg",
"backgroundColor": "#000000"
}
],
links: [
{
"appType": "desktop",
"selectionTemplateUrl": null,
"eventTemplateUrl": "https://bookmaker.com/en/sports/evt/$event_id$",
"homepageUrl": "https://bookmaker.com/en/sports"
},
{
"appType": "mobile",
"selectionTemplateUrl": null,
"eventTemplateUrl": "https://bookmaker.com/en/sports/evt/$event_id$",
"homepageUrl": "https://bookmaker.com/en/sports"
}
],
"branding": null,
"eventUrls": [
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"stakesDisclaimer": "18+ risk of addiction",
"domainName": "bookmaker.com"
},
"type": "PRE_EVENT",
"markets": [
{
"type": {
"id": "68dc43b5-83ed-47d8-b334-7499728cfd8b",
"name": "1x2",
"code": "1x2",
"entityType": "market_type"
},
"scope": {
"id": "5106d422-50d3-4861-a047-50241e1b2f94",
"type": "ordinary_time",
"name": "ORDINARY TIME",
"entityType": "market_scope"
},
"selections": [
{
"id": "88008b9c-d3f7-4a2f-92bb-91e20f9138e5",
"name": "1",
"code": "1",
"value": null,
"odds": "1.50",
"urls": [
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"movement": "UP",
"oddsOld": "1.45",
"entityType": "market_selection",
"additionalInfo": null,
"providerInfo": {
"selectionId": "2356896586",
"eventId": "15308853",
"marketId": "1743827570",
"competitionId": null
}
},
{
"id": "2231dc5a-6fa4-4092-8510-159f21efd991",
"name": "x",
"code": "x",
"value": null,
"odds": "4.00",
"urls": [
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"movement": "DOWN",
"oddsOld": "4.20",
"entityType": "market_selection",
"additionalInfo": null,
"providerInfo": {
"selectionId": "2356896587",
"eventId": "15308853",
"marketId": "1743827571",
"competitionId": null
}
},
{
"id": "31977e63-f64e-4236-866b-b9944e5a4bb5",
"name": "2",
"code": "2",
"value": null,
"odds": "5.50",
"urls": [
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"movement": "DOWN",
"oddsOld": "5.75",
"entityType": "market_selection",
"additionalInfo": null,
"providerInfo": {
"selectionId": "2356896588",
"eventId": "15308853",
"marketId": "1743827572",
"competitionId": null
}
}
]
}
]
}
],
id2: [
{
bookmaker: {
id: "557",
name: "Bookmaker",
url: "https://bookmaker.com/",
assets: [
{
"logo": "https://de2.sportal365images.com/process/smp-bookmaker-images/bookmaker.com/01092023/f8eefa23-fc77-4064-b782-492078083764.jpg",
"type": "LOGO",
"transparentBackgroundUrl": "https://sportal365images.com/original/smp-images-bookmaker/assets/08112023/9c86e7d7-09d4-4f7c-ad16-9103293dc7a8.svg",
"backgroundColor": "#000000"
}
],
links: [
{
"appType": "desktop",
"selectionTemplateUrl": null,
"eventTemplateUrl": "https://bookmaker.com/en/sports/evt/$event_id$",
"homepageUrl": "https://bookmaker.com/en/sports"
},
{
"appType": "mobile",
"selectionTemplateUrl": null,
"eventTemplateUrl": "https://bookmaker.com/en/sports/evt/$event_id$",
"homepageUrl": "https://bookmaker.com/en/sports"
}
],
"branding": null,
"eventUrls": [
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"stakesDisclaimer": "18+ risk of addiction",
"domainName": "bookmaker.com"
},
"type": "PRE_EVENT",
"markets": [
{
"type": {
"id": "68dc43b5-83ed-47d8-b334-7499728cfd8b",
"name": "1x2",
"code": "1x2",
"entityType": "market_type"
},
"scope": {
"id": "5106d422-50d3-4861-a047-50241e1b2f94",
"type": "ordinary_time",
"name": "ORDINARY TIME",
"entityType": "market_scope"
},
"selections": [
{
"id": "88008b9c-d3f7-4a2f-92bb-91e20f9138e5",
"name": "1",
"code": "1",
"value": null,
"odds": "1.50",
"urls": [
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://bookmaker.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"movement": "UP",
"oddsOld": "1.45",
"entityType": "market_selection",
"additionalInfo": null,
"providerInfo": {
"selectionId": "2356896586",
"eventId": "15308853",
"marketId": "1743827570",
"competitionId": null
}
},
{
"id": "2231dc5a-6fa4-4092-8510-159f21efd991",
"name": "x",
"code": "x",
"value": null,
"odds": "4.00",
"urls": [
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"movement": "DOWN",
"oddsOld": "4.20",
"entityType": "market_selection",
"additionalInfo": null,
"providerInfo": {
"selectionId": "2356896587",
"eventId": "15308853",
"marketId": "1743827571",
"competitionId": null
}
},
{
"id": "31977e63-f64e-4236-866b-b9944e5a4bb5",
"name": "2",
"code": "2",
"value": null,
"odds": "5.50",
"urls": [
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "desktop"
},
{
"url": "https://betway.com/en/sports/evt/15308853",
"appType": "mobile"
}
],
"movement": "DOWN",
"oddsOld": "5.75",
"entityType": "market_selection",
"additionalInfo": null,
"providerInfo": {
"selectionId": "2356896588",
"eventId": "15308853",
"marketId": "1743827572",
"competitionId": null
}
}
]
}
]
}
]
}
Updated about 24 hours ago