Squiggle Data

You can access data from the Squiggle API directly with the fetch_squiggle_data. This allows direct access to the Squiggle API.

Note that we also provide some helper functions that map more closely to our fetch_ functions such as fetch_ladder_squiggle.

Queries

Full instructions for constructing queries can be found at Squiggle API. One of the following must be provided to the query argument.

  • teams - Info about teams (e.g. Richmond, Geelong, West Coast)
  • games - Info about games (e.g. Round 1, 2019 Richmond v Carlton)
  • sources - Info about models (e.g. Matter of Stats, GRAFT, Swinburne)
  • tips - Info about tips and predictions made by models
  • standings - Info about team standings (i.e. the ladder)
  • ladder - Info about predicted ladders generated by models
  • virtual - Info about Virtually Season 2020
  • pav - Info about Player Approximate Value from HPN Footy

Optional Arguments

Optional arguments can then be supplied based on the query.

For example, games takes the following optional arguments. * year - Year * round - Round * game - Game ID * complete - Percent of game complete

These can be supplied as named arguments after the query. For example, to return games from just 2020, we would use the following.

fetch_squiggle_data(query = "games", year = 2020)
#> # A tibble: 162 x 24
#>    date   updated hscore ateam is_grand_final  year localtime hteam ascore    id
#>    <chr>  <chr>    <int> <chr>          <int> <int> <chr>     <chr>  <int> <int>
#>  1 2020-… 2020-0…     71 Sydn…              0  2020 2020-03-… Adel…     74  4401
#>  2 2020-… 2020-0…     63 Frem…              0  2020 2020-03-… Esse…     57  4400
#>  3 2020-… 2020-0…     29 Port…              0  2020 2020-03-… Gold…     76  4403
#>  4 2020-… 2020-0…    105 Geel…              0  2020 2020-03-… Grea…     73  4402
#>  5 2020-… 2020-0…     90 Bris…              0  2020 2020-03-… Hawt…     62  4412
#>  6 2020-… 2020-0…     56 St K…              0  2020 2020-03-… Nort…     54  4404
#>  7 2020-… 2020-0…    105 Carl…              0  2020 2020-03-… Rich…     81  4396
#>  8 2020-… 2020-0…     78 Melb…              0  2020 2020-03-… West…     51  4413
#>  9 2020-… 2020-0…     34 Coll…              0  2020 2020-03-… West…     86  4397
#> 10 2020-… 2020-0…     81 Frem…              0  2020 2020-06-… Bris…     69  4746
#> # … with 152 more rows, and 14 more variables: agoals <int>, venue <chr>,
#> #   hteamid <int>, hbehinds <int>, complete <int>, abehinds <int>,
#> #   winnerteamid <int>, ateamid <int>, is_final <int>, winner <chr>,
#> #   round <int>, tz <chr>, hgoals <int>, roundname <chr>

Examples

Teams

Fetch info about one or more AFL teams.

#> # A tibble: 18 x 4
#>    logo                                           name                 id abbrev
#>    <chr>                                          <chr>             <int> <chr> 
#>  1 /wp-content/themes/squiggle/assets/images/Ade… Adelaide              1 ADE   
#>  2 /wp-content/themes/squiggle/assets/images/Bri… Brisbane Lions        2 BRI   
#>  3 /wp-content/themes/squiggle/assets/images/Car… Carlton               3 CAR   
#>  4 /wp-content/themes/squiggle/assets/images/Col… Collingwood           4 COL   
#>  5 /wp-content/themes/squiggle/assets/images/Ess… Essendon              5 ESS   
#>  6 /wp-content/themes/squiggle/assets/images/Fre… Fremantle             6 FRE   
#>  7 /wp-content/themes/squiggle/assets/images/Gee… Geelong               7 GEE   
#>  8 /wp-content/themes/squiggle/assets/images/Gol… Gold Coast            8 GC    
#>  9 /wp-content/themes/squiggle/assets/images/Gia… Greater Western …     9 GWS   
#> 10 /wp-content/themes/squiggle/assets/images/Haw… Hawthorn             10 HAW   
#> 11 /wp-content/themes/squiggle/assets/images/Mel… Melbourne            11 MEL   
#> 12 /wp-content/themes/squiggle/assets/images/Nor… North Melbourne      12 NOR   
#> 13 /wp-content/themes/squiggle/assets/images/Por… Port Adelaide        13 POR   
#> 14 /wp-content/themes/squiggle/assets/images/Ric… Richmond             14 RIC   
#> 15 /wp-content/themes/squiggle/assets/images/StK… St Kilda             15 STK   
#> 16 /wp-content/themes/squiggle/assets/images/Syd… Sydney               16 SYD   
#> 17 /wp-content/themes/squiggle/assets/images/Wes… West Coast           17 WCE   
#> 18 /wp-content/themes/squiggle/assets/images/Bul… Western Bulldogs     18 WBD

