phillc73 / abettor

An R package for connecting to the online betting exchange Betfair, via their API-NG product, using JSON-RPC.
Other
51 stars 36 forks source link

getAccountStatement crash with dead heat #63

Open darrellberry opened 2 years ago

darrellberry commented 2 years ago

Hi

getAccountStatement crashes at the line

accNewOrders[, fixColNames]

with the error

Error in `[.data.frame`(accNewOrders, , fixColNames) : 
  undefined columns selected

...if the first page of results contained the column deadHeatPriceDivisor but the current page doesn't contain this column. Looks like fixColNames only gets set the first time through the main loop so whatever columns are present on that page, it expects to see on subsequent pages -- but appears the API doesn't include at least that specific column unless statement items on the current page require it -- hence the error.

A simple hack is to add deadHeatPriceDivisor to the list of columns excluded when the data is pulled in.

accNewOrders[, "legacyData"] <- NULL

is already executed... just add

accNewOrders[, "deadHeatPriceDivisor"] <- NULL

I'm not sure if there would be knock-on effects from implementing this as a fix, but it works for me for this specific issue. I would imagine there are other 'special case' columns which would create the same problem so a more general solution would be preferable.

Soccerama commented 2 years ago

Sorry for the slow response. Have been busy with other stuff and just saw this today. I'll look into this and do some testing of your proposed fix. As you suggest, this issue of columns that are not always present is a problem in situations like this and I'm surprised it hasn't come up before now.

Soccerama commented 2 years ago

@darrellberry I think you may not be using the latest version. There was an update on 15 Mar 2021 that moved away from using legacyData to using itemClassData. Not sure if this will fix your problem but can you please update first and confirm whether the problem still exists. The instructions to get the latest version are in the readme file.

darrellberry commented 2 years ago

Will do thanks

On 26 Jun 2022, at 11:47, Soccerama @.***> wrote:

 @darrellberry I think you may not be using the latest version. There was an update on 15 Mar 2021 that moved away from using legacyData to using itemClassData. Not sure if this will fix your problem but can you please update first and confirm whether the problem still exists.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

Soccerama commented 2 years ago

@darrellberry did that work?