# Hit rate from a game log

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

## Ten-line hit rate, no analysis tier required
```python title="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}")
```

> **paid shortcut**
>
> This recipe is free-tier: it walks `/persons/{id}/game-log` and does the counting
>   client-side. If you'd rather have the server compute season/recent/home-away windows and
>   hit rates for you in one call, use `/analysis/player-prop` (10× weight, paid tier). See
>   [Building a prop-analysis bot](/docs/guides/prop-analysis-bot).

[Try the person game-log endpoint in the playground →](/docs/api)
