statshawk
Cookbook

Hit rate from a game log

free

Compute hit rate for a stat + line yourself from the free-tier game-log endpoint.

Ten-line hit rate, no analysis tier required

hit_rate_from_gamelog.py
import os, requests
KEY = os.environ["STATSHAWK_KEY"]
BASE = "https://api.statshawk.ai/v1"

person = requests.get(
    f"{BASE}/persons",
    headers={"X-API-Key": KEY},
    params={"q": "Jayson Tatum", "limit": 1},
    timeout=10,
).json()["data"]["items"][0]

games = requests.get(
    f"{BASE}/persons/{person['id']}/game-log",
    headers={"X-API-Key": KEY},
    params={"competition": "nba", "season": 2025},
    timeout=10,
).json()["data"]["items"]

line = 27.5
values = [
    p["measures"]["pts"]
    for g in games
    for p in g["line"]["phases"]
    if "pts" in p["measures"]
]

hits = sum(1 for v in values if v > line)
print(f"{hits}/{len(values)}  ({hits / len(values):.0%} hit rate) over {line}")
Try the person game-log endpoint in the playground →

On this page