From 038e257eec07f71bbc86f724178adf325c13197b Mon Sep 17 00:00:00 2001 From: Esther-MacMini Date: Sat, 5 Dec 2026 14:31:09 -0500 Subject: [PATCH] Preserve quote timestamps across supported Python versions in SDK 0.3.6 --- CHANGELOG.md | 6 ++++++ README.md | 35 ++++++++++++++++----------------- examples/odds_workspace.py | 2 +- examples/test_odds_workspace.py | 25 +++++++++++++++++++++++ parlay_api/__init__.py | 2 +- pyproject.toml | 2 +- tests/test_installed_package.py | 2 +- 7 files changed, 52 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63492fa..31765bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Using the [0.3.3 package on PyPI](https://pypi.org/project/parlay-api/0.3.3/)? [Run its price converters in Jupyter](https://jupyter.org/try-jupyter/lab/index.html?fromURL=https%3A%2F%2Fraw.githubusercontent.com%2FJacobiusMakes%2Fparlay-api-python%2Fmain%2Fexamples%2Fprice-pair.ipynb) with two fictional basketball quotes. Change the away price from +110 to −110 to see why the modeled surplus disappears. The notebook needs no account or API key. +## 0.3.6 - 2026-12-05 + +- Preserve fractional-second quote clocks on Python 3.9. For example, `14:04:00.12Z` retains both digits in the CSV. Empty and invalid clock fields still produce empty cells. +- Report timestamps with invalid offset minutes, such as `+01:60`, through the existing timestamp diagnostic. +- Link the packaged quickstart to the same runnable examples readers can open on GitHub. + ## 0.3.5 - 2026-12-01 - Handle nested service errors on authenticated requests. Monthly credit exhaustion diff --git a/README.md b/README.md index f718f26..ecac4c7 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ To try the comparison before installing Python, [open the basketball quickstart En español, [prueba el ejemplo de cuotas de la NBA en Colab](https://colab.research.google.com/github/JacobiusMakes/parlayapi-notebooks/blob/main/primera-consulta-nba.ipynb) para convertir dos precios ficticios en una tabla de pandas. -Install the 0.3.5 wheel from this repository’s GitHub Releases, then make one -public NBA request. This version includes the sample finder and handles structured -API access errors. +Install the 0.3.6 wheel for Python 3.9 or later, then make one public NBA request. +The CSV keeps the source's fractional-second precision in the bookmaker and market +update columns. Missing or invalid clocks leave the corresponding cell empty. ```bash -python -m pip install https://github.com/JacobiusMakes/parlay-api-python/releases/download/v0.3.5/parlay_api-0.3.5-py3-none-any.whl +python -m pip install https://github.com/JacobiusMakes/parlay-api-python/releases/download/v0.3.6/parlay_api-0.3.6-py3-none-any.whl python -m parlay_api --sport basketball_nba > odds.csv ``` @@ -22,7 +22,7 @@ Open `odds.csv` and look for an event, bookmaker, outcome and price. A header alone means there were no usable rows in this response. You can also [inspect the NBA demo in your browser](https://parlay-api.com/v1/try/basketball_nba/odds). -[Turn your NBA CSV into an offline game-by-game report](examples/nba-csv-report/). See both team prices from each bookmaker, along with missing sides and market clocks. The kit includes a fictional report you can open immediately. [Record the receipt time with your next NBA preview](examples/nba-csv-report/README.md#record-a-board-for-a-deadline-replay) to compare two books at a deadline. The downloadable recorder also saves an HTML report and keeps earlier captures. +[Turn your NBA CSV into an offline game-by-game report](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/nba-csv-report). See both team prices from each bookmaker, along with missing sides and market clocks. The kit includes a fictional report you can open immediately. [Record the receipt time with your next NBA preview](https://github.com/JacobiusMakes/parlay-api-python/blob/main/examples/nba-csv-report/README.md#record-a-board-for-a-deadline-replay) to compare two books at a deadline. The downloadable recorder also saves an HTML report and keeps earlier captures. For a DataFrame, [watch the five-minute Python walkthrough](https://www.youtube.com/watch?v=y-OUqORA8wo) or [open the notebook and transcript](https://jacobiusmakes.github.io/parlayapi-notebooks/first-request/). @@ -55,11 +55,11 @@ and invalid outcomes are excluded with diagnostics on stderr. Missing timestamps stay empty; timestamps are not freshness guarantees. The starter makes no rankings or profit claims, and has no automatic retries, polling or key storage. -If your first request fails, [prepare a private support report](examples/support-report/) from the HTTP status, route and optional request ID. The example runs offline. +If your first request fails, [prepare a private support report](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/support-report) from the HTTP status, route and optional request ID. The example runs offline. ### Serve a private FastAPI snapshot -[Run the FastAPI coverage starter](examples/fastapi-coverage/) to read game and +[Run the FastAPI coverage starter](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/fastapi-coverage) to read game and source counts from a local endpoint. Start with fictional NBA data, then use your server-side key for a single coverage snapshot. Refreshing the local endpoint reuses that snapshot. @@ -74,19 +74,18 @@ python -c "from importlib.metadata import version; print(version('parlay-api'))" python -m parlay_api --help ``` -The wheel linked above reports `0.3.5` and includes `--find-example`. On -December 1, 2026 the [PyPI release](https://pypi.org/project/parlay-api/) -was `0.3.3`. That version supports `--sport basketball_nba`. Use the linked -wheel for the multi-sport sample finder and structured access-error examples. -Both verification commands run locally before you make a request. +The wheel linked above reports `0.3.6`. Compare that value with the version +in your environment and the [current PyPI listing](https://pypi.org/project/parlay-api/). +Both verification commands run locally. If a deadline matters to your report, +keep the time you received the response alongside the source clock. ## Backtest forecasts against the 2024 NBA Finals -Boston lost Game 4 by 38. How much better would a forecast look if you let the model revise it the next morning? [Read the worked example](examples/finals-forecast.ipynb) or [change a forecast in browser Python](https://jupyter.org/try-jupyter/lab/index.html?fromURL=https%3A%2F%2Fraw.githubusercontent.com%2FJacobiusMakes%2Fparlay-api-python%2Fmain%2Fexamples%2Ffinals-forecast.ipynb). The notebook uses official final scores and fictional probabilities. It runs without an API key. +Boston lost Game 4 by 38. How much better would a forecast look if you let the model revise it the next morning? [Read the worked example](https://github.com/JacobiusMakes/parlay-api-python/blob/main/examples/finals-forecast.ipynb) or [change a forecast in browser Python](https://jupyter.org/try-jupyter/lab/index.html?fromURL=https%3A%2F%2Fraw.githubusercontent.com%2FJacobiusMakes%2Fparlay-api-python%2Fmain%2Fexamples%2Ffinals-forecast.ipynb). The notebook uses official final scores and fictional probabilities. It runs without an API key. ## Compare an existing odds integration -[Run the local migration check](examples/odds-migration/) against two saved NBA +[Run the local migration check](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/odds-migration) against two saved NBA moneyline responses. It checks the request filters, event identity, bookmaker, outcome prices and timestamps your application requires. The fictional example runs with Python alone. Try an empty board or an HTTP 403 to see which check fails. @@ -190,7 +189,7 @@ The freshness cutoff accepts 60 to 86,400 seconds and applies to each book's price. `total_games_covered` counts distinct events on the board before the per-book freshness cutoff. The response includes the server's `as_of` time. -[Read a final football score by event ID](examples/final-score/). Run the saved Portugal–U.S. 0–0 example locally, then try a pending match. The reader preserves zero and matches each score to the named team even when the away score arrives first. +[Read a final football score by event ID](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/final-score). Run the saved Portugal–U.S. 0–0 example locally, then try a pending match. The reader preserves zero and matches each score to the named team even when the away score arrives first. The client includes sports, odds, events, scores, historical odds, player props, futures, usage and other endpoint methods. Check [current API documentation](https://parlay-api.com/docs) @@ -223,7 +222,7 @@ runs without keys or API requests. After a successful SDK request, `client.last_quota` contains the returned usage headers. Header fields may be `None` when the service does not provide them. -Practice a disconnect, duplicate update and reconnect using the [offline WebSocket replay](examples/websocket-replay). +Practice a disconnect, duplicate update and reconnect using the [offline WebSocket replay](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/websocket-replay). It runs with Python alone and includes a fictional price trace. With the wheel above installed, add the WebSocket dependency with `python -m pip install "websockets>=11.0"`. @@ -266,8 +265,8 @@ run `python3 odds_workspace.py`; the same flags apply. See The repository also contains: -- [Langflow odds sample audit](examples/langflow): a native-tested visual workflow using a fictional fixture, with no API or model key required. -- [Bruno private-research collection](examples/bruno): keyless discovery and individually enabled requests using your own key, with a visible sport selector. +- [Langflow odds sample audit](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/langflow): a native-tested visual workflow using a fictional fixture, with no API or model key required. +- [Bruno private-research collection](https://github.com/JacobiusMakes/parlay-api-python/tree/main/examples/bruno): keyless discovery and individually enabled requests using your own key, with a visible sport selector. - [Compare a complete three-way soccer market in Python](https://github.com/JacobiusMakes/parlayapi-betting-agent-starter#four-books-three-complete-markets). Run the fictional match with no key. See why a missing draw price changes which books contribute to a consensus. - [Compare player props from the same game](https://github.com/JacobiusMakes/parlay-api-python/blob/main/examples/ev_scanner.py). From a checkout with the SDK installed, run `python examples/ev_scanner.py --example`. Two fictional games have the same player and 19.5-point line. See why Friday’s +120 quote can be compared with Friday’s reference and Sunday’s +150 must be left out. The example runs offline. - [Compare two fictional basketball quotes](https://github.com/JacobiusMakes/parlay-api-python/blob/main/examples/arb_finder.py) with `python examples/arb_finder.py --example --bankroll 100` from a checkout with the SDK installed. Two +110 prices leave a 4.76-point gap in implied probability and a modeled net of 5.00 units on 100. [Change one price in a browser Python notebook](https://jupyter.org/try-jupyter/lab/index.html?fromURL=https%3A%2F%2Fraw.githubusercontent.com%2FJacobiusMakes%2Fparlay-api-python%2Fmain%2Fexamples%2Fprice-pair.ipynb) and rerun the calculation. diff --git a/examples/odds_workspace.py b/examples/odds_workspace.py index 5dafb4d..34e6e4d 100644 --- a/examples/odds_workspace.py +++ b/examples/odds_workspace.py @@ -110,7 +110,7 @@ def stamp(value, event_id, book_key=None, market_key=None): return None try: if not is_text(value) or not re.fullmatch( - r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})", value + r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:[0-5]\d)", value ): raise ValueError() # Validate the calendar fields on Python 3.9, retaining all supplied fraction digits in the export. diff --git a/examples/test_odds_workspace.py b/examples/test_odds_workspace.py index b3d6c03..9f30edc 100644 --- a/examples/test_odds_workspace.py +++ b/examples/test_odds_workspace.py @@ -197,6 +197,31 @@ def test_malformed_prices_and_outcome_identity_exclude_whole_market(self): outcomes[1]["name"] = outcomes[0]["name"] self.assertEqual(starter.inspect_sample(data)[0], []) + def test_fractional_quote_clocks_keep_their_source_precision(self): + for clock in ("2026-12-05T14:04:00.1Z", "2026-12-05T14:04:00.12+05:30", + "2026-12-05T14:04:00.123456789-03:30"): + with self.subTest(clock=clock): + data = copy.deepcopy(CAPTURE) + book = data["events"][0]["bookmakers"][1] + market = book["markets"][0] + book["last_update"] = market["last_update"] = clock + rows, _ = starter.inspect_sample(data) + matching = [r for r in rows if r["bookmaker_key"] == book["key"] and r["market_key"] == market["key"]] + self.assertTrue(matching) + for row in matching: + self.assertEqual(row["bookmaker_last_update"], clock) + self.assertEqual(row["market_last_update"], clock) + + def test_invalid_offset_minutes_are_reported(self): + data = copy.deepcopy(CAPTURE) + book = data["events"][0]["bookmakers"][1] + book["last_update"] = "2026-12-05T14:04:00+01:60" + rows, issues = starter.inspect_sample(data) + matching = [r for r in rows if r["bookmaker_key"] == book["key"]] + self.assertTrue(matching) + self.assertTrue(all(row["bookmaker_last_update"] is None for row in matching)) + self.assertIn("invalid_timestamp", [issue["code"] for issue in issues]) + def test_missing_or_invalid_timestamps_are_never_filled(self): data = copy.deepcopy(CAPTURE) event = data["events"][0] diff --git a/parlay_api/__init__.py b/parlay_api/__init__.py index a0fbe1d..edb2dc4 100644 --- a/parlay_api/__init__.py +++ b/parlay_api/__init__.py @@ -28,7 +28,7 @@ """ from __future__ import annotations -__version__ = "0.3.5" +__version__ = "0.3.6" import json import os diff --git a/pyproject.toml b/pyproject.toml index d744814..3615a1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "parlay-api" -version = "0.3.5" +version = "0.3.6" description = "Python SDK for parlay-api.com with a no-key odds demo, CSV starter, and authenticated API client." readme = "README.md" authors = [ diff --git a/tests/test_installed_package.py b/tests/test_installed_package.py index e8137f4..a5250b7 100644 --- a/tests/test_installed_package.py +++ b/tests/test_installed_package.py @@ -28,7 +28,7 @@ def test_imports_are_installed_outside_checkout(self): self.assertNotIn(ROOT, Path(module.__file__).resolve().parents) def test_version_matches_distribution(self): - self.assertEqual(parlay_api.__version__, "0.3.5") + self.assertEqual(parlay_api.__version__, "0.3.6") self.assertEqual(importlib.metadata.version("parlay-api"), parlay_api.__version__) def test_installed_starter_is_exact_standalone_source(self):