Developer Hub
🔮 For applications
Guides & Tutorials
How to add political / social markets

Apart from the predominant sports markets, Azuro now allows to integrate political and social markets, starting with the "2024 Presidential Election USA" market.

ℹ️

If you use our SDK, no additional changes are needed; just ensure you are using version 5.1.0 or above.

The steps to get custom (i.e. markets other than sport markets) are the same as for sports markets, but there is a slight difference in how the names of markets and selections are generated.

GraphQL

For sports markets, you use the @azuro-org/dictionaries (opens in a new tab) library to gain names for markets and selections, but for custom markets, you need to use the title field from the Condition and Outcome entities:

fragment PrematchCondition on Condition {
  title # it's custom market's name
  # your condition fields
  outcomes {
    title # it's selection's name
    # your outcome fields
  }
}

Same for prematch bets:

fragment PrematchBet on Bet {
  selections {
    outcome {
      title # it's selection's name
      condition {
        title  # it's custom market's name
      }
    }
  }
}
 
  • title field in Condition entity is custom market's name
  • title field in Outcome entity is selection's name in custom market
ℹ️

For sports markets this fields will be null.

Title field usage

Make sure you use the title field in your market generating function.

import { getMarketName, getSelectionName } from '@azuro-org/dictionaries'
 
conditions.forEach((condition) => {
  const customMarketName = condition.title
 
  condition.outcomes.forEach((outcome) => {
    const customSelectionName = outcome.title
 
    // If customMarketName has a value, then use it as marketName; otherwise, use the getMarketName function.
    const marketName = customMarketName || getMarketName({ outcomeId: outcome.outcomeId })
 
    // If customSelectionName has a value, then use it as selectionName; otherwise, use the getSelectionName function.
    const selectionName = customSelectionName || getSelectionName({ outcomeId: outcome.outcomeId, withPoint: true })
  })
})