Games

Fetch info about one or more games.

fetch_squiggle_data(query = "games", year = 2020)
#> # A tibble: 162 x 24
#>    date   updated hscore ateam is_grand_final  year localtime hteam ascore    id
#>    <chr>  <chr>    <int> <chr>          <int> <int> <chr>     <chr>  <int> <int>
#>  1 2020-… 2020-0…     71 Sydn…              0  2020 2020-03-… Adel…     74  4401
#>  2 2020-… 2020-0…     63 Frem…              0  2020 2020-03-… Esse…     57  4400
#>  3 2020-… 2020-0…     29 Port…              0  2020 2020-03-… Gold…     76  4403
#>  4 2020-… 2020-0…    105 Geel…              0  2020 2020-03-… Grea…     73  4402
#>  5 2020-… 2020-0…     90 Bris…              0  2020 2020-03-… Hawt…     62  4412
#>  6 2020-… 2020-0…     56 St K…              0  2020 2020-03-… Nort…     54  4404
#>  7 2020-… 2020-0…    105 Carl…              0  2020 2020-03-… Rich…     81  4396
#>  8 2020-… 2020-0…     78 Melb…              0  2020 2020-03-… West…     51  4413
#>  9 2020-… 2020-0…     34 Coll…              0  2020 2020-03-… West…     86  4397
#> 10 2020-… 2020-0…     81 Frem…              0  2020 2020-06-… Bris…     69  4746
#> # … with 152 more rows, and 14 more variables: agoals <int>, venue <chr>,
#> #   hteamid <int>, hbehinds <int>, complete <int>, abehinds <int>,
#> #   winnerteamid <int>, ateamid <int>, is_final <int>, winner <chr>,
#> #   round <int>, tz <chr>, hgoals <int>, roundname <chr>

Sources

Fetch info about one or more computer models.

# You can get the sources
fetch_squiggle_data("sources")
#> # A tibble: 22 x 4
#>    name           icon                               url                      id
#>    <chr>          <chr>                              <chr>                 <int>
#>  1 Squiggle       "/wp-content/uploads/2017/02/logo… "https://live.squigg…     1
#>  2 The Arc        "/wp-content/themes/squiggle/asse… "https://thearcfooty…     2
#>  3 Figuring Footy "/wp-content/themes/squiggle/asse… "http://figuringfoot…     3
#>  4 Matter of Sta… "/wp-content/themes/squiggle/asse… "http://www.matterof…     4
#>  5 Punters        ""                                 ""                        5
#>  6 Footy Maths I… "/wp-content/themes/squiggle/asse… "https://footymaths.…     6
#>  7 PlusSixOne     "/wp-content/themes/squiggle/asse… "http://plussixonebl…     7
#>  8 Aggregate      ""                                 "/introducing-s10/"       8
#>  9 Graft          "/wp-content/themes/squiggle/asse… "http://graftratings…     9
#> 10 Stattraction   "/wp-content/themes/squiggle/asse… "https://stattractio…    10
#> # … with 12 more rows

Tips

Fetch info about one or more tips made by computer models.

