Skip to main content

onice

Python client and MCP server of the onice.dev API: advanced NHL statistics (Corsi, expected goals, on-ice numbers, lines and pairs, WOWY, goalies, RAPM, GAR and WAR) calculated from public NHL data. These are not official NHL numbers.

pip install onice

Get a free API key on https://onice.dev/developers/. The key is read from the environment variable ONICE_API_KEY, or give it to the client.

import onice

client = onice.Client("YOUR_KEY")

client.find_player("mcdavid")  # NHL ids by name
page = client.skaters(seasons="20252026", sit="5v5", sort="xgf_pct", limit=50)
page.data[0], page.cost, page.remaining  # rows, what the request cost in credits, what is left

rows = client.rows("tables/skaters", seasons="20252026", sit="5v5", sort="xgf_pct", max_rows=3000)
frame = client.skaters(seasons="20252026", limit=100).to_pandas()  # needs pandas

Every endpoint of the API is a method named like its operation (client.tables_lines(...), client.player_profile(player_id=8478402)); client.operations lists them with their parameters, and the documentation is on https://onice.dev/docs/api/. A list is read page after page with client.rows(...) (one answer has at most 1000 rows).

Fantasy hockey

client.fantasy_points(seasons="20262027", g=3, a=2, sog=0.4, limit=50)  # your league's points
client.fantasy_goal_scorers()  # the skaters of today's games with their shooting numbers
client.fantasy_playoff_schedule(start="2027-03-15", weeks=3)  # games and off-nights by team

What it costs

A request costs one credit of your quota for every started 100 rows it returns, times the seasons you ask for (up to 10). Result.cost tells what an answer cost and Result.remaining what is left; onice.estimate_cost(rows, seasons) counts it before you ask. Please credit onice.dev where you show the numbers.

Errors

AuthError (no or wrong key), BadRequestError (a parameter), NotFoundError, RateLimitError (too many requests in a minute: the client waits a short Retry-After by itself) and QuotaError (the quota is used up, or the request could cost more than what is left: ask for fewer rows or seasons). All are OniceError.

For AI assistants (MCP)

pip install "onice[mcp]"

or run it without installing, with uv: uvx onice-mcp. Settings of Claude Desktop, Cursor and others:

{
  "mcpServers": {
    "onice": {
      "command": "uvx",
      "args": ["onice-mcp"],
      "env": { "ONICE_API_KEY": "YOUR_KEY" }
    }
  }
}

The tools: find_player, skater_table, goalie_table, team_table, player_profile, player_percentiles, compare_players, glossary, methodology, data_status, list_endpoints and call_endpoint (any other endpoint). The server runs on your computer and spends the quota of your own key. Without uv: python -m onice.mcp_server.

Licence

The code of this client is MIT. The numbers belong to onice.dev and follow the terms of your plan.

Metadata

Release files for onice 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onice 0.2.0
File Size Uploaded Provenance Actions
onice-0.2.0.tar.gz 25.4 kB Without provenance Details for onice-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for onice 0.2.0
File Interpreter ABI Platform Actions
onice-0.2.0-py3-none-any.whl Python 3 none any Details for onice-0.2.0-py3-none-any.whl

Total release size: 54.0 kB

Release files / onice-0.2.0.tar.gz

Download URL onice-0.2.0.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ba655a73f4ba1aab40f671fdf2d02e517c80bdc5adf36034e9562c91af09476a
BLAKE2b-256 checksum
How to use checksums
b0c97a20a198c6a8ec2064afa9c72725ce446751bbfb4179205854bb515217fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / onice-0.2.0-py3-none-any.whl

Download URL onice-0.2.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2265c5d5541c0b2263bc9b09f0e3e02c859fb2445cafc06ef4f0c5a25e455723
BLAKE2b-256 checksum
How to use checksums
879f537885e7e10d921c1f12e3374c15977fb9aaba2913c54451155e7d7f90c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for onice 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page