Skip to main content

Data-Golf-API PyPI version

Data Golf API (Unofficial)

An Unofficial API Library for DataGolf.com APIs

This is a Python library for interacting with the DataGolf APIs. DataGolf is a golf analytics platform that provides a wide range of data and analytics for golf tournaments, players, and courses.

This is an unofficial API lib, and it is not affiliated with DataGolf in any way.

This is being built to support some ML projects I am working on. I will be continuing to add more endpoints as I need them. If you have a specific endpoint you need, please open a ticket for submit a PR.


Developer Note:

This is in development. Code structure will change as I get all the endpoints added. So expect some renaming and convention changes.

Contact

Im available on Bluesky for any questions or just general chats about enhancements.


Usage + Installation & Setup

(Currently this only supports JSON formats, CSV is on the roadmap)

pip install data_golf
from data_golf import DataGolfClient

client = DataGolfClient(api_key="YOUR_API_KEY")

# For more request logging
client = DataGolfClient(api_key="YOUR_API_KEY", verbose=True)

Main Modules

These modules map directly to the DataGolf API Documentation available on their site:

  1. General
  2. Predictions
  3. Live Predictions

The Data Golf API is a paid service via DataGolf.com, there they will provide you with an API Key. This library is only a helper utility, to make interacting and consuming the API easier.


General APIs

Player List

API Endpoint Info

Endpoint: /get-player-list
Method: GET
Formats: JSON

players = client.general.player_list()

Current Season Tour Schedule

API Endpoint Info

Endpoint: /get-schedule
Method: GET
Formats: JSON

Param Type Ex
tour str all, pga, euro, kft, alt, liv
# Can use optinal parameter 'tour' to filter by tour: pga, euro, kft, alt, liv
tour_schedule = client.general.tour_schedule()
tour_schedule = client.general.tour_schedule(tour="pga")
tour_schedule = client.general.tour_schedule(tour="liv")

Field Updates

API Endpoint Info

Endpoint: /field-updates
Method: GET
Formats: JSON

Param Type Ex
tour str all, pga, euro, kft, alt, liv
# tour = pga (default), euro, kft, opp, alt
rsp = client.general.field_updates() # defaults to pga
rsp = client.general.field_updates(tour="kft")

Model Prediction APIs

Rankings

API Endpoint Info

Endpoint: /preds/get-dg-rankings
Method: GET
Formats: JSON

rankings = client.predictions.rankings()

Pre Tournament Predictions

API Endpoint Info

Endpoint: /preds/pre-tournament
Method: GET
Formats: JSON

rsp = client.predictions.pre_tournament()

rsp = client.predictions.pre_tournament(
    tour='pga',
    dead_heat=True,
    odds_format='american'
)

Pre Tournament Prediction Archive

API Endpoint Info

Endpoint: /preds/pre-tournament-archive
Method: GET
Formats: JSON

# Supports optional parameters event_id:, year:, odds_format:
rsp = client.predictions.pre_tournament_pred_archive()

rsp = client.predictions.pre_tournament_pred_archive(
    year=2021,
)

Player Skill Decomposition

API Endpoint Info

Endpoint: /preds/player-decompositions
Method: GET
Formats: JSON

# Supports optional parameters tour:
rsp = client.predictions.player_skill_decompositions()
rsp = client.predictions.player_skill_decompositions(tour='alt')

Player Skill Ratings

API Endpoint Info

Endpoint: /preds/skill-ratings
Method: GET
Formats: JSON

# Supports optional param display: (value, rank)
rsp = client.predictions.player_skill_ratings()
rsp = client.predictions.player_skill_ratings(display="rank")

Detailed Approach Skill

API Endpoint Info

Endpoint: /preds/approach-skill
Method: GET
Formats: JSON

Param Type Ex
period str l24 (last 24 months) (default),
l12 (last 12 months), ytd (year to date)
rsp = client.predictions.detailed_approach_skill()
rsp = client.predictions.detailed_approach_skill(period='ytd')

Fantasy Projections

API Endpoint Info

Endpoint: /preds/fantasy-projection-defaults
Method: GET
Formats: JSON

Param Type Ex
tour str pga (default), euro, opp (opposite field PGA TOUR event), alt
site str draftkings (default), fanduel, yahoo
slate str main (default), showdown, showdown_late, weekend, captain
rsp = client.predictions.fantasy_projection()
rsp = client.predictions.fantasy_projection(tour='pga', site='fanduel', slate='showdown')

Live Predictions

Live Model Predictions

API Endpoint Info

Endpoint: /preds/in-play
Method: GET
Formats: JSON