# Get all tips
fetch_squiggle_data("tips")
#> # A tibble: 12,917 x 21
#>      err correct ateamid  year hconfidence gameid tipteamid    bits confidence
#>    <dbl>   <int>   <int> <int>       <dbl>  <int>     <int>   <dbl>      <dbl>
#>  1 42          1      14  2017        50        1        14  0            50  
#>  2 NA          1      14  2017        42        1        14  0.214        58  
#>  3 48.4        0      14  2017        56.7      1         3 -0.208        56.7
#>  4  3.69       1      18  2017        37.3      2        18  0.326        62.7
#>  5  3          1      18  2017        38        2        18  0.310        62  
#>  6 53          1       9  2017        50        8         1  0            50  
#>  7 35          1      14  2017        41.2      1        14  0.234        58.8
#>  8  1          1      18  2017        35.9      2        18  0.358        64.1
#>  9 32          0      11  2017        52.9      4        15 -0.0862       52.9
#> 10 57          0      13  2017        79.4      3        16 -1.28         79.4
#> # … with 12,907 more rows, and 12 more variables: hteam <chr>, round <int>,
#> #   ateam <chr>, updated <chr>, venue <chr>, source <chr>, margin <dbl>,
#> #   date <chr>, hmargin <dbl>, hteamid <int>, sourceid <int>, tip <chr>

We can just look at one particular round.

# Get` just tips from round 1, 2018
fetch_squiggle_data("tips", round = 1, year = 2018)
#> # A tibble: 126 x 21
#>      err correct ateamid  year hconfidence gameid tipteamid    bits confidence
#>    <dbl>   <int>   <int> <int>       <dbl>  <int>     <int>   <dbl>      <dbl>
#>  1  NA         1       3  2018        79.8    372        14  0.675        79.8
#>  2  NA         1       1  2018        52.1    373         5  0.0588       52.1
#>  3  NA         1       2  2018        71.7    374        15  0.521        71.7
#>  4  NA         1       6  2018        79.4    375        13  0.666        79.4
#>  5  NA         0      12  2018        49.5    376        12 -0.0151       50.5
#>  6  NA         1       4  2018        54.4    377        10  0.122        54.4
#>  7  NA         1      18  2018        72.2    378         9  0.530        72.2
#>  8  NA         0       7  2018        56.4    379        11 -0.198        56.4
#>  9  NA         1      16  2018        30.0    380        16  0.486        70.0
#> 10   9.2       1       3  2018        79.8    372        14  0.674        79.8
#> # … with 116 more rows, and 12 more variables: hteam <chr>, round <int>,
#> #   ateam <chr>, updated <chr>, venue <chr>, source <chr>, margin <dbl>,
#> #   date <chr>, hmargin <dbl>, hteamid <int>, sourceid <int>, tip <chr>

Standings

Fetch info about team standings at a point in time, i.e. the ladder.

fetch_squiggle_data("standings", year = 2020, round = 1)
#> # A tibble: 18 x 15
#>     wins    id  rank goals_against goals_for  for. draws   pts percentage name  
#>    <int> <int> <int>         <int>     <int> <int> <int> <int>      <dbl> <chr> 
#>  1     1    13     1             4        10    76     0     4      262.  Port …
#>  2     1     4     2             5        13    86     0     4      253.  Colli…
#>  3     1    17     3             7        12    78     0     4      153.  West …
#>  4     1    10     4             9        14    90     0     4      145.  Hawth…
#>  5     1     9     5            11        17   105     0     4      144.  Great…
#>  6     1    14     6            12        16   105     0     4      130.  Richm…
#>  7     1     5     7             8         9    63     0     4      111.  Essen…
#>  8     1    16     8            11        11    74     0     4      104.  Sydney
#>  9     1    12     9             7         8    56     0     4      104.  North…
#> 10     0    15    10             8         7    54     0     0       96.4 St Ki…
#> 11     0     1    11            11        11    71     0     0       95.9 Adela…
#> 12     0     6    12             9         8    57     0     0       90.5 Frema…
#> 13     0     3    13            16        12    81     0     0       77.1 Carlt…
#> 14     0     7    14            17        11    73     0     0       69.5 Geelo…
#> 15     0     2    15            14         9    62     0     0       68.9 Brisb…
#> 16     0    11    16            12         7    51     0     0       65.4 Melbo…
#> 17     0    18    17            13         5    34     0     0       39.5 Weste…
#> 18     0     8    18            10         4    29     0     0       38.2 Gold …
#> # … with 5 more variables: against <int>, behinds_for <int>,
#> #   behinds_against <int>, losses <int>, played <int>

