@predictorsdk/client 0.13.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Client.d.ts +27 -7
- package/dist/Client.js +50 -8
- package/dist/api/client/requests/GetEventRequest.d.ts +9 -3
- package/dist/api/client/requests/GetMarketRequest.d.ts +9 -3
- package/dist/api/client/requests/GetMarketsRequest.d.ts +10 -0
- package/dist/api/client/requests/GetSportsMatchingMarketsRequest.d.ts +12 -6
- package/dist/api/errors/ConflictError.d.ts +7 -0
- package/dist/api/errors/ConflictError.js +17 -0
- package/dist/api/errors/index.d.ts +1 -0
- package/dist/api/errors/index.js +1 -0
- package/dist/api/types/AmbiguousIdentifierError.d.ts +14 -0
- package/dist/api/types/AmbiguousIdentifierError.js +2 -0
- package/dist/api/types/CanonicalSportsEvent.d.ts +1 -1
- package/dist/api/types/CanonicalSportsSourceMarket.d.ts +5 -1
- package/dist/api/types/CanonicalSportsSourceOutcome.d.ts +7 -1
- package/dist/api/types/EventMarket.d.ts +1 -1
- package/dist/api/types/GetMarketsRequestProvider.d.ts +9 -0
- package/dist/api/types/GetMarketsRequestProvider.js +9 -0
- package/dist/api/types/MarketDetailFeeLeg.d.ts +25 -0
- package/dist/api/types/MarketDetailFeeLeg.js +2 -0
- package/dist/api/types/MarketDetailFeeLegModel.d.ts +18 -0
- package/dist/api/types/MarketDetailFeeLegModel.js +18 -0
- package/dist/api/types/MarketDetailFeeRounding.d.ts +12 -0
- package/dist/api/types/MarketDetailFeeRounding.js +2 -0
- package/dist/api/types/MarketDetailFeeRoundingDirection.d.ts +6 -0
- package/dist/api/types/MarketDetailFeeRoundingDirection.js +6 -0
- package/dist/api/types/MarketDetailOutcome.d.ts +7 -1
- package/dist/api/types/MarketDetailPricing.d.ts +49 -3
- package/dist/api/types/MarketDetailPricingAsOfKind.d.ts +18 -0
- package/dist/api/types/MarketDetailPricingAsOfKind.js +18 -0
- package/dist/api/types/MarketDetailPricingAvailability.d.ts +14 -1
- package/dist/api/types/MarketDetailPricingAvailability.js +14 -1
- package/dist/api/types/MarketDetailPricingSource.d.ts +1 -1
- package/dist/api/types/MarketDetailPricingSource.js +1 -1
- package/dist/api/types/MarketDetailResponse.d.ts +2 -1
- package/dist/api/types/MarketDetailScheduledFeeChange.d.ts +12 -0
- package/dist/api/types/MarketDetailScheduledFeeChange.js +2 -0
- package/dist/api/types/MarketDetailTradingFees.d.ts +40 -0
- package/dist/api/types/MarketDetailTradingFees.js +2 -0
- package/dist/api/types/MarketDetailTradingFeesAvailability.d.ts +9 -0
- package/dist/api/types/MarketDetailTradingFeesAvailability.js +9 -0
- package/dist/api/types/MarketDetailTradingFeesChargeBasis.d.ts +10 -0
- package/dist/api/types/MarketDetailTradingFeesChargeBasis.js +10 -0
- package/dist/api/types/MarketDetailTradingFeesSource.d.ts +7 -0
- package/dist/api/types/MarketDetailTradingFeesSource.js +7 -0
- package/dist/api/types/MarketsListResponse.d.ts +2 -0
- package/dist/api/types/MarketsSnapshot.d.ts +17 -0
- package/dist/api/types/MarketsSnapshot.js +2 -0
- package/dist/api/types/PlatformMarket.d.ts +1 -1
- package/dist/api/types/UnifiedMarket.d.ts +1 -1
- package/dist/api/types/index.d.ts +13 -0
- package/dist/api/types/index.js +13 -0
- package/dist/serialization/types/AmbiguousIdentifierError.d.ts +12 -0
- package/dist/serialization/types/AmbiguousIdentifierError.js +8 -0
- package/dist/serialization/types/GetMarketsRequestProvider.d.ts +7 -0
- package/dist/serialization/types/GetMarketsRequestProvider.js +3 -0
- package/dist/serialization/types/MarketDetailFeeLeg.d.ts +14 -0
- package/dist/serialization/types/MarketDetailFeeLeg.js +10 -0
- package/dist/serialization/types/MarketDetailFeeLegModel.d.ts +7 -0
- package/dist/serialization/types/MarketDetailFeeLegModel.js +3 -0
- package/dist/serialization/types/MarketDetailFeeRounding.d.ts +11 -0
- package/dist/serialization/types/MarketDetailFeeRounding.js +7 -0
- package/dist/serialization/types/MarketDetailFeeRoundingDirection.d.ts +7 -0
- package/dist/serialization/types/MarketDetailFeeRoundingDirection.js +3 -0
- package/dist/serialization/types/MarketDetailPricing.d.ts +3 -0
- package/dist/serialization/types/MarketDetailPricing.js +3 -0
- package/dist/serialization/types/MarketDetailPricingAsOfKind.d.ts +7 -0
- package/dist/serialization/types/MarketDetailPricingAsOfKind.js +3 -0
- package/dist/serialization/types/MarketDetailPricingAvailability.d.ts +1 -1
- package/dist/serialization/types/MarketDetailPricingAvailability.js +1 -1
- package/dist/serialization/types/MarketDetailResponse.d.ts +2 -0
- package/dist/serialization/types/MarketDetailResponse.js +2 -0
- package/dist/serialization/types/MarketDetailScheduledFeeChange.d.ts +12 -0
- package/dist/serialization/types/MarketDetailScheduledFeeChange.js +8 -0
- package/dist/serialization/types/MarketDetailTradingFees.d.ts +20 -0
- package/dist/serialization/types/MarketDetailTradingFees.js +16 -0
- package/dist/serialization/types/MarketDetailTradingFeesAvailability.d.ts +7 -0
- package/dist/serialization/types/MarketDetailTradingFeesAvailability.js +3 -0
- package/dist/serialization/types/MarketDetailTradingFeesChargeBasis.d.ts +7 -0
- package/dist/serialization/types/MarketDetailTradingFeesChargeBasis.js +3 -0
- package/dist/serialization/types/MarketDetailTradingFeesSource.d.ts +7 -0
- package/dist/serialization/types/MarketDetailTradingFeesSource.js +3 -0
- package/dist/serialization/types/MarketsListResponse.d.ts +2 -0
- package/dist/serialization/types/MarketsListResponse.js +2 -0
- package/dist/serialization/types/MarketsSnapshot.d.ts +9 -0
- package/dist/serialization/types/MarketsSnapshot.js +5 -0
- package/dist/serialization/types/index.d.ts +13 -0
- package/dist/serialization/types/index.js +13 -0
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare class PredictorSDKClient {
|
|
|
25
25
|
getPlans(requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.PlansResponse>;
|
|
26
26
|
private __getPlans;
|
|
27
27
|
/**
|
|
28
|
-
* Find cross-platform market matches for sports events. Coverage is NBA, WNBA, NHL, and MLB; `canonical_events[].league` names the league and is the first segment of the canonical `event_id`. When called without parameters, returns all currently matched sports markets with cursor-based pagination (default `limit=25`, max `100`)
|
|
28
|
+
* Find cross-platform market matches for sports events. Coverage is NBA, WNBA, NHL, and MLB; `canonical_events[].league` names the league and is the first segment of the canonical `event_id`. When called without parameters, returns all currently matched sports markets with cursor-based pagination (default `limit=25`, max `100`) — games whose date has passed are excluded unless you ask for them with `include_settled=true`. Provide a canonical event key, Kalshi event ticker, Polymarket slug, Predict market ID, or SX Bet market ID to look up a specific event — lookups return the full match immediately and skip pagination. Every platform row includes its provider-native `event_id` for use with `GET /v1/events/{event_id}`; pass that row's `platform` value as the events endpoint's `platform` query parameter, which is required to disambiguate Predict and AlphaArcade identifiers.
|
|
29
29
|
*
|
|
30
30
|
* @param {PredictorSDK.GetSportsMatchingMarketsRequest} request
|
|
31
31
|
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -48,6 +48,10 @@ export declare class PredictorSDKClient {
|
|
|
48
48
|
/**
|
|
49
49
|
* Returns a paginated list of unified markets from all supported prediction market providers. Uses cursor-based pagination with default `limit=25`, max `100`.
|
|
50
50
|
*
|
|
51
|
+
* Providers are walked in a fixed sequence, so without a filter the first pages are all Kalshi. Narrow the traversal with `provider` and/or `category`; both are membership filters on the same immutable catalog snapshot, both compose, and `pagination.total` always counts the filtered set rather than the whole catalog.
|
|
52
|
+
*
|
|
53
|
+
* This endpoint reads a stored snapshot rather than calling the venues, so the rows are as old as the last ingestion crawl, not as old as the request. `snapshot.observed_at` reports that age and is stable across a cursor traversal.
|
|
54
|
+
*
|
|
51
55
|
* @param {PredictorSDK.GetMarketsRequest} request
|
|
52
56
|
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
57
|
*
|
|
@@ -86,11 +90,21 @@ export declare class PredictorSDKClient {
|
|
|
86
90
|
getCategories(requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.CategoriesResponse>;
|
|
87
91
|
private __getCategories;
|
|
88
92
|
/**
|
|
89
|
-
* Returns a single market across the six supported platforms (Kalshi, Polymarket, Predict, SX Bet, Hyperliquid, AlphaArcade). The `market_id` is either the composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `kalshi:KXNBA-
|
|
93
|
+
* Returns a single market across the six supported platforms (Kalshi, Polymarket, Predict, SX Bet, Hyperliquid, AlphaArcade). The `market_id` is either the composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `kalshi:KXNBA-27-SAS`) or the platform-native identifier. Composite IDs dispatch unambiguously by prefix. Native IDs are routed by format inference: Kalshi tickers match the all-caps-with-hyphens shape (`KX…-…`); SX Bet hashes match `0x` + 64 hex characters.
|
|
94
|
+
*
|
|
95
|
+
* **A bare numeric id or kebab-case slug does not name its platform.** Polymarket and Predict share both shapes, so when `?platform=` is omitted the service probes every candidate and answers only if exactly one of them holds that identifier. If two do, the identifier names two different real markets and the request fails with `409` listing both — it does not pick one. Retry with `?platform=` or the composite form. Hyperliquid integer outcome ids collide with Polymarket/Predict numeric ids and are deliberately not inferred — route them via the composite form (`hyperliquid:<id>`) or `?platform=hyperliquid` (alias `hl`). AlphaArcade market ids are ULIDs (26-char Crockford base32, e.g. `01K0HQE3CEM2T2RDRWSCJ3V647`); like Hyperliquid they are not inferred in v1 — route them via the composite form (`alpha-arcade:<ulid>`) or `?platform=alpha-arcade` (alias `aa`).
|
|
96
|
+
*
|
|
97
|
+
* **If you already know the platform, always say so.** Every listing that hands you an identifier also hands you its platform, so the composite form — which `GET /v1/markets` returns natively in `data[].id` — or `?platform={row.platform}` costs nothing, skips the probe, and cannot 409. It is also strictly more available: the probe has to reach both candidates to prove there is no collision, so it fails when either is having an outage, while a named platform only depends on that one.
|
|
90
98
|
*
|
|
91
99
|
* Identity fields (id/provider/provider_id/title/status/ outcomes[].name) are strict-universal: every platform's single-market endpoint exposes them natively without a second fetch. close timestamps and parent event ids remain omitted (not nullable) — Predict's close time lives on the parent category and Polymarket's market record carries no event id.
|
|
92
100
|
*
|
|
93
|
-
*
|
|
101
|
+
* **What the pricing tier is for, and what it is not.** It reports the top of each venue's book, once, at the moment of your request. That is enough to see where a market is quoted, to compare venues, and to decide where to go and look harder. It is NOT an execution feed: there is no depth beyond the best level, no streaming, no per-outcome book on the platforms that publish only a market-wide mark, and nothing here is reserved for you — by the time you act, the level may be gone. Two limits are worth knowing before you write a strategy against it. First, `price` is a derived display number and a non-null `price` does not imply a tradeable one; read `pricing.availability` and prefer `bid`/`ask` for anything you intend to act on. Second, quote freshness is a property of the venue, not of this API — see *Bounding quote freshness* below. Route the actual order through the venue's own book.
|
|
102
|
+
*
|
|
103
|
+
* The pricing tier adds per-outcome quotes (`price`/`bid`/`ask`/ `last` as 0–1 probability numbers — price IS the implied probability), a `pricing` envelope (`availability`/`scale`/ `source`/`as_of`/`as_of_kind`/`observed_at`/`neg_risk`), and market-level aggregates (`liquidity_usd`, `volume_24h_usd`, `volume_total_usd`, plus Kalshi contract-count mirrors and `open_interest`). Kalshi/ Polymarket/Predict quotes come from the same record the identity fetch returns (`pricing.source=market_record`). SX Bet, Hyperliquid, and AlphaArcade carry no pricing on the market record, so the server makes one bounded second fetch to the order book (`pricing.source=orderbook`) — SX Bet's best-odds endpoint, Hyperliquid's merged `l2Book`, or AlphaArcade's `get-full-orderbook` (a 4-sided YES/NO book; the second side's quotes are derived from the first by the cross-side complement, and the catalog midpoint serves as the price mark when the book is empty — reported as `pricing.availability=indicative`, since a mark that outlives its book is not a quote). On a book error the lookup still succeeds with identity intact and `pricing.availability` reflecting the marks. On timeout/error it degrades to `pricing.availability=unavailable` with identity intact — pricing failures never fail the lookup. Predict publishes a per-market `spreadThreshold` — the widest bid/ask spread it counts as liquidity — and this route honours it, so a Predict book outside its own market's threshold reports `indicative` rather than lending its midpoint the authority of `live`. Aggregates a platform doesn't natively expose are explicit `null` (e.g. Kalshi reports volume in contracts, so `volume_*_usd` stays null rather than fabricating a USD figure; its upstream `liquidity_dollars` field is deprecated and always zero, so `liquidity_usd` is null too).
|
|
104
|
+
*
|
|
105
|
+
* **Bounding quote freshness.** `pricing.as_of` is the provider's own timestamp and does not mean the same thing on every platform — on Hyperliquid it moves with the order book, while on Kalshi it is a record write measured anywhere from 15 hours to 137 days old on markets reporting `status: open` with a live two-sided book. `pricing.as_of_kind` names which one you received (`quote` / `record_refresh` / `record_static` / `unknown`), so read it before applying an age bound to `as_of`; only `quote` tracks the quote closely enough to bound at all. `pricing.observed_at` is when this server read the quotes, means the same thing on every provider, and is therefore the field to bound when you need one threshold that behaves identically across platforms. It bounds the age of the read, not of the quote: this route reads the venue live per request and caches nothing, so on a `record_static` provider a fresh `observed_at` beside a day-old `as_of` is the honest description of what the venue served, and the executable price should come from that venue's own book.
|
|
106
|
+
*
|
|
107
|
+
* The `trading_fees` tier reports what the VENUE charges to trade this market — its own published fee parameters, normalized to one shape across all six platforms, so cross-venue cost comparison stops requiring six private formulas. Nothing here relates to PredictorSDK's subscription pricing. It is always present, and `trading_fees.availability` distinguishes published parameters from per-account rates that need your own venue credentials (SX Bet, Hyperliquid), from a venue that publishes nothing, and from a fee of genuinely zero. Only Kalshi costs extra upstream hops for it (its parameters live on the parent series plus any scheduled per-event override, all TTL-cached and bounded); those degrade to `availability: "unavailable"` rather than failing the lookup, exactly like the pricing tier. See the `MarketDetailTradingFees` schema for the formulas and for what is deliberately out of scope.
|
|
94
108
|
*
|
|
95
109
|
* @param {PredictorSDK.GetMarketRequest} request
|
|
96
110
|
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -100,6 +114,7 @@ export declare class PredictorSDKClient {
|
|
|
100
114
|
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
101
115
|
* @throws {@link PredictorSDK.ForbiddenError}
|
|
102
116
|
* @throws {@link PredictorSDK.NotFoundError}
|
|
117
|
+
* @throws {@link PredictorSDK.ConflictError}
|
|
103
118
|
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
104
119
|
* @throws {@link PredictorSDK.BadGatewayError}
|
|
105
120
|
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
@@ -108,7 +123,7 @@ export declare class PredictorSDKClient {
|
|
|
108
123
|
*
|
|
109
124
|
* @example
|
|
110
125
|
* await client.getMarket({
|
|
111
|
-
* marketId: "kalshi:KXNBA-
|
|
126
|
+
* marketId: "kalshi:KXNBA-27-SAS"
|
|
112
127
|
* })
|
|
113
128
|
*/
|
|
114
129
|
getMarket(request: PredictorSDK.GetMarketRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.MarketDetailResponse>;
|
|
@@ -195,11 +210,15 @@ export declare class PredictorSDKClient {
|
|
|
195
210
|
listPolymarketWalletPositions(request?: PredictorSDK.ListPolymarketWalletPositionsRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.PolymarketPositionsResponse>;
|
|
196
211
|
private __listPolymarketWalletPositions;
|
|
197
212
|
/**
|
|
198
|
-
* Returns a single event and the markets nested under it on the identified platform. The `event_id` is the platform's native identifier — a Kalshi `event_ticker`, a Polymarket event slug, an SX Bet `eventId`, a Predict market identifier, a Hyperliquid question/outcome integer id, or an AlphaArcade market ULID. The `platform` is inferred from the ID format when unambiguous (`KX…` → Kalshi, `L\d+` → SX Bet).
|
|
213
|
+
* Returns a single event and the markets nested under it on the identified platform. The `event_id` is the platform's native identifier — a Kalshi `event_ticker`, a Polymarket event slug, an SX Bet `eventId`, a Predict market identifier, a Hyperliquid question/outcome integer id, or an AlphaArcade market ULID. The `platform` is inferred from the ID format when unambiguous (`KX…` → Kalshi, `L\d+` → SX Bet). The composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `predict:1607914`) also dispatches unambiguously by prefix.
|
|
214
|
+
*
|
|
215
|
+
* **A bare numeric id or kebab-case slug does not name its platform.** Polymarket and Predict share both shapes, so when `?platform=` is omitted the service probes every candidate and answers only if exactly one of them holds that identifier. If two do, the identifier names two different real events and the request fails with `409` listing both — it does not pick one. Retry with `?platform=` or the composite form. Hyperliquid integer ids also collide with those numerics and require `?platform=hyperliquid` (alias `hl`). AlphaArcade ULIDs are not inferred in v1 either — require `?platform=alpha-arcade` (alias `aa`). An AlphaArcade multi-choice market resolves to an event whose nested markets are its options; a binary market (or a single option id) resolves to a single-market event.
|
|
216
|
+
*
|
|
217
|
+
* **If you already know the platform, always say so.** Every listing that hands you an identifier also hands you its platform, so `?platform={row.platform}` (or the composite form) costs nothing, skips the probe, and cannot 409. It is also strictly more available: the probe has to reach both candidates to prove there is no collision, so it fails when either is having an outage, while a named platform only depends on that one.
|
|
199
218
|
*
|
|
200
219
|
* Response is minimal in v0: each market is returned with its platform-native `market_id` and a human-readable `title`. Pricing, volume, status, and timestamps are intentionally deferred — they'll be added as additive fields to `EventMarket` in a later release. The endpoint mirrors the `/v1/markets` rollout pattern (titles first, fields later).
|
|
201
220
|
*
|
|
202
|
-
* **Kalshi sibling fanout.** A single Kalshi sports game lives across multiple event tickers that share a game suffix — e.g. `KXMLBGAME-
|
|
221
|
+
* **Kalshi sibling fanout.** A single Kalshi sports game lives across multiple event tickers that share a game suffix — e.g. `KXMLBGAME-26AUG272145AZSF` holds the moneyline, `KXMLBF5TOTAL-26AUG272145AZSF` holds the first-five-innings totals, and so on. When the supplied event_ticker belongs to a sport in the sibling registry (MLB, NBA, NFL, NHL, WNBA today), this endpoint fans out across known sibling series in parallel and merges their markets into one response. Siblings that don't exist for a particular game silently drop. Siblings that error are reported under `fanout.siblings_missing`; the primary event still returns 200 in that case. Only the primary fetch failing produces a 4xx/5xx — partial fanouts never fail the request.
|
|
203
222
|
*
|
|
204
223
|
* **Polymarket** events already nest the moneyline plus all spread/totals/game-level prop markets under a single event slug, so no fanout is performed. **SX Bet** fixtures similarly bundle game lines per `eventId`. **Predict** currently treats `event_id` as a market identifier and wraps the single market as a 1-element event response, since the upstream `event` concept on Predict is closer to a category than to a multi-market container. **Hyperliquid** maps a question id to its named outcome markets, or wraps a standalone outcome id as a single-market event.
|
|
205
224
|
*
|
|
@@ -211,6 +230,7 @@ export declare class PredictorSDKClient {
|
|
|
211
230
|
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
212
231
|
* @throws {@link PredictorSDK.ForbiddenError}
|
|
213
232
|
* @throws {@link PredictorSDK.NotFoundError}
|
|
233
|
+
* @throws {@link PredictorSDK.ConflictError}
|
|
214
234
|
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
215
235
|
* @throws {@link PredictorSDK.BadGatewayError}
|
|
216
236
|
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
@@ -219,7 +239,7 @@ export declare class PredictorSDKClient {
|
|
|
219
239
|
*
|
|
220
240
|
* @example
|
|
221
241
|
* await client.getEvent({
|
|
222
|
-
* eventId: "
|
|
242
|
+
* eventId: "KXNBAGAME-26OCT20OKCSAS"
|
|
223
243
|
* })
|
|
224
244
|
*/
|
|
225
245
|
getEvent(request: PredictorSDK.GetEventRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.EventResponse>;
|
package/dist/Client.js
CHANGED
|
@@ -75,7 +75,7 @@ export class PredictorSDKClient {
|
|
|
75
75
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/plans");
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* Find cross-platform market matches for sports events. Coverage is NBA, WNBA, NHL, and MLB; `canonical_events[].league` names the league and is the first segment of the canonical `event_id`. When called without parameters, returns all currently matched sports markets with cursor-based pagination (default `limit=25`, max `100`)
|
|
78
|
+
* Find cross-platform market matches for sports events. Coverage is NBA, WNBA, NHL, and MLB; `canonical_events[].league` names the league and is the first segment of the canonical `event_id`. When called without parameters, returns all currently matched sports markets with cursor-based pagination (default `limit=25`, max `100`) — games whose date has passed are excluded unless you ask for them with `include_settled=true`. Provide a canonical event key, Kalshi event ticker, Polymarket slug, Predict market ID, or SX Bet market ID to look up a specific event — lookups return the full match immediately and skip pagination. Every platform row includes its provider-native `event_id` for use with `GET /v1/events/{event_id}`; pass that row's `platform` value as the events endpoint's `platform` query parameter, which is required to disambiguate Predict and AlphaArcade identifiers.
|
|
79
79
|
*
|
|
80
80
|
* @param {PredictorSDK.GetSportsMatchingMarketsRequest} request
|
|
81
81
|
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -211,6 +211,10 @@ export class PredictorSDKClient {
|
|
|
211
211
|
/**
|
|
212
212
|
* Returns a paginated list of unified markets from all supported prediction market providers. Uses cursor-based pagination with default `limit=25`, max `100`.
|
|
213
213
|
*
|
|
214
|
+
* Providers are walked in a fixed sequence, so without a filter the first pages are all Kalshi. Narrow the traversal with `provider` and/or `category`; both are membership filters on the same immutable catalog snapshot, both compose, and `pagination.total` always counts the filtered set rather than the whole catalog.
|
|
215
|
+
*
|
|
216
|
+
* This endpoint reads a stored snapshot rather than calling the venues, so the rows are as old as the last ingestion crawl, not as old as the request. `snapshot.observed_at` reports that age and is stable across a cursor traversal.
|
|
217
|
+
*
|
|
214
218
|
* @param {PredictorSDK.GetMarketsRequest} request
|
|
215
219
|
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
216
220
|
*
|
|
@@ -231,7 +235,7 @@ export class PredictorSDKClient {
|
|
|
231
235
|
return core.HttpResponsePromise.fromPromise(this.__getMarkets(request, requestOptions));
|
|
232
236
|
}
|
|
233
237
|
async __getMarkets(request = {}, requestOptions) {
|
|
234
|
-
const { limit, cursor, category } = request;
|
|
238
|
+
const { limit, cursor, category, provider } = request;
|
|
235
239
|
const _queryParams = {
|
|
236
240
|
limit,
|
|
237
241
|
cursor,
|
|
@@ -241,6 +245,12 @@ export class PredictorSDKClient {
|
|
|
241
245
|
omitUndefined: true,
|
|
242
246
|
})
|
|
243
247
|
: undefined,
|
|
248
|
+
provider: provider != null
|
|
249
|
+
? serializers.GetMarketsRequestProvider.jsonOrThrow(provider, {
|
|
250
|
+
unrecognizedObjectKeys: "strip",
|
|
251
|
+
omitUndefined: true,
|
|
252
|
+
})
|
|
253
|
+
: undefined,
|
|
244
254
|
};
|
|
245
255
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
246
256
|
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
@@ -450,11 +460,21 @@ export class PredictorSDKClient {
|
|
|
450
460
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/categories");
|
|
451
461
|
}
|
|
452
462
|
/**
|
|
453
|
-
* Returns a single market across the six supported platforms (Kalshi, Polymarket, Predict, SX Bet, Hyperliquid, AlphaArcade). The `market_id` is either the composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `kalshi:KXNBA-
|
|
463
|
+
* Returns a single market across the six supported platforms (Kalshi, Polymarket, Predict, SX Bet, Hyperliquid, AlphaArcade). The `market_id` is either the composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `kalshi:KXNBA-27-SAS`) or the platform-native identifier. Composite IDs dispatch unambiguously by prefix. Native IDs are routed by format inference: Kalshi tickers match the all-caps-with-hyphens shape (`KX…-…`); SX Bet hashes match `0x` + 64 hex characters.
|
|
464
|
+
*
|
|
465
|
+
* **A bare numeric id or kebab-case slug does not name its platform.** Polymarket and Predict share both shapes, so when `?platform=` is omitted the service probes every candidate and answers only if exactly one of them holds that identifier. If two do, the identifier names two different real markets and the request fails with `409` listing both — it does not pick one. Retry with `?platform=` or the composite form. Hyperliquid integer outcome ids collide with Polymarket/Predict numeric ids and are deliberately not inferred — route them via the composite form (`hyperliquid:<id>`) or `?platform=hyperliquid` (alias `hl`). AlphaArcade market ids are ULIDs (26-char Crockford base32, e.g. `01K0HQE3CEM2T2RDRWSCJ3V647`); like Hyperliquid they are not inferred in v1 — route them via the composite form (`alpha-arcade:<ulid>`) or `?platform=alpha-arcade` (alias `aa`).
|
|
466
|
+
*
|
|
467
|
+
* **If you already know the platform, always say so.** Every listing that hands you an identifier also hands you its platform, so the composite form — which `GET /v1/markets` returns natively in `data[].id` — or `?platform={row.platform}` costs nothing, skips the probe, and cannot 409. It is also strictly more available: the probe has to reach both candidates to prove there is no collision, so it fails when either is having an outage, while a named platform only depends on that one.
|
|
454
468
|
*
|
|
455
469
|
* Identity fields (id/provider/provider_id/title/status/ outcomes[].name) are strict-universal: every platform's single-market endpoint exposes them natively without a second fetch. close timestamps and parent event ids remain omitted (not nullable) — Predict's close time lives on the parent category and Polymarket's market record carries no event id.
|
|
456
470
|
*
|
|
457
|
-
*
|
|
471
|
+
* **What the pricing tier is for, and what it is not.** It reports the top of each venue's book, once, at the moment of your request. That is enough to see where a market is quoted, to compare venues, and to decide where to go and look harder. It is NOT an execution feed: there is no depth beyond the best level, no streaming, no per-outcome book on the platforms that publish only a market-wide mark, and nothing here is reserved for you — by the time you act, the level may be gone. Two limits are worth knowing before you write a strategy against it. First, `price` is a derived display number and a non-null `price` does not imply a tradeable one; read `pricing.availability` and prefer `bid`/`ask` for anything you intend to act on. Second, quote freshness is a property of the venue, not of this API — see *Bounding quote freshness* below. Route the actual order through the venue's own book.
|
|
472
|
+
*
|
|
473
|
+
* The pricing tier adds per-outcome quotes (`price`/`bid`/`ask`/ `last` as 0–1 probability numbers — price IS the implied probability), a `pricing` envelope (`availability`/`scale`/ `source`/`as_of`/`as_of_kind`/`observed_at`/`neg_risk`), and market-level aggregates (`liquidity_usd`, `volume_24h_usd`, `volume_total_usd`, plus Kalshi contract-count mirrors and `open_interest`). Kalshi/ Polymarket/Predict quotes come from the same record the identity fetch returns (`pricing.source=market_record`). SX Bet, Hyperliquid, and AlphaArcade carry no pricing on the market record, so the server makes one bounded second fetch to the order book (`pricing.source=orderbook`) — SX Bet's best-odds endpoint, Hyperliquid's merged `l2Book`, or AlphaArcade's `get-full-orderbook` (a 4-sided YES/NO book; the second side's quotes are derived from the first by the cross-side complement, and the catalog midpoint serves as the price mark when the book is empty — reported as `pricing.availability=indicative`, since a mark that outlives its book is not a quote). On a book error the lookup still succeeds with identity intact and `pricing.availability` reflecting the marks. On timeout/error it degrades to `pricing.availability=unavailable` with identity intact — pricing failures never fail the lookup. Predict publishes a per-market `spreadThreshold` — the widest bid/ask spread it counts as liquidity — and this route honours it, so a Predict book outside its own market's threshold reports `indicative` rather than lending its midpoint the authority of `live`. Aggregates a platform doesn't natively expose are explicit `null` (e.g. Kalshi reports volume in contracts, so `volume_*_usd` stays null rather than fabricating a USD figure; its upstream `liquidity_dollars` field is deprecated and always zero, so `liquidity_usd` is null too).
|
|
474
|
+
*
|
|
475
|
+
* **Bounding quote freshness.** `pricing.as_of` is the provider's own timestamp and does not mean the same thing on every platform — on Hyperliquid it moves with the order book, while on Kalshi it is a record write measured anywhere from 15 hours to 137 days old on markets reporting `status: open` with a live two-sided book. `pricing.as_of_kind` names which one you received (`quote` / `record_refresh` / `record_static` / `unknown`), so read it before applying an age bound to `as_of`; only `quote` tracks the quote closely enough to bound at all. `pricing.observed_at` is when this server read the quotes, means the same thing on every provider, and is therefore the field to bound when you need one threshold that behaves identically across platforms. It bounds the age of the read, not of the quote: this route reads the venue live per request and caches nothing, so on a `record_static` provider a fresh `observed_at` beside a day-old `as_of` is the honest description of what the venue served, and the executable price should come from that venue's own book.
|
|
476
|
+
*
|
|
477
|
+
* The `trading_fees` tier reports what the VENUE charges to trade this market — its own published fee parameters, normalized to one shape across all six platforms, so cross-venue cost comparison stops requiring six private formulas. Nothing here relates to PredictorSDK's subscription pricing. It is always present, and `trading_fees.availability` distinguishes published parameters from per-account rates that need your own venue credentials (SX Bet, Hyperliquid), from a venue that publishes nothing, and from a fee of genuinely zero. Only Kalshi costs extra upstream hops for it (its parameters live on the parent series plus any scheduled per-event override, all TTL-cached and bounded); those degrade to `availability: "unavailable"` rather than failing the lookup, exactly like the pricing tier. See the `MarketDetailTradingFees` schema for the formulas and for what is deliberately out of scope.
|
|
458
478
|
*
|
|
459
479
|
* @param {PredictorSDK.GetMarketRequest} request
|
|
460
480
|
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -464,6 +484,7 @@ export class PredictorSDKClient {
|
|
|
464
484
|
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
465
485
|
* @throws {@link PredictorSDK.ForbiddenError}
|
|
466
486
|
* @throws {@link PredictorSDK.NotFoundError}
|
|
487
|
+
* @throws {@link PredictorSDK.ConflictError}
|
|
467
488
|
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
468
489
|
* @throws {@link PredictorSDK.BadGatewayError}
|
|
469
490
|
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
@@ -472,7 +493,7 @@ export class PredictorSDKClient {
|
|
|
472
493
|
*
|
|
473
494
|
* @example
|
|
474
495
|
* await client.getMarket({
|
|
475
|
-
* marketId: "kalshi:KXNBA-
|
|
496
|
+
* marketId: "kalshi:KXNBA-27-SAS"
|
|
476
497
|
* })
|
|
477
498
|
*/
|
|
478
499
|
getMarket(request, requestOptions) {
|
|
@@ -561,6 +582,14 @@ export class PredictorSDKClient {
|
|
|
561
582
|
skipValidation: true,
|
|
562
583
|
breadcrumbsPrefix: ["response"],
|
|
563
584
|
}), _response.rawResponse);
|
|
585
|
+
case 409:
|
|
586
|
+
throw new PredictorSDK.ConflictError(serializers.AmbiguousIdentifierError.parseOrThrow(_response.error.body, {
|
|
587
|
+
unrecognizedObjectKeys: "passthrough",
|
|
588
|
+
allowUnrecognizedUnionMembers: true,
|
|
589
|
+
allowUnrecognizedEnumValues: true,
|
|
590
|
+
skipValidation: true,
|
|
591
|
+
breadcrumbsPrefix: ["response"],
|
|
592
|
+
}), _response.rawResponse);
|
|
564
593
|
case 429:
|
|
565
594
|
throw new PredictorSDK.TooManyRequestsError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
566
595
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -1016,11 +1045,15 @@ export class PredictorSDKClient {
|
|
|
1016
1045
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/polymarket/wallet/positions");
|
|
1017
1046
|
}
|
|
1018
1047
|
/**
|
|
1019
|
-
* Returns a single event and the markets nested under it on the identified platform. The `event_id` is the platform's native identifier — a Kalshi `event_ticker`, a Polymarket event slug, an SX Bet `eventId`, a Predict market identifier, a Hyperliquid question/outcome integer id, or an AlphaArcade market ULID. The `platform` is inferred from the ID format when unambiguous (`KX…` → Kalshi, `L\d+` → SX Bet).
|
|
1048
|
+
* Returns a single event and the markets nested under it on the identified platform. The `event_id` is the platform's native identifier — a Kalshi `event_ticker`, a Polymarket event slug, an SX Bet `eventId`, a Predict market identifier, a Hyperliquid question/outcome integer id, or an AlphaArcade market ULID. The `platform` is inferred from the ID format when unambiguous (`KX…` → Kalshi, `L\d+` → SX Bet). The composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `predict:1607914`) also dispatches unambiguously by prefix.
|
|
1049
|
+
*
|
|
1050
|
+
* **A bare numeric id or kebab-case slug does not name its platform.** Polymarket and Predict share both shapes, so when `?platform=` is omitted the service probes every candidate and answers only if exactly one of them holds that identifier. If two do, the identifier names two different real events and the request fails with `409` listing both — it does not pick one. Retry with `?platform=` or the composite form. Hyperliquid integer ids also collide with those numerics and require `?platform=hyperliquid` (alias `hl`). AlphaArcade ULIDs are not inferred in v1 either — require `?platform=alpha-arcade` (alias `aa`). An AlphaArcade multi-choice market resolves to an event whose nested markets are its options; a binary market (or a single option id) resolves to a single-market event.
|
|
1051
|
+
*
|
|
1052
|
+
* **If you already know the platform, always say so.** Every listing that hands you an identifier also hands you its platform, so `?platform={row.platform}` (or the composite form) costs nothing, skips the probe, and cannot 409. It is also strictly more available: the probe has to reach both candidates to prove there is no collision, so it fails when either is having an outage, while a named platform only depends on that one.
|
|
1020
1053
|
*
|
|
1021
1054
|
* Response is minimal in v0: each market is returned with its platform-native `market_id` and a human-readable `title`. Pricing, volume, status, and timestamps are intentionally deferred — they'll be added as additive fields to `EventMarket` in a later release. The endpoint mirrors the `/v1/markets` rollout pattern (titles first, fields later).
|
|
1022
1055
|
*
|
|
1023
|
-
* **Kalshi sibling fanout.** A single Kalshi sports game lives across multiple event tickers that share a game suffix — e.g. `KXMLBGAME-
|
|
1056
|
+
* **Kalshi sibling fanout.** A single Kalshi sports game lives across multiple event tickers that share a game suffix — e.g. `KXMLBGAME-26AUG272145AZSF` holds the moneyline, `KXMLBF5TOTAL-26AUG272145AZSF` holds the first-five-innings totals, and so on. When the supplied event_ticker belongs to a sport in the sibling registry (MLB, NBA, NFL, NHL, WNBA today), this endpoint fans out across known sibling series in parallel and merges their markets into one response. Siblings that don't exist for a particular game silently drop. Siblings that error are reported under `fanout.siblings_missing`; the primary event still returns 200 in that case. Only the primary fetch failing produces a 4xx/5xx — partial fanouts never fail the request.
|
|
1024
1057
|
*
|
|
1025
1058
|
* **Polymarket** events already nest the moneyline plus all spread/totals/game-level prop markets under a single event slug, so no fanout is performed. **SX Bet** fixtures similarly bundle game lines per `eventId`. **Predict** currently treats `event_id` as a market identifier and wraps the single market as a 1-element event response, since the upstream `event` concept on Predict is closer to a category than to a multi-market container. **Hyperliquid** maps a question id to its named outcome markets, or wraps a standalone outcome id as a single-market event.
|
|
1026
1059
|
*
|
|
@@ -1032,6 +1065,7 @@ export class PredictorSDKClient {
|
|
|
1032
1065
|
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
1033
1066
|
* @throws {@link PredictorSDK.ForbiddenError}
|
|
1034
1067
|
* @throws {@link PredictorSDK.NotFoundError}
|
|
1068
|
+
* @throws {@link PredictorSDK.ConflictError}
|
|
1035
1069
|
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
1036
1070
|
* @throws {@link PredictorSDK.BadGatewayError}
|
|
1037
1071
|
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
@@ -1040,7 +1074,7 @@ export class PredictorSDKClient {
|
|
|
1040
1074
|
*
|
|
1041
1075
|
* @example
|
|
1042
1076
|
* await client.getEvent({
|
|
1043
|
-
* eventId: "
|
|
1077
|
+
* eventId: "KXNBAGAME-26OCT20OKCSAS"
|
|
1044
1078
|
* })
|
|
1045
1079
|
*/
|
|
1046
1080
|
getEvent(request, requestOptions) {
|
|
@@ -1129,6 +1163,14 @@ export class PredictorSDKClient {
|
|
|
1129
1163
|
skipValidation: true,
|
|
1130
1164
|
breadcrumbsPrefix: ["response"],
|
|
1131
1165
|
}), _response.rawResponse);
|
|
1166
|
+
case 409:
|
|
1167
|
+
throw new PredictorSDK.ConflictError(serializers.AmbiguousIdentifierError.parseOrThrow(_response.error.body, {
|
|
1168
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1169
|
+
allowUnrecognizedUnionMembers: true,
|
|
1170
|
+
allowUnrecognizedEnumValues: true,
|
|
1171
|
+
skipValidation: true,
|
|
1172
|
+
breadcrumbsPrefix: ["response"],
|
|
1173
|
+
}), _response.rawResponse);
|
|
1132
1174
|
case 429:
|
|
1133
1175
|
throw new PredictorSDK.TooManyRequestsError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1134
1176
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -2,12 +2,18 @@ import type * as PredictorSDK from "../../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* eventId: "
|
|
5
|
+
* eventId: "KXNBAGAME-26OCT20OKCSAS"
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface GetEventRequest {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Platform-native event identifier. Examples per platform: Kalshi event ticker (`KXNBAGAME-26OCT20OKCSAS`), Polymarket event slug (`mlb-tor-cle-2026-09-02`), SX Bet event id (`L19766755`), Predict market id (`1607914`), Hyperliquid question or outcome integer id (requires `?platform=hyperliquid` since integer ids aren't inferred). The composite `{provider}:{native_id}` form (e.g. `predict:1607914`) is accepted here too and dispatches without probing.
|
|
11
|
+
*
|
|
12
|
+
* **A bare numeric id or slug is not unique across platforms.** Polymarket and Predict both use these shapes and their id spaces overlap, so sending one without a platform can fail with `409` (see that response). Pass `?platform=` — every row of `GET /v1/matching-markets/sports` carries the `platform` that goes with its `event_id`.
|
|
13
|
+
*
|
|
14
|
+
* **Sports identifiers expire.** Game tickers and slugs are delisted once an event settles, and Hyperliquid ids roll over daily. Take current ones from `GET /v1/matching-markets/sports` (every platform row carries its provider-native `event_id`) rather than copying one out of this reference.
|
|
15
|
+
*/
|
|
10
16
|
eventId: string;
|
|
11
|
-
/** Optional platform override. When omitted, inferred from the `event_id` format: `KX…` → Kalshi, `L\d+` → SX Bet. Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; in that case the service probes
|
|
17
|
+
/** Optional platform override. When omitted, inferred from the `event_id` format: `KX…` → Kalshi, `L\d+` → SX Bet. Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; in that case the service probes both and returns `409` rather than guessing if the identifier resolves on both. Hyperliquid question/outcome integer ids collide with these numerics and are not inferred — pass `?platform=hyperliquid` (alias `hl`). Passing `platform` explicitly skips the probe entirely and is the recommended call whenever you know it. Supplying a value that contradicts a composite `{provider}:` prefix is a `400`. */
|
|
12
18
|
platform?: PredictorSDK.GetEventRequestPlatform;
|
|
13
19
|
}
|
|
@@ -2,12 +2,18 @@ import type * as PredictorSDK from "../../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* marketId: "kalshi:KXNBA-
|
|
5
|
+
* marketId: "kalshi:KXNBA-27-SAS"
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface GetMarketRequest {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Composite (`{provider}:{native_id}`) or platform-native market identifier. Examples per platform: Kalshi market ticker (`KXNBA-27-SAS`), Polymarket numeric id or slug (`540817` or `mlb-tor-cle-2026-09-02`), Predict market id (`356635`), SX Bet `marketHash` (`0x…64hex`), Hyperliquid outcome id (use the composite `hyperliquid:<outcome-id>` or `?platform=hyperliquid` — bare integer ids aren't inferred).
|
|
11
|
+
*
|
|
12
|
+
* **A bare numeric id or slug is not unique across platforms.** Polymarket and Predict both use these shapes and their id spaces overlap, so sending one without a platform can fail with `409` (see that response). Prefer the composite form — it is what `GET /v1/markets` returns in `data[].id` — or pass `?platform=`.
|
|
13
|
+
*
|
|
14
|
+
* **Sports identifiers expire.** Kalshi game tickers, Polymarket game slugs, and Hyperliquid outcome ids are recycled or delisted as events settle — Hyperliquid's live catalog is a handful of daily-recurring outcomes, so any specific integer id there is valid for roughly a day. Take current ids from `GET /v1/markets` or `GET /v1/matching-markets/sports` rather than copying one out of this reference. Long-dated markets (Kalshi season futures, multi-year AlphaArcade questions) and settled Polymarket/Predict/SX Bet ids stay resolvable.
|
|
15
|
+
*/
|
|
10
16
|
marketId: string;
|
|
11
|
-
/** Optional platform override. When omitted, inferred from the composite prefix or from the native ID format (`KX…` → Kalshi, `0x…64hex` → SX Bet). Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; in that case the service probes
|
|
17
|
+
/** Optional platform override. When omitted, inferred from the composite prefix or from the native ID format (`KX…` → Kalshi, `0x…64hex` → SX Bet). Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; in that case the service probes both and returns `409` rather than guessing if the identifier resolves on both. Hyperliquid integer ids collide with these numerics and are not inferred — use the composite `hyperliquid:<id>` or `?platform=hyperliquid` (alias `hl`). Passing `platform` explicitly skips the probe entirely and is the recommended call whenever you know it. When the override contradicts a composite prefix (e.g. `kalshi:X` with `?platform=polymarket`), the request returns 400. */
|
|
12
18
|
platform?: PredictorSDK.GetMarketRequestPlatform;
|
|
13
19
|
}
|
|
@@ -10,4 +10,14 @@ export interface GetMarketsRequest {
|
|
|
10
10
|
cursor?: string;
|
|
11
11
|
/** Canonical top-level category filter. This is PredictorSDK's normalized category, not a provider-native tag. Cursors are bound to the category filter used to create them. */
|
|
12
12
|
category?: PredictorSDK.MarketCategory;
|
|
13
|
+
/**
|
|
14
|
+
* Restrict the page to one provider, matched against each row's own `provider` value. Without it, providers are walked in the order below and a caller wanting a later one has to paginate through every earlier provider's rows first.
|
|
15
|
+
*
|
|
16
|
+
* Only the canonical provider IDs are accepted, case-insensitively. Any other value returns `400` listing the legal ones — an unrecognized filter is never ignored, because a silently dropped filter returns a full unfiltered page that looks filtered.
|
|
17
|
+
*
|
|
18
|
+
* `pagination.total` counts only the selected provider's rows, and cursors are bound to the filter that created them: replay a `next_cursor` with the same `provider` value, or start again from the first page.
|
|
19
|
+
*
|
|
20
|
+
* This is a catalog membership filter, and it is spelled `provider` because that is the field it selects on. It is unrelated to the `platform` override on `GET /v1/markets/{market_id}` and `GET /v1/events/{event_id}`, which names the venue an identifier should be resolved against rather than filtering a list.
|
|
21
|
+
*/
|
|
22
|
+
provider?: PredictorSDK.GetMarketsRequestProvider;
|
|
13
23
|
}
|
|
@@ -7,18 +7,24 @@ export interface GetSportsMatchingMarketsRequest {
|
|
|
7
7
|
limit?: number;
|
|
8
8
|
/** Opaque cursor from a previous response's `pagination.nextCursor` in the SDKs (raw JSON: `pagination.next_cursor`). Must be used with the same filter set — a cursor from `include_settled=true` cannot be replayed against `include_settled=false` and will return `400`. */
|
|
9
9
|
cursor?: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Selects which events this request draws from, in list mode and in lookup mode alike. Defaults to `false`: only events whose scheduled start has not certainly passed — today's games, plus a one-day grace so a late start that runs past midnight Eastern is never dropped mid-play. Set it to `true` to also get events whose game date is further in the past, including ones a venue still lists as open.
|
|
12
|
+
*
|
|
13
|
+
* A venue can keep quoting a market for months after the game (a 94-day-old row was still `status: open` with a live two-sided book when this was written), so the endpoint filters on the game date it already holds — the trailing date of the canonical `event_id` — rather than on an upstream status it cannot verify. Nothing is reported as settled that the venue has not settled; these events are simply not *current*, which is what the default page is for.
|
|
14
|
+
*
|
|
15
|
+
* Because it selects the population, a lookup (`?event_id=`, `?polymarket_market_slug=`, …) for a past-dated event answers `200` with an empty `markets` object unless this is `true`.
|
|
16
|
+
*/
|
|
11
17
|
includeSettled?: boolean;
|
|
12
18
|
/** When `true`, add `canonical_events` with normalized event, submarket, line, segment, outcome, and exact source market/outcome identity. This is an identity mapping only; fetch current status, quotes, and liquidity from the referenced market resources. Defaults to `false` so the compact Dome-compatible response is unchanged. */
|
|
13
19
|
includeSubmarkets?: boolean;
|
|
14
|
-
/** Canonical event key(s) to look up directly (for example, `
|
|
20
|
+
/** Canonical event key(s) to look up directly (for example, `nba-okc-sas-2026-10-20`). Provide the parameter multiple times for multiple events, up to 100 unique keys. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
|
|
15
21
|
eventId?: string | string[];
|
|
16
|
-
/** Kalshi event ticker(s) to find matching markets for (e.g. `
|
|
22
|
+
/** Kalshi event ticker(s) to find matching markets for (e.g. `KXNBAGAME-26OCT20OKCSAS`). Provide the parameter multiple times for multiple tickers, up to 100 unique values. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
|
|
17
23
|
kalshiEventTicker?: string | string[];
|
|
18
|
-
/** Polymarket market slug(s) to find matching markets for (e.g. `
|
|
24
|
+
/** Polymarket market slug(s) to find matching markets for (e.g. `mlb-tor-cle-2026-09-02`). Provide the parameter multiple times for multiple slugs, up to 100 unique values. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
|
|
19
25
|
polymarketMarketSlug?: string | string[];
|
|
20
|
-
/** Predict market ID(s) to find matching markets for (e.g. `
|
|
26
|
+
/** Predict market ID(s) to find matching markets for (e.g. `1607914`). Provide the parameter multiple times for multiple IDs, up to 100 unique values. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
|
|
21
27
|
predictMarketId?: string | string[];
|
|
22
|
-
/** SX Bet market ID(s) to find matching markets for (e.g. `
|
|
28
|
+
/** SX Bet market ID(s) to find matching markets for (e.g. `0xb4d047a709aae881e5ccad9d123592967644ee1df1f17078c762b388e41b81c5`). Provide the parameter multiple times for multiple IDs, up to 100 unique values. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
|
|
23
29
|
sxbetMarketId?: string | string[];
|
|
24
30
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
2
|
+
import * as errors from "../../errors/index.js";
|
|
3
|
+
import type * as PredictorSDK from "../index.js";
|
|
4
|
+
export declare class ConflictError extends errors.PredictorSDKError {
|
|
5
|
+
readonly body: PredictorSDK.AmbiguousIdentifierError;
|
|
6
|
+
constructor(body: PredictorSDK.AmbiguousIdentifierError, rawResponse?: core.RawResponse);
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../errors/index.js";
|
|
3
|
+
export class ConflictError extends errors.PredictorSDKError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "ConflictError",
|
|
7
|
+
statusCode: 409,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = "ConflictError";
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/api/errors/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error body returned with HTTP 409. The identifier you sent is well-formed but not unique: it names a real resource on more than one platform, and nothing in the request says which one you meant. Polymarket and Predict share both the bare-numeric and kebab-case identifier shapes and their id spaces genuinely overlap, so this is a routine outcome rather than an edge case — measured 2026-08-25, 53 of 93 Predict market ids drawn from `GET /v1/matching-markets/sports` also resolved on Polymarket.
|
|
3
|
+
*
|
|
4
|
+
* `candidates` lists exactly the platforms the identifier resolved on, in a stable order, and every entry is a legal `?platform=` value. Retry the same identifier with `?platform={candidate}`, or with the composite `{platform}:{id}` form, and the lookup is deterministic. Clients that fan out over identifiers should handle 409 by re-issuing with the platform they already know from the listing that produced the id — every list and matching response that emits an identifier also emits its platform.
|
|
5
|
+
*/
|
|
6
|
+
export interface AmbiguousIdentifierError {
|
|
7
|
+
/** Short machine-stable reason, e.g. `ambiguous market_id`. */
|
|
8
|
+
error: string;
|
|
9
|
+
/** Human-readable detail naming the identifier, the platforms it resolved on, and how to disambiguate. */
|
|
10
|
+
message?: string;
|
|
11
|
+
/** The platforms this identifier resolved on. Each value is accepted verbatim by the `platform` query parameter. */
|
|
12
|
+
candidates: string[];
|
|
13
|
+
statusCode: number;
|
|
14
|
+
}
|
|
@@ -4,7 +4,7 @@ export interface CanonicalSportsEvent {
|
|
|
4
4
|
eventId: string;
|
|
5
5
|
/** Canonical sport slug. `basketball`, `hockey`, or `baseball` today. */
|
|
6
6
|
sport?: string;
|
|
7
|
-
/** Canonical league slug. Cross-platform matching covers `nba`, `wnba`, `nhl`, and `mlb` today. The value is the first segment of `event_id`, so `
|
|
7
|
+
/** Canonical league slug. Cross-platform matching covers `nba`, `wnba`, `nhl`, and `mlb` today. The value is the first segment of `event_id`, so `nba-okc-sas-2026-10-20` is an NBA game. Treat this as an open set — leagues are added without a breaking change. */
|
|
8
8
|
league?: string;
|
|
9
9
|
title: string;
|
|
10
10
|
participants?: PredictorSDK.CanonicalSportsParticipant[];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type * as PredictorSDK from "../index.js";
|
|
2
2
|
export interface CanonicalSportsSourceMarket {
|
|
3
3
|
provider: PredictorSDK.CanonicalSportsSourceMarketProvider;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Exact provider-native market identifier. It resolves on `GET /v1/markets/{market_id}`, either as-is or prefixed with this row's `provider` in the composite form `{provider}:{market_id}`.
|
|
6
|
+
*
|
|
7
|
+
* One provider can contribute MORE THAN ONE entry to the same submarket, because a provider is free to model one canonical market as several native ones. Kalshi does exactly that for a game moneyline: it lists one binary market per team ("Arizona wins", "San Francisco wins"), so a Kalshi moneyline row appears twice, once per team ticker, each with its own `yes`/`no` outcomes. Group by `provider` if you need one row per venue; do not assume the list has at most one entry per provider.
|
|
8
|
+
*/
|
|
5
9
|
marketId: string;
|
|
6
10
|
marketName?: string;
|
|
7
11
|
marketSlug?: string;
|
|
@@ -2,7 +2,13 @@ export interface CanonicalSportsSourceOutcome {
|
|
|
2
2
|
/** Canonical outcome this source-native selection represents. */
|
|
3
3
|
canonicalOutcomeKey: string;
|
|
4
4
|
label?: string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Exact provider-native outcome identifier. It is never a universal cross-provider outcome ID.
|
|
7
|
+
*
|
|
8
|
+
* On every provider this is the same value `GET /v1/markets/{market_id}` returns as `outcomes[].outcome_id` for the market named by this row's `market_id`, so the two surfaces join directly.
|
|
9
|
+
*
|
|
10
|
+
* `polymarket`, `predict` and `alpha-arcade` publish a globally unique per-outcome token (Polymarket CLOB token id, Predict on-chain id, AlphaArcade CLOB token id). `sxbet` and `kalshi` publish no per-outcome token at all, so their references are market-scoped and must be read together with `market_id`: an SX Bet market has one hash and two named positions (`outcomeOne` / `outcomeTwo`), and a Kalshi market is binary (`yes` / `no`). Both are the spelling the venue itself uses to address a side — SX Bet keys its order-book snapshot by `outcomeOne`/`outcomeTwo`, and Kalshi keys its book by `yes`/`no` and reports a trade's `taker_side` the same way.
|
|
11
|
+
*/
|
|
6
12
|
outcomeId?: string;
|
|
7
13
|
/** Optional source-native side such as `yes` or `no`. */
|
|
8
14
|
side?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface EventMarket {
|
|
2
|
-
/** Platform-native market identifier. Kalshi ticker (`KXMLBGAME-
|
|
2
|
+
/** Platform-native market identifier. Kalshi ticker (`KXMLBGAME-26AUG272145AZSF-AZ`), Polymarket numeric market id, SX Bet `marketHash`, or Predict market id. */
|
|
3
3
|
marketId: string;
|
|
4
4
|
/** Human-readable market title/question. */
|
|
5
5
|
title: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const GetMarketsRequestProvider: {
|
|
2
|
+
readonly Kalshi: "kalshi";
|
|
3
|
+
readonly Polymarket: "polymarket";
|
|
4
|
+
readonly Predict: "predict";
|
|
5
|
+
readonly Sxbet: "sxbet";
|
|
6
|
+
readonly Hyperliquid: "hyperliquid";
|
|
7
|
+
readonly AlphaArcade: "alpha-arcade";
|
|
8
|
+
};
|
|
9
|
+
export type GetMarketsRequestProvider = (typeof GetMarketsRequestProvider)[keyof typeof GetMarketsRequestProvider];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as PredictorSDK from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* One side's fee model. Both `taker` and `maker` are always returned and you pick: PredictorSDK does not infer which side you will be, since that needs an order it has not seen. Null when the model is not determinable for that side.
|
|
4
|
+
*
|
|
5
|
+
* Note that "maker" and "taker" mean the venue's own definition — the resting order is the maker, the incoming order that fills it is the taker.
|
|
6
|
+
*/
|
|
7
|
+
export interface MarketDetailFeeLeg {
|
|
8
|
+
/**
|
|
9
|
+
* The price term of the per-share fee.
|
|
10
|
+
*
|
|
11
|
+
* `quadratic` — `rate × (price × (1 − price)) ^ exponent`. Kalshi (`roundup(0.07 × C × P × (1−P))`, exponent 1 by published formula), Polymarket (`fee = C × feeRate × p × (1 − p)`, exponent read per market), AlphaArcade (`feeBase × quantity × price × (1 − price)`).
|
|
12
|
+
*
|
|
13
|
+
* `min_price` — `rate × min(price, 1 − price)`. Predict (`Base Fee % × min(Price, 1 − Price) × Shares`). A TENT, not a parabola: the effective rate on notional is flat at `rate` for every price at or below 0.5 and only declines above it. Do not collapse this into `quadratic`; it would overstate the fee at every price below 0.5.
|
|
14
|
+
*
|
|
15
|
+
* `notional` — `rate × price`, i.e. a flat fraction of traded notional with no price curve at all.
|
|
16
|
+
*
|
|
17
|
+
* `none` — zero, asserted.
|
|
18
|
+
*/
|
|
19
|
+
model: PredictorSDK.MarketDetailFeeLegModel;
|
|
20
|
+
/** A DECIMAL FRACTION, never basis points — matching each venue's own published unit. `0.07` is 7% of the price term, not 7 bps. Null means the shape is known but the value is not (Hyperliquid, where the effective rate is account-tiered). `0` means zero, asserted. */
|
|
21
|
+
rate: number | null;
|
|
22
|
+
/** Only meaningful for `model: "quadratic"`; null otherwise. Read per market from Polymarket's `feeSchedule.exponent`; `1` on Kalshi and AlphaArcade, whose published formulas are exponent-1 by construction. Never defaulted when unknown — a quadratic leg with an unreadable exponent makes the whole descriptor `partial`, because the exponent moves the fee by roughly 4x and can flip which venue is cheaper. */
|
|
23
|
+
exponent: number | null;
|
|
24
|
+
rounding: PredictorSDK.MarketDetailFeeRounding | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The price term of the per-share fee.
|
|
3
|
+
*
|
|
4
|
+
* `quadratic` — `rate × (price × (1 − price)) ^ exponent`. Kalshi (`roundup(0.07 × C × P × (1−P))`, exponent 1 by published formula), Polymarket (`fee = C × feeRate × p × (1 − p)`, exponent read per market), AlphaArcade (`feeBase × quantity × price × (1 − price)`).
|
|
5
|
+
*
|
|
6
|
+
* `min_price` — `rate × min(price, 1 − price)`. Predict (`Base Fee % × min(Price, 1 − Price) × Shares`). A TENT, not a parabola: the effective rate on notional is flat at `rate` for every price at or below 0.5 and only declines above it. Do not collapse this into `quadratic`; it would overstate the fee at every price below 0.5.
|
|
7
|
+
*
|
|
8
|
+
* `notional` — `rate × price`, i.e. a flat fraction of traded notional with no price curve at all.
|
|
9
|
+
*
|
|
10
|
+
* `none` — zero, asserted.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MarketDetailFeeLegModel: {
|
|
13
|
+
readonly Quadratic: "quadratic";
|
|
14
|
+
readonly MinPrice: "min_price";
|
|
15
|
+
readonly Notional: "notional";
|
|
16
|
+
readonly None: "none";
|
|
17
|
+
};
|
|
18
|
+
export type MarketDetailFeeLegModel = (typeof MarketDetailFeeLegModel)[keyof typeof MarketDetailFeeLegModel];
|