Whats the best way to retrieve number of active runners?

Trying to regularly get the number of active runners in a race (excluding non-runners), what is the best way to do this? Is the only way to check the state of each contract in a market?

Hi Charlie,

Active runners will have the status set to active in this route: https://docs.smarkets.com/#/contracts/get_contracts_by_market_ids

Do you mean state_or_outcome and set to open or live?

I’ve noticed that a runner can be in the state live but the race is hours from starting, why is this? This was at 22:15 but race is at 00:15, maybe an error considering it says “off”

Hey,

Thanks for flagging this. It was indeed incorrect data that has set this race live a couple of hours before the scheduled off time.

Do you mean state_or_outcome and set to open or live ?

You can use state_or_outcome, yes. It has the following values:

  • new: The contract was just created and is still not available for betting
  • open: open for betting
  • live: open and trading live in-play
  • halted: Trading on this contract has halted
  • winner: settled as winner.
  • loser: settled as loser.
  • deadheat: settled as a deadheat - a tie with other contract.
  • reduced: withdrawn and a reduction factor was applied.
  • voided: no longer available for betting
  • unavailable: not currently available for betting

Please note however that withdrawn horses can have state_or_outcome set to either reduced or voided. We void rather than reduces horses in the win market if the reduction factor is less than 2.5%.

That’s why I suggested using status instead. Active runners will have the status set to active and non-runners to withdrawn.

Thank you for sharing this information, guys. Helped me a lot.