On the wire · 04:47:39 UTC Live 550 · Prematch 14,364 · Markets 57,043 Vol. I · No. 5 · Friday 13 November 2026 wss://pinnfeed.io/v1/stream
PinnFeed
Tutorial · Python · FastAPI

Pinnacle-Quoten-Proxy mit FastAPI

Aktualisiert am · PinnFeed · 1 Min. Lesezeit

Antwort: starten Sie eine kleine FastAPI-App, die PINNFEED_KEY aus der Umgebung liest, /v1/odds mit httpx aufruft, das Ergebnis kurz cached und nur nötige Felder zurückgibt. Der Browser spricht mit Ihrer API; der Key verlässt den Server nicht.

app.py#

import os, time
import httpx
from fastapi import FastAPI, HTTPException

KEY = os.environ["PINNFEED_KEY"]            # ps_live_...
API = "https://pinnfeed.io/v1"
TTL = 5                                     # seconds
cache: dict[str, tuple[float, list]] = {}
app = FastAPI()
client = httpx.AsyncClient(headers={"x-api-key": KEY}, timeout=10)

@app.get("/odds/{sport}")
async def odds(sport: str, q: str | None = None):
    ck = f"{sport}|{q}"
    hit = cache.get(ck)
    if hit and time.time() - hit[0] < TTL:
        return hit[1]
    params = {"sport": sport, "market": "moneyline", "main": "true", "limit": 100}
    if q:
        params["q"] = q
    r = await client.get(f"{API}/odds", params=params)
    if r.status_code != 200:
        raise HTTPException(r.status_code, r.json().get("error", {}).get("message", "upstream error"))
    rows = [
        {"id": e["id"], "home": e["home"], "away": e["away"], "start": e["startTime"], "live": e["live"],
         "prices": {o["name"]: o["decimal"] for m in e["markets"] for o in m["outcomes"]},
         "maxStake": max((m["maxStake"] or 0) for m in e["markets"]) if e["markets"] else None}
        for e in r.json()["events"]
    ]
    cache[ck] = (time.time(), rows)
    return rows

Mit pip install fastapi uvicorn httpx und uvicorn app:app --port 8000, dann /odds/soccer?q=arsenal.

CTA#

Builder (99 €/Monat). 3 Tage Testphase; Karte erforderlich. REST gratis: Signup. Andere Hosts: Cloudflare Worker, Supabase. Verwandt: Browser-JS / CORS.

Häufige Fragen#

Warum nicht PinnFeed aus JavaScript?#

CORS erlaubt es, aber der Key wäre öffentlich: Browser-JS und CORS.

Macht der Cache Quoten alt?#

Bis zu TTL Sekunden. 1–5 s für Prematch; WebSocket für Live.

Kann ich Flask nutzen?#

Ja; gleiches Muster mit requests und Dict-Cache.

Bildungsinhalt für Erwachsene (18+). Keine Tipps, kein Gewinnversprechen. In Deutschland nur bei Anbietern auf der GGL-Whitelist wetten.

Der WebSocket-Plan: Builder, 99 €/Monat.

Pinnacle-Quoten in Echtzeit über einen einzigen WebSocket: alle 13 Sportarten, alle Märkte, faire Quoten ohne Marge und Schlussquoten. 3 Tage kostenlos, mit einem Klick kündbar.

Form K-1 · Free API key

Get your free API key.

One field. No password, no card: enter your email, click the link we send, and your key is on screen.

By continuing you agree to the Terms and Privacy Policy.

One free key per email. Link valid for 20 minutes.