npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

altsportsdata

v1.0.0

Published

Production-grade alternative sports data feed — odds, events, futures, settlement for 30 leagues

Readme

AltSportsData SDK (TypeScript)

npm TypeScript Node 18+

Production-grade alternative sports data feed — odds, events, futures, settlement for 30 leagues.

Original model-generated probabilities for sports nobody else can price. Built for prediction markets, DFS platforms, and sportsbooks.

Zero runtime dependencies. Uses native fetch (Node 18+, Bun, Deno).

npm install altsportsdata

Quick Start

import { AltSportsData } from "altsportsdata";

const client = new AltSportsData({ apiKey: "your_key" });

// Discover leagues with data shapes
const leagues = await client.getLeagues();
// → [{ league: "spr", dataShape: "field", archetype: "racing", markets: "..." }, ...]

// Scope to a league
const spr = client.getLeague("spr");
spr.dataShape       // → "field"
spr.archetype        // → "racing"
spr.contractHints    // → { contractTypes: ["outright_winner", ...], ... }

// Get odds
const events = await spr.getEvents({ status: "upcoming" });
const odds = await spr.getMoneylines(events[0].id);

For Prediction Markets (Kalshi, Polymarket)

Fair Probabilities (vig-removed)

const client = new AltSportsData({ apiKey: "key", oddsFormat: "probability" });
const spr = client.getLeague("spr");

// What contracts should I create?
spr.dataShape              // → "field" — many binary contracts per event
spr.contractHints          // → contract types, probability shape, settlement

// Fair probabilities — vig removed, sums to 1.0
const probs = await spr.getFairProbabilities(eventId);
// → [{ athlete: "Eli Tomac", fairProbability: 0.3069, rawOdds: 2.02, margin: 61, outcomeId: "..." }]

const total = probs.reduce((s, p) => s + p.fairProbability, 0);
// → 1.000000

// Create contracts
for (const p of probs) {
  await createContract({
    question: `Will ${p.athlete} win?`,
    probability: p.fairProbability,
    settlementId: p.outcomeId,
  });
}

Fair Matchup Probabilities

const matchups = await spr.getFairMatchupProbabilities(eventId);
// → [{ player1: "Tomac", fairProb1: 0.562, player2: "Lawrence", fairProb2: 0.438, margin: 7.19 }]

Data Shapes — Know What Contracts to Create

| Shape | Leagues | Contract Pattern | |-------|---------|-----------------| | field | F1, Supercross, NHRA... (12) | Many binary: "Will X win?", "Top 3?" | | match | BKFC, MASL, Power Slap... (12) | One binary per matchup: "A beats B?" | | bracket | WSL, SLS, Formula Drift (3) | Layered: heat + event contracts |

Settlement

const result = await client.getSettlement(eventId);
for (const [market, data] of Object.entries(result.markets)) {
  const winners = (data as any).winners ?? [];
  for (const w of winners) {
    console.log(`✅ ${w.athlete} — settled at ${result.settledAt}`);
  }
}

For Sportsbooks (DraftKings, Bet365)

// American odds
const client = new AltSportsData({ apiKey: "key", oddsFormat: "american" });
const odds = await client.getMoneylines(eventId);

// Cross-league market discovery
const allMatchups = await client.getMarkets({ market: "matchup" });
const racingMoneylines = await client.getMarkets({ market: "moneyline", archetype: "racing" });

For DFS (PrizePicks, Underdog)

const matchups = await client.getMatchups(eventId);
const props = await client.getPlayerProps(eventId);
const totals = await client.getPlayerTotals(eventId, "finishingPosition");

Odds Conversion

import { AltSportsData, convertOdds } from "altsportsdata";

// Set once — all responses auto-convert
const client = new AltSportsData({ apiKey: "key", oddsFormat: "probability" });

// Or convert individual values
convertOdds(2.50, "decimal", "american")     // → 150
convertOdds(2.50, "decimal", "probability")  // → 0.4
AltSportsData.convert(150, "american", "decimal") // → 2.5

Batch & Polling

// Batch: fetch odds for many events concurrently
const events = await client.getEvents({ league: "spr", status: "upcoming" });
const ids = events.map(e => e.id!);
const batch = await client.getOddsBatch(ids, "moneyline", 5);

// Live polling — async generator
for await (const update of client.pollOdds(eventId, "moneyline", { interval: 5, maxPolls: 60 })) {
  console.log(update);
}

Enterprise Reliability

const client = new AltSportsData({
  apiKey: "key",
  maxRetries: 3,        // exponential backoff on 429/5xx
  retryBackoff: 0.5,    // base delay in seconds
  timeout: 30_000,      // per-request timeout (ms)
});
  • Automatic exponential backoff with jitter
  • Respects Retry-After headers
  • Request tracing via X-Request-ID
  • Full TypeScript types for all responses

Full API

// Discovery
client.getLeagues({ archetype?, market? })
client.getLeagueInfo(league)
client.listMarketTypes()
spr.describe()

// Events
client.getEvents({ league?, status?, startDate?, endDate?, sort? })
client.getEvent(eventId)
client.getParticipants(eventId)

// Markets (cross-league)
client.getMarkets({ market?, archetype?, status?, limit? })

// Odds
client.getMoneylines(eventId)
client.getMatchups(eventId)
client.getTotals(eventId, subMarket?)
client.getExactas(eventId, n?)
client.getPodiums(eventId)
client.getHeatWinners(eventId)
client.getFastestLap(eventId)
client.getShows(eventId)
client.getOdds(eventId, market, { exactasType?, subMarket? })

// Prediction market
client.getFairProbabilities(eventId, market?)
client.getFairMatchupProbabilities(eventId)
client.getMarketProbabilities(eventId)
client.getTopFinishProbabilities(eventId, topN)

// DFS
client.getPlayerProps(eventId)
client.getPlayerMatchups(eventId)
client.getPlayerTotals(eventId, stat?)

// Batch & polling
client.getOddsBatch(eventIds, market?, maxConcurrent?)
client.pollOdds(eventId, market?, { interval?, maxPolls? })

// Settlement
client.getSettlement(eventId, markets?)

// Futures
client.listFutures()
client.getFutures(tour, type?, league?)

// Parlays
client.calculateParlay(eventId, picks)

// Static
AltSportsData.convert(value, from, to)

Links

License

MIT