Closed gilesdoy closed 1 year ago
Sorry for the slow response. It's an interesting question. Can I clarify that you are looking to get the amount matched at all levels, just like shown with the chart symbol?
I tried this:
df <- listMarketBook(marketId = "1.209125198", priceData = "EX_TRADED")
The runners item [[17]] contains more information and I used df[[17]][[1]]$ex$tradedVolume
to get a list which has a dataframe showing the traded volume by price for each runner. You can then extract the information from these dataframes.
Let me know if this works for you or if it needs some more tweaking.
Thank you for responding. I've changed the df line to:
df <- listMarketBook(marketId = "1.164555327", priceData = "EX_TRADED")
(this market is still open, and has a good amount traded on it)
I ran this line, and then submitted df[[17]][[1]]$ex$tradedVolume
and got NULL
as a response.
When I ran the df line on the previous marketId
, and then used df[[17]][[1]]$ex$tradedVolume
I got the message Error in .subset2(x, i, exact = exact) : subscript out of bounds
, presumably because the market had closed?
I reran exactly what you have typed and got this:
> df[[17]][[1]]$ex$tradedVolume
[[1]]
price size
1 3.15 34.88
2 3.20 49.81
3 3.25 0.77
4 3.30 471.15
5 3.35 251.12
6 3.40 450.33
7 3.45 501.51
8 3.50 957.24
9 3.55 445.33
...
What happens if you try View(df) and View(df[[17]][[1]])? Are you using the latest version of abettor?
I'm on version 0.1.7, which looks like the latest version of abettor to me.
When I run df[[17]][[1]] I get this
selectionId handicap status lastPriceTraded totalMatched
1 13098 0 ACTIVE 4.5 0
2 14120 0 ACTIVE 4.5 0
3 14122 0 ACTIVE 6.6 0
4 351 0 ACTIVE 7.6 0
...
It's then presumably coming back with NULL
because it's not finding anything under ex
or tradedVolume
Could it be because I have a Development App Key and I haven't purchased a Live Application one?
There should be three more columns (or one more item "ex" with three subitems). These are ex$availableToBack, ex$availableToLay and ex$tradedVolume. Not sure why this isn't working but it may be to do with having a live App Key. I'll ask on another forum and see if anyone knows.
One of the Betfair staff who is a group member on another forum responded: "Yes, this is related to the app key. Users with delayed app keys can see prices matched but not volume."
Ah ha, that makes sense, thank you for investigating @Soccerama . Looks like I will need to stump up the money for a live App Key in order to use this information
Hi, I've read the documentation on the listMarketBook function but I'm not sure where I'm going wrong.
I'd like to create a dataframe which, for a particular marketId, shows the total volume traded at each price. (Anyone can find this through the betfair website if you click the little graph icon next to each runner in a market.) I've used the listMarketBook function and tried each permutation of orderProjection, matchProjection, rollupModel and priceData. Each time the same identical information comes back, which is the current prices availableToBack, availableToLay; but not the information on what's been matched already. Can anyone advise what arguments I should be using in the function?