phillc73/abettor

listMarketBook function

Tammboy opened this issue · 4 comments

I'm a bit new to this but with the function:

listMarketBook(marketIds = racetemp, priceData = "EX_ALL_OFFERS", sslVerify = FALSE)

is it possible to list a vector of marketIds to create a dataframe or can it only handle one marketid at a time?

thanks,

Yes, multiple marketIds are supported. Simply add them comma separated.

e.g.
listMarketBook(marketIds = "marketId1, marketId2, marketId3", priceData = "EX_ALL_OFFERS", sslVerify = FALSE)

Hope that helps. I can put some more details together tomorrow if required.

Great, i managed to put in a few marketIds manually like in your example. However, is there a way to put in a range of marketids dynamically?

for example, if i load marketids into a vector:
AllMarketIDs
[1] "1.117689626" "1.117689627" "1.117707779" "1.117707780" "1.117707813" "1.117707814"
temp = listMarketBook(marketIds = AllMarketIDs, priceData = "EX_ALL_OFFERS", sslVerify = FALSE)
doesn't seem to work?

thanks,

Try something like this:

# Extract market catalogue data for horse racing in UK and IE over next 24 hours

marketCat <- abettor::listMarketCatalogue(eventTypeIds = "7", marketCountries = c("GB", "IE"), marketTypeCodes = "WIN", sslVerify = FALSE)

# Hold just the marketIds in a new variable

todayMarketIds <- data.frame(marketCat$marketId)

# Use lapply to work across all items in todayMarketIds

marketIds <- lapply(todayMarketIds$marketCat.marketId, function(x) abettor::listMarketBook(marketIds = x, priceData = "EX_BEST_OFFERS", sslVerify = FALSE))

Assuming fixed, so closing.