Skip to content
  • There are no suggestions because the search field is empty.

We received odds: null for some markets. Why is that?

Sometimes, the odds are not (yet) available on a market. That's why it's advisable to execute odds-related methods only on the markets that have odds and to check if the outcomes on the markets are active, like in this example from our Java SDK Demo Example:

for (MarketWithOdds marketOdds : message.getMarkets()) {

    String marketDescription = marketOdds.getName();
    int marketId = marketOdds.getId();
    System.out.println("\nPRODUCER " + producerId + " - Received market ID " + marketId + ": " + marketDescription);
    System.out.println("Market status: " + marketOdds.getStatus());

    if (marketOdds.getStatus() == MarketStatus.ACTIVE) {
        for (OutcomeOdds outcomeOdds : marketOdds.getOutcomeOdds()) {

            String outcomeDesc = outcomeOdds.getName();
            String outcomeValue = outcomeOdds.getOdds(OddsDisplayType.DECIMAL).toString();

            System.out.println("Outcome: " + outcomeDesc + " " + outcomeValue);
        }
    }
}