Ladder

Fetch info about one or more projected ladders generated by computer models. For the actual ladder, see standings instead.

fetch_squiggle_data("ladder", year = 2019, round = 15, source = 1)
#> # A tibble: 18 x 12
#>    swarms    wins percentage team  sourceid  rank round mean_rank updated teamid
#>    <chr>    <dbl>      <dbl> <chr>    <int> <int> <int>     <dbl> <chr>    <int>
#>  1 "c(\"0.…  12.7      111.  Adel…        1     6    15      6.11 2019-0…      1
#>  2 "c(\"0.…  13        107.  Bris…        1     5    15      6.01 2019-0…      2
#>  3 "c(\"0.…   6.1       82.8 Carl…        1    17    15     16.7  2019-0…      3
#>  4 "c(\"3.…  14.1      114   Coll…        1     4    15      4.20 2019-0…      4
#>  5 "c(\"0.…  10.8       99.8 Esse…        1    10    15      9.98 2019-0…      5
#>  6 "c(\"0.…  10.8      104.  Frem…        1     9    15      9.71 2019-0…      6
#>  7 "c(\"84…  17.3      138.  Geel…        1     1    15      1.21 2019-0…      7
#>  8 "c(\"0.…   4.9       70.2 Gold…        1    18    15     17.7  2019-0…      8
#>  9 "c(\"7.…  14.4      129.  Grea…        1     2    15      3.26 2019-0…      9
#> 10 "c(\"0.…   8.8       97.6 Hawt…        1    14    15     13.0  2019-0…     10
#> 11 "c(\"0.…   8         85.3 Melb…        1    16    15     14.8  2019-0…     11
#> 12 "c(\"0.…  10.2       98.9 Nort…        1    11    15     10.9  2019-0…     12
#> 13 "c(\"0.…  11.5      107.  Port…        1     8    15      8.24 2019-0…     13
#> 14 "c(\"0.…  12.8      101.  Rich…        1     7    15      6.67 2019-0…     14
#> 15 "c(\"0.…   9         83.2 St K…        1    15    15     13.8  2019-0…     15
#> 16 "c(\"0.…   9.2       93.4 Sydn…        1    13    15     12.9  2019-0…     16
#> 17 "c(\"4.…  14.4      107.  West…        1     3    15      4.16 2019-0…     17
#> 18 "c(\"0.…   9.8       94.1 West…        1    12    15     11.9  2019-0…     18
#> # … with 2 more variables: source <chr>, year <int>

PAV

Fetch info about players using HPN Footy’s Player Approximate Value.

fetch_squiggle_data("pav", 
                    firstname = "Dustin", 
                    surname = "Martin", 
                    year = 2017)
#> # A tibble: 1 x 21
#>   mPAV_total  year PAV_def_rank pavid PAV_off_rank PAV_mid_rank PAV_total_rank
#>        <dbl> <int>        <int> <int>        <int>        <int>          <int>
#> 1       0.96  2017          253  8632           16            1              2
#> # … with 14 more variables: team <int>, mPAV_off <dbl>, games <int>,
#> #   PAV_off <dbl>, PAV_def <dbl>, firstname <chr>, name <chr>, mPAV_mid <dbl>,
#> #   mPAV_rank <int>, mPAV_def <dbl>, X._of_team_games <dbl>, PAV_total <dbl>,
#> #   PAV_mid <dbl>, surname <chr>