Skip to content

examples: tennis markets grounded in live match state - #6

Open
bensynapse wants to merge 1 commit into
0xharryriddle:mainfrom
bensynapse:tennis-live-example
Open

examples: tennis markets grounded in live match state#6
bensynapse wants to merge 1 commit into
0xharryriddle:mainfrom
bensynapse:tennis-live-example

Conversation

@bensynapse

Copy link
Copy Markdown

Disclosure up front: I run the Live Tennis API (livetennisapi.com), so this contribution is vendor-authored — judge accordingly. It only uses our free keyed tier, and the example's docstring discloses the same.

What

examples/tennis_live_markets.py, following the structure and pp() style of examples/demo.py: search tennis markets on Polymarket via pmxt_search, then pair each market with the live state of its underlying match (score line, who is serving, status) fetched with stdlib urllib — no new dependency — before any quote is interpreted. Plus one line in the README repo-structure tree.

The motivation is the package's own pitch: "instead of hallucinating probabilities, the agent checks actual market prices." For in-play sports markets the same argument extends to the event — an agent shouldn't reason about a tennis market without knowing the actual score.

Honest limits

  • The live-state half degrades gracefully when LIVETENNIS_API_KEY is unset (prints a note, still demos the market half). Free keys: https://livetennisapi.com/subscribe/free — 30 req/min / 100 req/day, which suits developing and testing or ~15-minute checks, not continuous in-play polling. The docstring says exactly that.

How I tested

  • ruff check passes (line-length 100 per pyproject).
  • Ran in a fresh venv with pmxt installed: the Polymarket search currently returns a 422 through pmxt in my environment (same for demo.py's bitcoin query, so it's environmental/upstream, not this example); the example handles it and exits cleanly.
  • Without pmxt: raises the package's standard helpful ImportError at call time, same as demo.py.
  • Helper functions (score_line, match_market_to_live, no-key path) unit-exercised directly.

AI-assisted (Claude), reviewed and understood before submitting. If examples aren't where you want vendor-adjacent material, happy to rework or close.

…tch state

Searches tennis markets via pmxt_search, then pairs each market with the
live match state (score, server, status) from the Live Tennis API before
interpreting any quote -- the same grounding argument the package makes
for prices, applied to the event itself. Degrades gracefully when
LIVETENNIS_API_KEY is unset or pmxt is unavailable.

Contributed by the Live Tennis API team (disclosed in the example
docstring), free keyed tier only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant