Twitter Bot Commands

I have written a brief tutorial on how to query the twitter bot so that it will return the statistics or graphs you want. If you have any questions please feel free to email me or contact me on twitter.

There are two types of queries that the bot will provide. They are divided into statistical queries and graph queries. As of right now the statistical query will return the season values of CF%, xGF%, and ixG for players and CF% and xGF% for teams. For the graphs it will return a 5 game moving average over the season for players and teams for these values, and these values only as of right now:

Statistics the Bot will Graph:

toi | cf | ca | c_plus_minus | ff | fa | xgf | xga | gf | ga | g | a1 | a2 | ixg | cf60 | ca60 | cf_percent | ff60 | fa60 | ff_percent | gf60 | ga60 | gf_percent | xgf60 | xga60 | xgf_percent | g60 | a160 | a260 | p60 | ixg60

C stands for Corsi, F for Fenwick, and xg stands for expected goals which uses my method detailed here here. The stats and player names must be spelled EXACTLY as listed above to properly process your query. Also player names should be spelled correctly as well. There is no fuzzy searching implemented for this bot yet so if you can’t spell Marchessault then you aren’t getting his stats, at least from here. Also the team names are the same abbreviations that you will find on Corsica

In addition you can flag the query to return values adjusted for score and venue with the ‘-adj’ flag and for 5v5 only with the ‘-5v5’ flag. Listed below are the entire examples that the bot will take and return a value. They have to be entered in that order and the -adj and -5v5 flags are optional. If you are familiar with terminal or cmd line commands these are structured in a very similar way. Any misspellings, any words out of order will cause your request not to be processed. The ‘vs.’ keyword will return the graph/stats of two teams/players and is necessary for that effect to happen.

We now have Goalie staistics as well:

ca | fa | xga | sa | ga | ldga | mdga | hdga | lda | mda | hda | sv_percent | fsv_percent | xfsv_percent | dfsv_percent | hdsv_percent | mdsv_percent | ldsv_percent | gsaa

These are the statistics you can query to get a running average in graph feature of the bot for goalies. Gsaa for the total season stats will just be an adjusted GSAA based on the High Danger, Medium Danger, and Low Danger shots faced by a goalie. The five game running average will be an adjusted gsaa30 which is the adjusted goals saved above average per 30 shots to help account for a goalie's TOI. Goalie stats are not adjusted for home and score as player stats are but can be flagged for 5v5 only as player stats are.


Stat Query Examples

@barloweanalytic Justin Faulk playerstats 2018 -adj -5v5

This will return the 5v5 score venue adjusted values of Justin Faulk’s CF%, xGF%, and ixG

@barloweanalytic Car teamstats 2018 -adj -5v5

This will return the Carolina hurricanes CF% and xGF% score venue adjusted and at 5v5.

If you wanted either of those unadjusted you would type the same query and leave out the ‘-adj’ flag and if you wanted all situations you would do the same with the ‘5v5’ flag

@barloweanalytic Justin Faulk vs. Jeff Skinner playerstats 2018

This will return both the stats for Faulk and Skinner. If you want to adjust them add the appropriate flags

@barloweanalytic Cam Ward vs. Scott Darling goaliestats 2018

This query will return the season goaliestats for Cam Ward and Scott Darling. This will include Sv%, LDSV%, MDSV%, HDSV% and adjusted GSAA. If you want to adjust them add the appropriate flags

Graph examples

@barloweanalytic Justin Faulk player graph cf_percent 2018 -adj -5v5

This will return the graph of a 5 game rolling average of Justin Faulk’s CF% adjusted and 5v5 only

@barloweanalytic Justin Faulk vs. Jeff Skinner player graph cf_percent 2018 -adj -5v5

This will do the same as above but also graph Jeff Skinner’s stats as well

@barloweanalytic CAR team graph cf_percent 2018 -adj -5v5

As above but now for the Carolina Hurricanes

@barloweanalytic Car vs. PIT team graph cf_percent 2018 -adj -5v5

Just like with the Carolina graph above but will also plot Pittsburgh’s cf% values over the season as well

@barloweanalytic Cam Ward vs. Scott Darling goalie graph sv_percent 2018 -5v5

This will return the 5 game running average of SV% for Cam Ward and Soctt Darling from the 2018 season filtered to include only stats that happened at 5v5.

Last things:

The player names and team names are case insensitive everything else should be lower case. If the bot doesn’t respond that means you made an error in your query and should double check and try again. If you feel that your query is correct and something is wrong please contact me through twitter or email barloweanalytics@gmail.com

Team Abbreviations:


Would also like to think Emannuel Perry for his game scraper and Harry Shomer for his scraper as well. Without either of these guys this project would not be possible so a big thanks goes to them for writing the programs used to compile the NHL pbp data that I then convert into stats that the bot can access to fulfill the queries.