Fetch Pinnacle closing lines in Python for CLV
Answer: On Builder+, call GET /v1/closing?date=YYYY-MM-DD for a UTC day, or GET /v1/closing/{eventId} for one match. Compare your bet’s decimal price to the archived closing price to estimate closing-line value (CLV). Endpoints match /openapi.json.
Day dump + one-event lookup#
import os, requests
from datetime import date, timedelta
KEY = os.environ["PINNFEED_KEY"]
H = {"x-api-key": KEY}
BASE = "https://pinnfeed.io"
# Yesterday's soccer main closings (UTC day)
day = (date.today() - timedelta(days=1)).isoformat()
r = requests.get(
f"{BASE}/v1/closing",
headers=H,
params={"date": day, "sport": "soccer", "main": "true", "limit": 100, "offset": 0},
timeout=20,
)
r.raise_for_status()
rows = r.json().get("closings") or r.json().get("events") or r.json()
print("rows:", len(rows) if isinstance(rows, list) else rows)
# Single event
event_id = "123456789" # replace
one = requests.get(f"{BASE}/v1/closing/{event_id}", headers=H, timeout=15)
one.raise_for_status()
print(one.json())
Free and Hobby return 403 on closing — upgrade to Builder (€99/mo, WebSocket + closings) or Pro. Paid plans: 3-day trial; a card is required and it is charged after day 3 unless you cancel. Deeper walkthrough: CLV guide. Educational content for adults (18+).
Questions people ask#
What timezone is date?#
UTC calendar day (YYYY-MM-DD), as documented on /v1/closing in the OpenAPI.
How do I compute CLV?#
CLV ≈ your decimal price ÷ closing decimal − 1 (for the same outcome). Positive means you beat the close. Always store both prices and the market id when you bet.