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 × 24
#>    ascore hteamid hgoals localtime    is_grand_final date  hscore ateamid agoals
#>     <int>   <int>  <int> <chr>                 <int> <chr>  <int>   <int>  <int>
#>  1     74       1     11 2020-03-21 …              0 2020…     71      16     11
#>  2     57       5      9 2020-03-21 …              0 2020…     63       6      8
#>  3     76       8      4 2020-03-21 …              0 2020…     29      13     10
#>  4     73       9     17 2020-03-21 …              0 2020…    105       7     11
#>  5     62      10     14 2020-03-22 …              0 2020…     90       2      9
#>  6     54      12      8 2020-03-22 …              0 2020…     56      15      7
#>  7     81      14     16 2020-03-19 …              0 2020…    105       3     12
#>  8     51      17     12 2020-03-22 …              0 2020…     78      11      7
#>  9     86      18      5 2020-03-20 …              0 2020…     34       4     13
#> 10     69       2     12 2020-06-13 …              0 2020…     81       6     10
#> # ℹ 152 more rows
#> # ℹ 15 more variables: hbehinds <int>, venue <chr>, hteam <chr>,
#> #   is_final <int>, id <int>, roundname <chr>, round <int>, winner <chr>,
#> #   abehinds <int>, ateam <chr>, tz <chr>, updated <chr>, complete <int>,
#> #   winnerteamid <int>, year <int>

Examples

Teams

Fetch info about one or more AFL teams.

#> # A tibble: 18 × 4
#>    logo                                                       abbrev    id name 
#>    <chr>                                                      <chr>  <int> <chr>
#>  1 /wp-content/themes/squiggle/assets/images/Adelaide.png     ADE        1 Adel…
#>  2 /wp-content/themes/squiggle/assets/images/Brisbane.png     BRI        2 Bris…
#>  3 /wp-content/themes/squiggle/assets/images/Carlton.png      CAR        3 Carl…
#>  4 /wp-content/themes/squiggle/assets/images/Collingwood.png  COL        4 Coll…
#>  5 /wp-content/themes/squiggle/assets/images/Essendon.png     ESS        5 Esse…
#>  6 /wp-content/themes/squiggle/assets/images/Fremantle.png    FRE        6 Frem…
#>  7 /wp-content/themes/squiggle/assets/images/Geelong.png      GEE        7 Geel…
#>  8 /wp-content/themes/squiggle/assets/images/GoldCoast.png    GC         8 Gold…
#>  9 /wp-content/themes/squiggle/assets/images/Giants.png       GWS        9 Grea…
#> 10 /wp-content/themes/squiggle/assets/images/Hawthorn.png     HAW       10 Hawt…
#> 11 /wp-content/themes/squiggle/assets/images/Melbourne.png    MEL       11 Melb…
#> 12 /wp-content/themes/squiggle/assets/images/NorthMelbourne.… NOR       12 Nort…
#> 13 /wp-content/themes/squiggle/assets/images/PortAdelaide.png POR       13 Port…
#> 14 /wp-content/themes/squiggle/assets/images/Richmond.png     RIC       14 Rich…
#> 15 /wp-content/themes/squiggle/assets/images/StKilda.png      STK       15 St K…
#> 16 /wp-content/themes/squiggle/assets/images/Sydney.png       SYD       16 Sydn…
#> 17 /wp-content/themes/squiggle/assets/images/WestCoast.png    WCE       17 West…
#> 18 /wp-content/themes/squiggle/assets/images/Bulldogs.png     WBD       18 West…

Games

Fetch info about one or more games.

fetch_squiggle_data(query = "games", year = 2020)
#> # A tibble: 162 × 24
#>    ascore hteamid hgoals localtime    is_grand_final date  hscore ateamid agoals
#>     <int>   <int>  <int> <chr>                 <int> <chr>  <int>   <int>  <int>
#>  1     74       1     11 2020-03-21 …              0 2020…     71      16     11
#>  2     57       5      9 2020-03-21 …              0 2020…     63       6      8
#>  3     76       8      4 2020-03-21 …              0 2020…     29      13     10
#>  4     73       9     17 2020-03-21 …              0 2020…    105       7     11
#>  5     62      10     14 2020-03-22 …              0 2020…     90       2      9
#>  6     54      12      8 2020-03-22 …              0 2020…     56      15      7
#>  7     81      14     16 2020-03-19 …              0 2020…    105       3     12
#>  8     51      17     12 2020-03-22 …              0 2020…     78      11      7
#>  9     86      18      5 2020-03-20 …              0 2020…     34       4     13
#> 10     69       2     12 2020-06-13 …              0 2020…     81       6     10
#> # ℹ 152 more rows
#> # ℹ 15 more variables: hbehinds <int>, venue <chr>, hteam <chr>,
#> #   is_final <int>, id <int>, roundname <chr>, round <int>, winner <chr>,
#> #   abehinds <int>, ateam <chr>, tz <chr>, updated <chr>, complete <int>,
#> #   winnerteamid <int>, year <int>

