Skip to content

JavaScript SDK 0.5.0 · Bounded rate-limit retries

Latest

Choose a tag to compare

@JacobiusMakes JacobiusMakes released this 01 Dec 21:45
8774322

The JavaScript client now supports opt-in rate-limit recovery. Setting maxRetries: 2 allows up to three HTTP attempts per method call, each with its own timeout. The default is one attempt. The client honors a valid Retry-After of up to 30 seconds and surfaces longer pauses to the caller.

Run three local examples to see one successful retry, an exhausted budget and an immediate plan denial. The replay uses invented responses and needs no account.

Install the prebuilt ESM, CommonJS and TypeScript package with npm install https://github.com/JacobiusMakes/parlay-api-js/releases/download/v0.5.0/parlay-api-0.5.0.tgz.

Check your installation

In the same project, run this local calculation with two fictional prices. It works without an API key.

node --input-type=module -e 'import { marketHold } from "parlay-api"; console.log((100 * marketHold([-110, -110])).toFixed(2) + "%")'

Expected output is 4.76%. At −110 on both sides, the two implied probabilities add up to 104.76%. The extra 4.76 percentage points are the overround in that quote.

Open the public odds preview to inspect the events and prices returned for a selected sport before connecting an account.