Closed tiagoafonso85 closed 6 years ago
Hi tiago,
It is used in utils.R but only as part of the menu (if you don't select a sport or a league, it gives a list of choices), nothing that should cause that problem. Tested and could not reproduce.
This suggests there's something that happened in the API at that time that I'm not handling correctly.
Is there any more information you can give me there? Is it possible there was a network interruption?
Unrelated, but: I recommend using the individual GetOdds/GetFixtures/GetLeagues if you're polling that regularly and join it together yourself. (There's no need to spend an extra call to attach league info every time)
showOddsDF is a one-size-fits-all, but you can use the others to write something optimal for your usecase.
I use:
showOddsDF(sportid=29, leagueids=leagues_games1, attachLeagueInfo=TRUE, oddsformat='DECIMAL', islive=1, since=Soccer_Data_isLive_X$last[last[1]])
where leagues_games1 contains the leagues of the games that are happening at any moment, obtained through GetInrunning ()
Then I check if there are $sports.leagues.id in GetInrunning() available and if they have no 'NA'.
Then I check if the last $last of showOddsDF() also has no 'NA'.
And I finally use showOddsDF(sportid=29, leagueids=leagues_games1, attachLeagueInfo=TRUE, oddsformat='DECIMAL', islive=1, since=Soccer_Data_isLive_X$last[last[1]]) and that's fine, until that moment when I got this error.
I think that without Internet I did not stay, but I was not in front of the computer at that time.
If I use GetOdds / GetFixtures / GetLeagues individually and put it all together by myself, I do not have to spend an extra call, to check every time a new game pops up, and then attach the league info?
I also filter after receiving the games through showOddsDF () for only the games that are running, since there is no option in the wrapper to just receive the games in progress. Instead, it forces us to receive whole leagues. In the API you have the option to receive through Get Odds only the games that we want, filtered by events id.
If you run into it again, mind posting a little snippet of code that reproduces it? At this point, I'm just guessing, it could be a lot of things.
But regarding the leagues, it's pretty unlikely to see a new league pop up. You can always do it on demand:
If you pull fixtures and find a league.id in fixtures that's not in your stored league.ids, then update the league information.
Regarding event.ids, yes, you should be able to pull those as well. That's an omission in the wrapper. I'll add it.
Hi Shape, The mistake happened again ... I've had the script run several times over several days and it worked without problems. This time, after 15 hours, gave the error: ... ... ... 2017-08-31 20:44:11| Pulling Inrunning (Live) State 2017-08-31 20:44:11| Pulling new league ids for sportid: 29 2017-08-31 20:44:16| Pulling Inrunning (Live) State 2017-08-31 20:44:16| Pulling Odds for - sportid: 29 leagueids: 2015, 1856, 5894, 2100, 10587 since: 419815278 islive: 1 oddsformat: DECIMAL tableformat: long 2017-08-31 20:44:17| Pulling Fixtures for SportID: 29 and leagueIds: 2015 and leagueIds: 1856 and leagueIds: 5894 and leagueIds: 2100 and leagueIds: 10587 2017-08-31 20:44:17| Pulling Inrunning (Live) State 2017-08-31 20:44:17| Pulling new league ids for sportid: 29 2017-08-31 20:44:23| Pulling Inrunning (Live) State 2017-08-31 20:44:23| Pulling Odds for - sportid: 29 leagueids: 2015, 1856, 5894, 2100, 10587 since: 419815312 islive: 1 oddsformat: DECIMAL tableformat: long 2017-08-31 20:44:23| Pulling Fixtures for SportID: 29 and leagueIds: 2015 and leagueIds: 1856 and leagueIds: 5894 and leagueIds: 2100 and leagueIds: 10587 2017-08-31 20:44:23| Pulling Inrunning (Live) State 2017-08-31 20:44:24| Pulling new league ids for sportid: Error in vapply(elements, encode, character(1)) : values must be length 1, but FUN(X[[1]]) result is length 0
system("ping -c 5 google.com") PING google.com (216.58.210.174) 56(84) bytes of data. 64 bytes from mad06s10-in-f174.1e100.net (216.58.210.174): icmp_seq=1 ttl=56 time=21.8 ms 64 bytes from mad06s10-in-f174.1e100.net (216.58.210.174): icmp_seq=2 ttl=56 time=20.6 ms 64 bytes from mad06s10-in-f174.1e100.net (216.58.210.174): icmp_seq=3 ttl=56 time=21.2 ms 64 bytes from mad06s10-in-f174.1e100.net (216.58.210.174): icmp_seq=4 ttl=56 time=20.4 ms 64 bytes from mad06s10-in-f174.1e100.net (216.58.210.174): icmp_seq=5 ttl=56 time=20.8 ms
--- google.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 20.492/21.020/21.863/0.525 ms
Because you have questioned the other time, if I had run out of internet, then I added the above command, so the script was finished, I run the internet connection check, and the result was positive.
I've already checked all the variables used as arguments of the unique functions I'm using from the wrapper (GetInrunning () and showOddsDF ()), and all of them have valid values, which in a normal situation would not cause any kind of error.
I do not know if you need to get any more information about the R environment, because I did not close the session, so just say some command that I return the output.
My script code is too extensive and confusing for I to share. I do not think there would be any advantage. As I said, the only functions I'm using in my script are GetInrunning () and ShowOddsDF ().
Example:
Soccer_Data_isLive_X <- showOddsDF(sportid=29, leagueids=ligas_jogos1, attachLeagueInfo=TRUE, tableformat='long',oddsformat='DECIMAL', islive=1, since=Soccer_Data_isLive_X$last[last[1]])
leagues_games_X <<- GetInrunning()
Thanks in advance
Hi Tiago,
Alright, let me dig in, it could also be that Pinnacle dropped service to their API there.
Since it seems to be intermittent (and rare), that strongly suggests an external component.
As a safe way to typically run a bot, I would usually make use of a try
statement so that network interruptions can't cause the bot to crash. Something along the lines of:
odds <- try(showOddsDF(29))
if(!inherits(odds, 'try-error')) {
DO STUFF
} else {
RUN BOT AGAIN
}
Hello shapenaji, I'm back with my bot. So I have not changed the code since the last bug I reported here, and I have not run my code since then either. I have pinnacle 2.3.3
I was running line by line of my code to see if at any point I found any error related to my code and no line of code resulted in any errors.
Basically my code boils down to:
bag the games that are currently being played with:
while(NROW(leagues_games1$sports_leagues.id)) == 0) { Sys.sleep (5) leagues_games1 <<- GetInrunning() }
remove NA's from leagues_games1
and then, use:
Soccer_Data_isLive_X <- showOddsDF(sportid = 29, leagueids = leagues_games1$sports.leagues.id, attachLeagueInfo = TRUE, tableformat = 'long', oddsformat = 'DECIMAL', islive = 1)
To collect the odds of the games being played.
So, I put my code running...
2018-03-25 23: 44: 55 | Pulling Inrunning (Live) State 2018-03-25 23:44:56| Pulling Odds for - sportid: 29 leagueids: 72425, 72425, 10769, 6820, 6820, 6820, 5598, 10776, 198060, 5596, 197248, 5593, 10768, 1739, 1739, 1739, 196742, 196742, 5591, 5591, 198494, 9591, 5595, 196865, 196865, 196865, 2359, 6668, 198062 islive: 1 oddsformat: DECIMAL tableformat: long 2018-03-25 23:44:57| Pulling Fixtures for Sport ID: 29, with League ID(s): 72425, 72425, 10769, 6820, 6820, 6820, 5598, 10776, 198060, 5596, 197248, 5593, 10768, 1739, 1739, 1739, 196742, 196742, 5591, 5591, 198494, 9591, 5595, 196865, 196865, 196865, 2359, 6668, 198062 2018-03-25 23:44:57| Pulling Inrunning (Live) State 2018-03-25 23:44:57| Pulling new league ids for sportid: 29 2018-03-25 23:45:03| Pulling Inrunning (Live) State 2018-03-25 23:45:03| Pulling Odds for - sportid: 29 leagueids: 72425, 72425, 10769, 6820, 6820, 6820, 5598, 10776, 198060, 5596, 197248, 5593, 10768, 1739, 1739, 1739, 196742, 196742, 5591, 5591, 198494, 9591, 5595, 196865, 196865, 196865, 2359, 6668, 198062 since: 486944773 islive: 1 oddsformat: DECIMAL tableformat: long 2018-03-25 23:45:04| Pulling Fixtures for Sport ID: 29, with League ID(s): 72425, 72425, 10769, 6820, 6820, 6820, 5598, 10776, 198060, 5596, 197248, 5593, 10768, 1739, 1739, 1739, 196742, 196742, 5591, 5591, 198494, 9591, 5595, 196865, 196865, 196865, 2359, 6668, 198062 2018-03-25 23:45:04| Pulling Inrunning (Live) State 2018-03-25 23:45:04| Pulling new league ids for sportid: 29 2018-03-25 23:45:10| Pulling Inrunning (Live) State 2018-03-25 23:45:10| Pulling Odds for - sportid: 29 leagueids: 72425, 72425, 10769, 6820, 6820, 6820, 5598, 10776, 198060, 5596, 197248, 5593, 10768, 1739, 1739, 1739, 196742, 196742, 5591, 5591, 198494, 9591, 5595, 196865, 196865, 196865, 2359, 6668, 198062 since: 486944830 islive: 1 oddsformat: DECIMAL tableformat: long ... ... ...
and ended 12 hours later with:
2018-03-26 11: 41: 19 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 19 | Pulling Odds for - sportid: 29 leagueids: 2116, 1753, 198572 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 41: 19 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116, 1753, 198572
2018-03-26 11: 41: 20 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 20 | Pulling new league ids for sportid: 29
2018-03-26 11: 41: 25 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 25 | Pulling Odds for - sportid: 29 leagueids: 2116 since: 487003396 islive: 1 oddsformat: DECIMAL tableformat: long
No odds for the given selections.
2018-03-26 11: 41: 31 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 31 | Pulling Odds for - sportid: 29 leagueids: 2116 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 41: 31 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116
2018-03-26 11: 41: 31 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 32 | Pulling new league ids for sportid: 29
2018-03-26 11: 41: 37 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 37 | Pulling Odds for - sportid: 29 leagueids: 2116 since: 487003284 islive: 1 oddsformat: DECIMAL tableformat: long
No odds for the given selections.
2018-03-26 11: 41: 43 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 43 | Pulling Odds for - sportid: 29 leagueids: 2116 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 41: 43 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116
2018-03-26 11: 41: 43 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 44 | Pulling new league ids for sportid: 29
2018-03-26 11: 41: 49 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 49 | Pulling Odds for - sportid: 29 leagueids: 2116 since: 487003284 islive: 1 oddsformat: DECIMAL tableformat: long
No odds for the given selections.
2018-03-26 11: 41: 54 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 55 | Pulling Odds for - sportid: 29 leagueids: 2116 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 41: 55 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116
2018-03-26 11: 41: 55 | Pulling Inrunning (Live) State
2018-03-26 11: 41: 55 | Pulling new league ids for sportid: 29
2018-03-26 11: 42: 01 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 01 | Pulling Odds for - sportid: 29 leagueids: 2116 since: 487003566 islive: 1 oddsformat: DECIMAL tableformat: long
No odds for the given selections.
2018-03-26 11: 42: 06 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 06 | Pulling Odds for - sportid: 29 leagueids: 2116 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 42: 07 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116
2018-03-26 11: 42: 07 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 07 | Pulling new league ids for sportid: 29
2018-03-26 11: 42: 13 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 13 | Pulling Odds for - sportid: 29 leagueids: 2116, 1753, 198572 since: 487003284 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 42: 13 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116, 1753, 198572
2018-03-26 11: 42: 13 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 14 | Pulling new league ids for sportid: 29
2018-03-26 11: 42: 19 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 19 | Pulling Odds for - sportid: 29 leagueids: 2116, 1753, 198572 since: 487003589 islive: 1 oddsformat: DECIMAL tableformat: long
2018-03-26 11: 42: 20 | Pulling Fixtures for Sport ID: 29, with League ID (s): 2116, 1753, 198572
2018-03-26 11: 42: 20 | Pulling Inrunning (Live) State
2018-03-26 11: 42: 20 | Pulling new league ids for sportid:
Error in merge.data.table (out, leagueinfo, by.x = "league.id", by.y = "leagues.id",:
Elements listed in by.y
must be valid column names in and.
save (Soccer_Data_isLive, file = file)
system ("ping -c 5 google.com") PING google.com (216.58.214.174) 56 (84) bytes of data. 64 bytes from mad01s26-in-f174.1e100.net (216.58.214.174): icmp_seq = 1 ttl = 56 time = 26.2 ms 64 bytes from mad01s26-in-f174.1e100.net (216.58.214.174): icmp_seq = 2 ttl = 56 time = 22.3 ms 64 bytes from mad01s26-in-f174.1e100.net (216.58.214.174): icmp_seq = 3 ttl = 56 time = 22.6 ms 64 bytes from mad01s26-in-f174.1e100.net (216.58.214.174): icmp_seq = 4 ttl = 56 time = 22.3 ms 64 bytes from mad01s26-in-f174.1e100.net (216.58.214.174): icmp_seq = 5 ttl = 56 time = 22.8 ms
--- google.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4004ms rtt min/avg/max/mdev = 22.305/23.275/26.217/1.485 ms
what you think it happened?
Thanks in advance
I suspect there was either a hiccup in pinnacle's API or in the route between you and pinnacle. But it's impossible to say for certain. Not reproducible.
Hi shapenaji,
I'm Getting GetInRunning() and showOddsDF() and then I get this error: ... ... ... 2017-07-27 04:14:58| Pulling Inrunning (Live) State 2017-07-27 04:14:58| Pulling Odds for - sportid: 29 leagueids: 2077, 6401 since: 409532679 islive: 1 oddsformat: DECIMAL tableformat: mainlines 2017-07-27 04:14:58| Pulling Fixtures for SportID: 29 and leagueIds: 2077 and leagueIds: 6401 2017-07-27 04:14:58| Pulling Inrunning (Live) State 2017-07-27 04:14:59| Pulling new league ids for sportid: Error in vapply(elements, encode, character(1)) : values must be length 1, but FUN(X[[1]]) result is length 0
I don't have vapply() in my code, may be bug in the wrapper?
I saw vapply() function in utils.R...
The day before I had done the same for 20 hours and it went well. The next day, I started the script again and after 1h I got this error.