phillc73/abettor

Politics markets error

Closed this issue · 4 comments

Hi there.

I'm getting a strange result when I try listMarketCatalogue for the politics market through the api. This is the code I am running:

event.Types <- listEventTypes()

politics.ID <- event.Types$eventType$id[grep("Politics",event.Types$eventType$name)]

listCountries(eventTypeIds=politicsID)

market.Type <- listMarketTypes(eventTypeIds=politics.ID)$marketType

listMarketCatalogue(eventTypeIds=politics.ID, marketCountries="GB", marketTypeCodes = market.Type)

But it seems to return:

> listMarketCatalogue(eventTypeIds=politics.ID, marketCountries="GB", marketTypeCodes = market.Type)
data frame with 0 columns and 0 rows

Any idea what I might be doing wrong?

Thanks for the nice package, btw!

J

doesn't look like GB exists in the politics market. try

listMarketCatalogue(eventTypeIds=politics.ID, marketCountries="USA", marketTypeCodes = market.Type)
see if you get a data frame with something in it.

Interesting. The following:

 listCountries(eventTypeIds=as.numeric(politics.ID))

Returns:

  countryCode marketCount
1          GB         686
2          IE           2
3          GR           5
4          US           4

Which makes me think it may be something to do with:

 listMarketTypes(eventTypeIds=politics.ID)$marketType

Which returns:

"NONSPORT"

! Any ideas?

Thanks for the reply!

Apologies for the tardy reply.

The issue here is that listMarketCatalogue only returns events with a marketStartTime within the next 24 hours by default. Essentially I put this in place for the convenience factor, as I mostly look at horse races and really only wanted today's and tomorrow's racing.

The good news is that there are already function parameters in place to alter this very easily.

Find the Politics event type code

listEventTypes()

You'll see that Politics has the eventTypeId of 2378961.

List politics MarketTypes

listMarketTypes(eventTypeIds = "2378961")

You're right, it is NONSPORT.

Set the timespan in listMarketCatalogue.

listMarketCatalogue(eventTypeIds = "2378961", marketCountries = "GB", marketTypeCodes = "NONSPORT", toDate = "2015-12-01T00:00:00Z")

I've randomly set the future date to December 1st 2015

This returned 200 politics markets for me, all with a marketStartTime of 2015-05-07T06:00:00.000Z

I hope that helps. Try ?listMarketCatalogue for more information on available parameters. I must admit I haven't include an example of setting the toDate for listMarketCatalogue, and maybe should. Try ?listEvents to see an example of setting the toDate.

Do let me know if this works for you, so I can close the issue.

Good luck on May 7th!

Assuming fixed, so closing.