How to identify which selection corresponds to which back/lay prices with /v3/markets/{market_ids}/quotes/?

Hi,

I use “/v3/markets/{market_ids}/quotes/” to read the prices of horses for several markets. The result looks like this:

{
“34421579”: {
“bids”: [
{
“price”: 1,
“quantity”: 2147483646
}
],
“offers”: [
{
“price”: 125,
“quantity”: 1120128
},
{
“price”: 182,
“quantity”: 1126631
},
{
“price”: 238,
“quantity”: 1133094
}
]
},

How do I know which price corresponds to which horse? There is no ID market and the first number “34421579” for example does not corresponds to anything (horse ID, etc).

Thank you for your help.

Kind regards,

William.

Hi William,

Thanks for reaching out. 34421579 is a contract id; you can find the mapping between horse and contract id using https://docs.smarkets.com/#/contracts/get_horses; https://docs.smarkets.com/#/markets/get_markets_by_event_ids should give you all the markets for a particular event.

headers={
    "Authorization": f"User-Session-Token {token}",
}
event_id = 41662918
event_response = requests.get(f"https://api.smarkets.com/v3/events/{event_id}/markets/", headers=headers) 
events = event_response.json()

market_ids = [market["id"] for market in events["markets"]]

market_ids_str = ",".join(market_ids)
horse_response = requests.get(f"https://api.smarkets.com/v3/markets/{market_ids_str}/horses/", headers=headers) 
horses = horse_response.json()

I hope this helps,
Isabel

Thank you for your help Isabel.

William.