Sources

Fetch info about one or more computer models.

# You can get the sources
fetch_squiggle_data("sources")
#> # A tibble: 25 × 4
#>    url                                   icon                           id name 
#>    <chr>                                 <chr>                       <int> <chr>
#>  1 "https://live.squiggle.com.au/"       "/wp-content/uploads/2017/…     1 Squi…
#>  2 "https://thearcfooty.com/"            "/wp-content/themes/squigg…     2 The …
#>  3 "http://figuringfooty.com/"           "/wp-content/themes/squigg…     3 Figu…
#>  4 "http://www.matterofstats.com/"       "/wp-content/themes/squigg…     4 Matt…
#>  5 ""                                    ""                              5 Punt…
#>  6 "https://footymaths.blogspot.com"     "/wp-content/themes/squigg…     6 FMI  
#>  7 "http://plussixoneblog.com/"          "/wp-content/themes/squigg…     7 Plus…
#>  8 "/introducing-s10/"                   ""                              8 Aggr…
#>  9 "http://graftratings.com/afl/"        "/wp-content/themes/squigg…     9 Graft
#> 10 "https://stattraction.wordpress.com/" "/wp-content/themes/squigg…    10 Stat…
#> # ℹ 15 more rows

Tips

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

# Get all tips
fetch_squiggle_data("tips")
#> # A tibble: 15,682 × 21
#>    hmargin  year gameid ateamid source correct   err    bits ateam updated date 
#>      <dbl> <int>  <int>   <int> <chr>    <int> <dbl>   <dbl> <chr> <chr>   <chr>
#>  1   -1     2017      1      14 Squig…       1 42     0      Rich… 2017-0… 2017…
#>  2   NA     2017      1      14 Figur…       1 NA     0.214  Rich… 2017-0… 2017…
#>  3    5.39  2017      1      14 Matte…       0 48.4  -0.208  Rich… 2017-0… 2017…
#>  4  -10.3   2017      2      18 Matte…       1  3.69  0.326  West… 2017-0… 2017…
#>  5  -17     2017      2      18 Squig…       1  3     0.310  West… 2017-0… 2017…
#>  6    3     2017      8       9 Squig…       1 53     0      Grea… 2017-0… 2017…
#>  7   -8     2017      1      14 The A…       1 35     0.234  Rich… 2017-0… 2017…
#>  8  -13     2017      2      18 The A…       1  1     0.358  West… 2017-0… 2017…
#>  9    2     2017      4      11 The A…       0 32    -0.0862 Melb… 2017-0… 2017…
#> 10   29     2017      3      13 The A…       0 57    -1.28   Port… 2017-0… 2017…
#> # ℹ 15,672 more rows
#> # ℹ 10 more variables: hteamid <int>, round <int>, hconfidence <dbl>,
#> #   margin <dbl>, tipteamid <int>, sourceid <int>, venue <chr>, hteam <chr>,
#> #   confidence <dbl>, 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 × 21
#>    hmargin  year gameid ateamid source correct   err    bits ateam updated date 
#>      <dbl> <int>  <int>   <int> <chr>    <int> <dbl>   <dbl> <chr> <chr>   <chr>
#>  1    NA    2018    372       3 Punte…       1  NA    0.675  Carl… 2018-0… 2018…
#>  2    NA    2018    373       1 Punte…       1  NA    0.0588 Adel… 2018-0… 2018…
#>  3    NA    2018    374       2 Punte…       1  NA    0.521  Bris… 2018-0… 2018…
#>  4    NA    2018    375       6 Punte…       1  NA    0.666  Frem… 2018-0… 2018…
#>  5    NA    2018    376      12 Punte…       0  NA   -0.0151 Nort… 2018-0… 2018…
#>  6    NA    2018    377       4 Punte…       1  NA    0.122  Coll… 2018-0… 2018…
#>  7    NA    2018    378      18 Punte…       1  NA    0.530  West… 2018-0… 2018…
#>  8    NA    2018    379       7 Punte…       0  NA   -0.198  Geel… 2018-0… 2018…
#>  9    NA    2018    380      16 Punte…       1  NA    0.486  Sydn… 2018-0… 2018…
#> 10    35.2  2018    372       3 Aggre…       1   9.2  0.674  Carl… 2018-0… 2018…
#> # ℹ 116 more rows
#> # ℹ 10 more variables: hteamid <int>, round <int>, hconfidence <dbl>,
#> #   margin <dbl>, tipteamid <int>, sourceid <int>, venue <chr>, hteam <chr>,
#> #   confidence <dbl>, 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 × 15
#>    percentage played goals_against name   behinds_for  wins losses against draws
#>         <dbl>  <int>         <int> <chr>        <int> <int>  <int>   <int> <int>
#>  1      262.       1             4 Port …          16     1      0      29     0
#>  2      253.       1             5 Colli…           8     1      0      34     0
#>  3      153.       1             7 West …           6     1      0      51     0
#>  4      145.       1             9 Hawth…           6     1      0      62     0
#>  5      144.       1            11 Great…           3     1      0      73     0
#>  6      130.       1            12 Richm…           9     1      0      81     0
#>  7      111.       1             8 Essen…           9     1      0      57     0
#>  8      104.       1            11 Sydney           8     1      0      71     0
#>  9      104.       1             7 North…           8     1      0      54     0
#> 10       96.4      1             8 St Ki…          12     0      1      56     0
#> 11       95.9      1            11 Adela…           5     0      1      74     0
#> 12       90.5      1             9 Frema…           9     0      1      63     0
#> 13       77.1      1            16 Carlt…           9     0      1     105     0
#> 14       69.5      1            17 Geelo…           7     0      1     105     0
#> 15       68.9      1            14 Brisb…           8     0      1      90     0
#> 16       65.4      1            12 Melbo…           9     0      1      78     0
#> 17       39.5      1            13 Weste…           4     0      1      86     0
#> 18       38.2      1            10 Gold …           5     0      1      76     0
#> # ℹ 6 more variables: for. <int>, id <int>, rank <int>, pts <int>,
#> #   goals_for <int>, behinds_against <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 × 12
#>    teamid mean_rank updated  percentage source sourceid swarms  rank  wins round
#>     <int>     <dbl> <chr>         <dbl> <chr>     <int> <chr>  <int> <dbl> <int>
#>  1      1      6.11 2019-07…      111.  Squig…        1 "c(\"…     6  12.7    15
#>  2      2      6.01 2019-07…      107.  Squig…        1 "c(\"…     5  13      15
#>  3      3     16.7  2019-07…       82.8 Squig…        1 "c(\"…    17   6.1    15
#>  4      4      4.20 2019-07…      114   Squig…        1 "c(\"…     4  14.1    15
#>  5      5      9.98 2019-07…       99.8 Squig…        1 "c(\"…    10  10.8    15
#>  6      6      9.71 2019-07…      104.  Squig…        1 "c(\"…     9  10.8    15
#>  7      7      1.21 2019-07…      138.  Squig…        1 "c(\"…     1  17.3    15
#>  8      8     17.7  2019-07…       70.2 Squig…        1 "c(\"…    18   4.9    15
#>  9      9      3.26 2019-07…      129.  Squig…        1 "c(\"…     2  14.4    15
#> 10     10     13.0  2019-07…       97.6 Squig…        1 "c(\"…    14   8.8    15
#> 11     11     14.8  2019-07…       85.3 Squig…        1 "c(\"…    16   8      15
#> 12     12     10.9  2019-07…       98.9 Squig…        1 "c(\"…    11  10.2    15
#> 13     13      8.24 2019-07…      107.  Squig…        1 "c(\"…     8  11.5    15
#> 14     14      6.67 2019-07…      101.  Squig…        1 "c(\"…     7  12.8    15
#> 15     15     13.8  2019-07…       83.2 Squig…        1 "c(\"…    15   9      15
#> 16     16     12.9  2019-07…       93.4 Squig…        1 "c(\"…    13   9.2    15
#> 17     17      4.16 2019-07…      107.  Squig…        1 "c(\"…     3  14.4    15
#> 18     18     11.9  2019-07…       94.1 Squig…        1 "c(\"…    12   9.8    15
#> # ℹ 2 more variables: team <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 × 21
#>   PAV_mid_rank mPAV_def games firstname mPAV_mid  year PAV_total PAV_def_rank
#>          <int>    <dbl> <int> <chr>        <dbl> <int>     <dbl>        <int>
#> 1            1    -0.41    25 Dustin        2.06  2017      26.8          253
#> # ℹ 13 more variables: name <chr>, PAV_off_rank <int>, X._of_team_games <dbl>,
#> #   PAV_total_rank <int>, PAV_mid <dbl>, surname <chr>, PAV_def <dbl>,
#> #   team <int>, mPAV_total <dbl>, pavid <int>, mPAV_off <dbl>, PAV_off <dbl>,
#> #   mPAV_rank <int>