Skip to content

ahump20/basketball

v1.0.1MIT

Basketball fundamentals: rules, possessions, offensive and defensive rating, Four Factors and true shooting from real box scores for the NBA and college, and free data sources.

basketball

/plugin marketplace add ahump20/Sports-Plugins
/plugin install basketball@Sports-Plugins
SkillWhat it does
basketball-rulesNBA, WNBA, NCAA and FIBA rules where they differ and where models get them wrong
basketball-analyticshoops.py builds possessions, offensive and defensive rating and the Four Factors from every box score of a season, and computes true shooting, effective field goal percentage and usage
basketball-dataVerified sportsdataverse, nba_api and Basketball-Reference sources, codes and traps

Checked against published numbers in skills/basketball-analytics/tests:

CaseExpectedSource
Stephen Curry 2015-16 TS% / eFG%.669 / .630Basketball-Reference
2015-16 Warriors TOV / opponent TOV1245 / 1185Basketball-Reference
2015-16 Warriors ORtg / DRtg / NRtg114.5 / 103.8 / +10.7, within 0.05Basketball-Reference
Nikola Jokic 2023-24 eFG%.612Basketball-Reference
python3 -m unittest discover -s plugins/basketball/skills/basketball-analytics/tests
SPORTS_LIVE=1 python3 -m unittest discover -s plugins/basketball/skills/basketball-analytics/tests   # downloads NBA and college box scores

Python 3.9+, standard library only.