Param Type Ex
tour str pga (default), euro, opp (opposite field PGA TOUR event), alt
dead_head bool False (default), True
odds_format str percent (default), american, decimal, fraction
data = dg.live_predictions.live_in_play()
data = dg.live_predictions.live_in_play(tour='kft', odds_format='american')

Live Tournament Stats

Returns live strokes-gained and traditional stats for every player during PGA Tour tournaments.

API Endpoint Info

Endpoint: /preds/live-tournament-stats
Method: GET
Formats: JSON

Param Type Ex
stats csv str Comma-separated list of statistics to be returned. Supports: sg_putt, sg_arg, sg_app, sg_ott, sg_t2g, sg_bs, sg_total,
distance, accuracy, gir, prox_fw, prox_rgh, scrambling
round str event_avg, 1, 2, 3, 4
display str value (default), rank
data = dg.live_predictions.live_tournament_stats()
data = dg.live_predictions.live_tournament_stats(stats="sq_arg, sg_bs", disppaly="rank")

Live Hole Scoring Distruibution

Returns live hole scoring averages and distrubutions (birdies, pars, bogeys, etc.) broken down by tee time wave.

API Endpoint Info

Endpoint: /preds/live-hole-stats
Method: GET
Formats: JSON

Param Type Ex
tour str pga (default), euro, opp (opposite field PGA TOUR event), kft, alt
round str event_avg, 1, 2, 3, 4
display str value (default), rank
data = dg.live_predictions.live_hole_stats()
data = dg.live_predictions.live_hole_stats(tour='kft')

Betting

Outright Odds

Returns the most recent win, top 5, top 10, top 20, make/miss cut, and first round leader odds offered at 11 sportsbooks alongside the corresponding predictions from the DG model.

API Endpoint Info

Endpoint: /betting-tools/outrights
Method: GET
Formats: JSON

Param Type Ex
tour (str, optional) pga (default), euro, opp (opposite field PGA TOUR event), kft, alt
market (str, required) Specifies the match-up market. Supports values: win, top_5, top_10, top_20, mc, make_cut, frl
odds_format (str, optional) Specifies the odds format. Supports values: percent, american, decimal (default), fraction
data = dg.betting.outright_odds(market='win')
data = dg.betting.outright_odds(market='top_5', tour='euro')

Matchup Odds

Returns the most recent tournament match-up, round match-up, and 3-ball odds offered at 8 sportsbooks alongside the corresponding prediction from our model.

API Endpoint Info

Endpoint: /betting-tools/matchups
Method: GET
Formats: JSON

Param Type Ex
tour (str, optional) pga (default), euro, opp (opposite field PGA TOUR event), kft, alt
market (str, required) Specifies the match-up market. Supports values: tournament_matchups, round_matchups, 3_balls
odds_format (str, optional) Specifies the odds format. Supports values: percent, american, decimal (default), fraction
data = dg.betting.matchup_odds(market='tournament_matchups')
data = dg.betting.matchup_odds(market='3_balls', tour='euro')

Matchup Odds - All Pairings

Returns Data Golf matchup / 3-ball odds for every pairing in the next round of current PGA Tour and European Tour events.

API Endpoint Info

Endpoint: /betting-tools/matchups-all-pairings
Method: GET
Formats: JSON

Param Type Ex
tour (str, optional) pga (default), euro, opp (opposite field PGA TOUR event), kft, alt
odds_format (str, optional) Specifies the odds format. Supports values: percent, american, decimal (default), fraction
data = dg.betting.matchup_odds_all_pairings(tour='pga')
data = dg.betting.matchup_odds_all_pairings(tour='euro', odds_format='american')

Metadata

Release files for data_golf 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for data_golf 0.5.1
File Size Uploaded
data_golf-0.5.1.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for data_golf 0.5.1
File Interpreter ABI Platform
data_golf-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / data_golf-0.5.1.tar.gz

Download URL data_golf-0.5.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5499d8202edd0ce877aba37e2123c613e9e294bad4eb7605f212675e32639bc6
BLAKE2b-256 checksum
How to use checksums
1a6c7bfdc4cbd15ed7dda99cee35d1ccee84b32e4d9de3dbabaa9d3f4b88d44a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

Release files / data_golf-0.5.1-py3-none-any.whl

Download URL data_golf-0.5.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03999c382111c78cdee8777606979a34eb8e25da78fdf8825906356628ceb852
BLAKE2b-256 checksum
How to use checksums
e09f9112188bf87249c64cbe92d81545a3c5671a7b3e09b593fd1855f873beee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page