@0xinsider/sdk 0.40.0 → 0.42.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/schema.d.ts CHANGED
@@ -123,6 +123,14 @@ export type BatchGameHoldersItem = {
123
123
  data?: GameHoldersItem;
124
124
  error?: ApiErrorBody;
125
125
  };
126
+ export type BatchMarketCloseItem = {
127
+ /** Zero-based request index. Duplicate inputs keep separate result rows. */
128
+ index: number;
129
+ input: string;
130
+ status: "ok" | "error";
131
+ data?: MarketClose;
132
+ error?: ApiErrorBody;
133
+ };
126
134
  export type BatchMarketFlowItem = {
127
135
  /** Zero-based request index. Duplicate inputs keep separate result rows. */
128
136
  index: number;
@@ -489,6 +497,7 @@ export type CreateWebhookRequest = {
489
497
  url: string;
490
498
  event_types: WebhookEventType[];
491
499
  trade_filters?: LargeTradeSubscriptionFilters;
500
+ price_move_filters?: PriceMoveSubscriptionFilters;
492
501
  };
493
502
  export type CreateWebhookVerificationAttemptRequest = {
494
503
  /** The original one-time token returned by webhook creation or a URL change. Sent only in the request body and signed receiver challenge. */
@@ -1276,7 +1285,7 @@ export type Game = {
1276
1285
  /** Kickoff in UTC, as the provider supplied it. Omitted when the provider published none; coverage.schedule then reads unavailable. */
1277
1286
  scheduled_at?: string;
1278
1287
  status: GameStatus;
1279
- /** Both sides, in the provider's own order. For a team league the provider lists the home side first. Empty when the provider identified neither side. */
1288
+ /** Both sides, in the provider's own order. That order states no home or away: Polymarket lists the away team first in US leagues and the home team first in soccer. Read a market's side for home and away. Empty when the provider identified neither side. */
1280
1289
  competitors: GameCompetitor[];
1281
1290
  /** The esports series length, for example Bo3. Omitted for everything else. */
1282
1291
  series_format?: string;
@@ -1296,7 +1305,7 @@ export type Game = {
1296
1305
  };
1297
1306
  /** One side of the game. */
1298
1307
  export type GameCompetitor = {
1299
- /** The competitor's name as the provider gives it. */
1308
+ /** The team as its moneyline outcome names it, the same before, during and after the game (Jaguars, Penn). Where no outcome names the team, for example a soccer game's Yes/No win markets, the provider's full name (FC Bayern München). To identify a team, prefer provider_id. */
1300
1309
  name: string;
1301
1310
  /** The provider's league-scoped competitor id, as a string. Omitted when the provider has not identified this side; coverage.competitors then reads labels. */
1302
1311
  provider_id?: string;
@@ -1371,7 +1380,7 @@ export type GameMarket = {
1371
1380
  slug?: string;
1372
1381
  /** The provider's own market type, for example moneyline or spread. Omitted when the provider sent none. Not an enum: the provider owns this vocabulary and adds to it. */
1373
1382
  sports_market_type?: string;
1374
- /** Which side of the game this market's YES leg pays. Soccer 1X2 legs are explicitly classified as home, draw or away by the provider projection. draw is a real value, not a competitor. Omitted when the provider projection cannot classify the leg, which is not the same as other. */
1383
+ /** Which side of the game this market's YES leg pays. home and away are the provider's own home/away designation of the team the YES leg names (Polymarket's teams[].ordering), never its place in competitors. Soccer 1X2 legs are explicitly classified as home, draw or away by the provider projection. draw is a real value, not a competitor. Omitted when the provider projection cannot classify the leg or the provider designates neither team home or away, which is not the same as other. */
1375
1384
  side?: "home" | "away" | "draw" | "other";
1376
1385
  /** The provider's label for the YES outcome. Omitted when the provider sent none. */
1377
1386
  outcome_yes?: string;
@@ -1485,7 +1494,8 @@ export type GameSharpMoney = {
1485
1494
  is_leader: boolean;
1486
1495
  label: string;
1487
1496
  pct: number;
1488
- side: "home" | "draw" | "away";
1497
+ /** The side the provider designates this outcome's team: home or away, by Polymarket's own home/away designation (teams[].ordering), never the outcome's place in this list; draw for a 1X2 draw. null when the provider designates neither team home or away; never inferred from order. */
1498
+ side: "home" | "draw" | "away" | null;
1489
1499
  usd: number;
1490
1500
  wallets: {
1491
1501
  a: number;
@@ -1799,6 +1809,23 @@ export type LargeTrade = {
1799
1809
  /** Provider-backed market_canonical category. */
1800
1810
  category?: string;
1801
1811
  };
1812
+ /** Closing line value against the market's stored close (GET /api/v1/market/{condition_id}/close). Always present; status says whether it is measured. */
1813
+ clv: {
1814
+ /** The CLV definition, clv@v1. */
1815
+ basis_version: string;
1816
+ /** The anchor pre_kickoff was judged against: the stored close's anchor, else the market's kickoff. */
1817
+ close_anchor_at: string | null;
1818
+ /** The traded outcome's closing price, 0 to 1, whenever a usable close is stored and the outcome is known, in play included. */
1819
+ close_price: number | null;
1820
+ /** Cents per share, positive when the trade beat the close: buy is (close_price - price) * 100, sell is (price - close_price) * 100. Gross of fees. Computed from the trade's exact stored price; price on the wire is rounded to 4 places, so a recomputation from it agrees within 0.005 cents. Set exactly when status is measured. */
1821
+ clv_cents: number | null;
1822
+ /** Whether the trade filled before close_anchor_at. null when the market has no anchor. */
1823
+ pre_kickoff: boolean | null;
1824
+ /** measured: clv_cents is set. in_play: traded at or after the close anchor (kickoff), no CLV is defined. pending: traded before kickoff and the market's close is not stored yet. unavailable: see unavailable_reason. */
1825
+ status: "measured" | "in_play" | "pending" | "unavailable";
1826
+ /** Set exactly when status is unavailable. The market's reasons (see MarketClose.unavailable_reason), plus anchor_stale (the kickoff moved after the close was captured) and outcome_unknown (the traded outcome is not known for this trade). */
1827
+ unavailable_reason: "no_observation_in_lookback" | "provider_empty_window" | "provider_invalid_contract" | "capture_window_closed" | "no_game_start_time" | "not_one_sided_resolution" | "not_captured" | "close_token_mismatch" | "anchor_stale" | "outcome_unknown" | null;
1828
+ };
1802
1829
  };
1803
1830
  export type LargeTradeDetail = LargeTrade & {
1804
1831
  counterparty_analysis: CounterpartyAnalysis;
@@ -2017,6 +2044,48 @@ export type MarketCandles = {
2017
2044
  /** One entry per present provider token (YES first, then NO); empty when no tokens have been fetched yet. */
2018
2045
  outcomes: OutcomeCandles[];
2019
2046
  };
2047
+ /** A market's stored closing line (#32517): Polymarket's price-history value for the last minute bucket ending at or before kickoff, read once after settlement and never recomputed. */
2048
+ export type MarketClose = {
2049
+ /** true when game_start_time has moved more than lookback_seconds from close_anchor_at since capture; large trades on the market then carry no CLV. null without a stored row. */
2050
+ anchor_stale: boolean | null;
2051
+ /** Provider response contract version the value was read under. */
2052
+ basis_version: string | null;
2053
+ /** When the close was stored. Bookkeeping only. */
2054
+ captured_at: string | null;
2055
+ /** The instant the close was measured at: the kickoff when it was captured. Write-once; null when no close row is stored. */
2056
+ close_anchor_at: string | null;
2057
+ /** The field that supplied close_anchor_at, markets.game_start_time. */
2058
+ close_anchor_source: string | null;
2059
+ /** Polymarket condition id. */
2060
+ condition_id: string;
2061
+ /** The market's kickoff as stored now. */
2062
+ game_start_time: string | null;
2063
+ /** How far before the anchor the admitted bucket may start: 21600 (6 hours). */
2064
+ lookback_seconds: number | null;
2065
+ /** Bucket width: 60 (minute grain) or 3600 (hour grain, for a market read more than about six days after kickoff). */
2066
+ observation_window_seconds: number | null;
2067
+ /** Start of the provider bucket the close is. The bucket ends at observed_at + observation_window_seconds, at or before close_anchor_at. */
2068
+ observed_at: string | null;
2069
+ /** YES then NO when status is measured; empty otherwise. */
2070
+ outcomes: ({
2071
+ /** Closing price, 0 to 1, at full stored precision. */
2072
+ close_price: number;
2073
+ /** true on the NO leg: 1 minus the stored YES price, never a second read. */
2074
+ derived_from_yes: boolean;
2075
+ /** The outcome's label. */
2076
+ outcome: string | null;
2077
+ /** 0 is the YES leg, 1 the NO leg. */
2078
+ outcome_index: number;
2079
+ /** CLOB token id of the outcome. */
2080
+ token_id: string | null;
2081
+ })[];
2082
+ /** Provider endpoint and grain, e.g. polymarket_data_v2_prices_history@minute-window-v1. */
2083
+ price_source: string | null;
2084
+ /** measured: outcomes carries the close. pending: no close is stored yet and the capture will still read the market. unavailable: no close will be served; see unavailable_reason. */
2085
+ status: "measured" | "pending" | "unavailable";
2086
+ /** Set exactly when status is unavailable. no_observation_in_lookback, provider_empty_window, provider_invalid_contract and capture_window_closed are the capture's own stored refusals; no_game_start_time: the market has no kickoff time; not_one_sided_resolution: it resolved to neither side; not_captured: the capture does not read it (no tracked buy before resolution, or kickoff over 30 days ago); close_token_mismatch: the close was read on a different YES token than the market carries now. */
2087
+ unavailable_reason: "no_observation_in_lookback" | "provider_empty_window" | "provider_invalid_contract" | "capture_window_closed" | "no_game_start_time" | "not_one_sided_resolution" | "not_captured" | "close_token_mismatch" | "anchor_stale" | "outcome_unknown" | null;
2088
+ };
2020
2089
  export type MarketFlow = {
2021
2090
  market: {
2022
2091
  id: string;
@@ -2198,6 +2267,62 @@ export type MarketHoldersTotals = {
2198
2267
  /** no_usd split by grade: where the S, A and B money on NO sits. */
2199
2268
  no_grade_usd: MarketHoldersSideGradeUsd;
2200
2269
  };
2270
+ /** `market_price_moved` data, also the MarketPriceMoved frame on GET /api/v1/stream: a sports or esports market's outcome-0 midpoint moved a whole-cent level over one window. Prices are decimal strings at full precision. A missing value is null with its *_unavailable_reason. */
2271
+ export type MarketPriceMovedData = {
2272
+ best_ask: string;
2273
+ best_bid: string;
2274
+ concurrent_sharp_flow: {
2275
+ detected: boolean;
2276
+ grade_floor: "S" | "A" | "B" | "C" | "D" | "F";
2277
+ net_flow_usd: number;
2278
+ ranked_large_trades: number;
2279
+ /** Large trades on the market in the same window at any grade, ungraded wallets included. ranked_large_trades is the part of them at grade_floor or better. */
2280
+ large_trades_in_window: number | null;
2281
+ } | null;
2282
+ concurrent_sharp_flow_unavailable_reason: "read_failed" | null;
2283
+ condition_id: string;
2284
+ detected_at: string;
2285
+ direction: "up" | "down";
2286
+ event_slug: string | null;
2287
+ from_price: string;
2288
+ game_state: {
2289
+ clock: string | null;
2290
+ ended: boolean;
2291
+ live: boolean | null;
2292
+ period: string | null;
2293
+ scores: LiveSportsScoreEntry[];
2294
+ status: string | null;
2295
+ updated_at: string;
2296
+ } | null;
2297
+ game_state_unavailable_reason: "no_event_slug" | "no_game_state" | "read_failed" | null;
2298
+ gap_before: boolean;
2299
+ label: string | null;
2300
+ league: string | null;
2301
+ level_cents: number;
2302
+ market_slug: string | null;
2303
+ move_cents: string;
2304
+ observed_at: string | null;
2305
+ outcome_index: number;
2306
+ /** Where the game stood at detected_at. in_play: its live state reports it live. pre_game: its live state is neither live nor ended, or it has no live state yet and the market's scheduled start (the games endpoints' scheduled_at) is after detected_at. unknown: neither holds or the live state could not be read; game_state_unavailable_reason says why. */
2307
+ phase: "pre_game" | "in_play" | "unknown";
2308
+ previous_level_cents: number;
2309
+ source: string;
2310
+ spread_cents: string;
2311
+ to_price: string;
2312
+ window_seconds: number;
2313
+ window_start: string;
2314
+ /** Why book_depth_within_2c is null, and null when it is present. no_book: no full order book has arrived for the market since tracking began, only quotes. book_changed: the best bid or ask moved after the latest full book, so its depth belongs to another top. band_not_covered: the latest full book shows no level beyond 2 cents from the midpoint on at least one side, so that side's sum could be cut short. */
2315
+ book_depth_unavailable_reason: "no_book" | "book_changed" | "band_not_covered" | null;
2316
+ /** USD resting within 2 cents of outcome 0's midpoint on each side at detected_at, or null with book_depth_unavailable_reason. */
2317
+ book_depth_within_2c: {
2318
+ /** USD resting on asks priced at or below the midpoint plus 0.02 (price times size), as a decimal string. */
2319
+ ask_usd: string;
2320
+ /** USD resting on bids priced at or above the midpoint minus 0.02 (price times size), as a decimal string. */
2321
+ bid_usd: string;
2322
+ /** When we received the full order book the sums come from. Its best bid and ask are the event's best_bid and best_ask; deeper levels may have changed since. */
2323
+ book_observed_at: string;
2324
+ } | null;
2325
+ };
2201
2326
  export type MarketSearchResult = {
2202
2327
  id: string;
2203
2328
  condition_id: string;
@@ -2265,7 +2390,7 @@ export type MarketSnapshot = {
2265
2390
  source: string;
2266
2391
  live_match_key?: string;
2267
2392
  live_league_key?: string;
2268
- /** Live-score period and elapsed may be omitted when unavailable (older responses use null). A score entry may omit full_name when it equals team; fall back to team. Distinct aliases and score admission markers are preserved. For live esports, scores[].map_score retains an available pair through an update omitting both sides only within the same live map, series format and series totals. Map changes and final state follow current provider updates; absent detail remains unavailable. Optional tennis_points supplies independently sourced current-game points and serving side; absence means unavailable. Compatible unexpired tennis_points survives temporary supplemental snapshot unavailability or contention; expiry and set/game mismatch still clear it. */
2393
+ /** Live-score period and elapsed may be omitted when unavailable (older responses use null). A score entry may omit full_name when it equals team; fall back to team. A score entry's side (home or away) is the provider's home/away designation of that team, omitted when the provider gives none; the order of scores states no side. Distinct aliases and score admission markers are preserved. For live esports, scores[].map_score retains an available pair through an update omitting both sides only within the same live map, series format and series totals. Map changes and final state follow current provider updates; absent detail remains unavailable. Optional tennis_points supplies independently sourced current-game points and serving side; absence means unavailable. Compatible unexpired tennis_points survives temporary supplemental snapshot unavailability or contention; expiry and set/game mismatch still clear it. */
2269
2394
  live_score?: Record<string, unknown> & {
2270
2395
  tennis_points?: TennisPoints;
2271
2396
  };
@@ -3056,8 +3181,6 @@ export type PickOfTheDayLedgerOpenedEntry = {
3056
3181
  supersedes_pick_id: string | null;
3057
3182
  /** Explicit proof provenance: 1 retains historic eight-field canonical JSON; 2 binds stable pick_id and version without pick_rank. */
3058
3183
  commitment_version: 1 | 2;
3059
- /** How the pick was chosen: auto by the selection algorithm, manual by an operator (102 published picks from 2026-06-23 to 2026-10-15; none since). Outside the hashed payload, so it moves no commitment. */
3060
- selected_by: "auto" | "manual";
3061
3184
  };
3062
3185
  /** An unresolved published pick. Carries only date, rank, hash, algorithm, seal instant and permalink. Kickoff and game identity are withheld; seal time remains public commitment provenance. */
3063
3186
  export type PickOfTheDayLedgerSealedEntry = {
@@ -3090,8 +3213,6 @@ export type PickOfTheDayLedgerSealedEntry = {
3090
3213
  supersedes_pick_id: string | null;
3091
3214
  /** Explicit proof provenance: 1 retains historic eight-field canonical JSON; 2 binds stable pick_id and version without pick_rank. */
3092
3215
  commitment_version: 1 | 2;
3093
- /** How the pick was chosen: auto by the selection algorithm, manual by an operator (102 published picks from 2026-06-23 to 2026-10-15; none since). Outside the hashed payload, so it moves no commitment. */
3094
- selected_by: "auto" | "manual";
3095
3216
  };
3096
3217
  /** A pick without a commitment, retained so the record cannot omit unprovable entries. Unresolved entries omit game identity; once resolved, matchup, category and payload become public. Existing opened canonical payload bytes and hashes are unchanged. */
3097
3218
  export type PickOfTheDayLedgerUncommittedEntry = {
@@ -3130,8 +3251,6 @@ export type PickOfTheDayLedgerUncommittedEntry = {
3130
3251
  * @deprecated
3131
3252
  */
3132
3253
  supersedes_pick_id: string | null;
3133
- /** How the pick was chosen: auto by the selection algorithm, manual by an operator (102 published picks from 2026-06-23 to 2026-10-15; none since). Outside the hashed payload, so it moves no commitment. */
3134
- selected_by: "auto" | "manual";
3135
3254
  };
3136
3255
  /** A successful current-day entitlement response when only unauthorized ranks have published. It carries an empty pick set, identity-free locked ranks and an upgrade message. Selection IDs, game identity, prices and unauthorized clocks are absent. Any scheduled or proof-pending rows are entitled rows. */
3137
3256
  export type PickOfTheDayNoEntitledPicks = {
@@ -3556,37 +3675,6 @@ export type PickOfTheDayStats = {
3556
3675
  pick_id: string;
3557
3676
  pick_rank: number;
3558
3677
  }[];
3559
- selections: {
3560
- canonical_category?: string;
3561
- clv_avg_display?: string;
3562
- clv_avg_pct?: number;
3563
- clv_avg_pp?: number;
3564
- clv_avg_pp_display?: string;
3565
- clv_measured: number;
3566
- edge_display?: string;
3567
- edge_pp?: number;
3568
- key: string;
3569
- label: string;
3570
- losses: number;
3571
- net_profit_display?: string;
3572
- net_profit_usd?: number;
3573
- pending: number;
3574
- picks: number;
3575
- priced_decided: number;
3576
- priced_in_display?: string;
3577
- priced_in_pct?: number;
3578
- roi_display?: string;
3579
- roi_pct?: number;
3580
- settled: number;
3581
- small_sample: boolean;
3582
- staked_usd: number;
3583
- unit_score?: number;
3584
- unit_score_display?: string;
3585
- void: number;
3586
- win_rate_display?: string;
3587
- win_rate_pct?: number;
3588
- wins: number;
3589
- }[];
3590
3678
  };
3591
3679
  /** The stats with `view=summary` or `sections`: only the named sections, listed in `sections`. `view=summary` names every section except `series`, `days`, `categories`, `months` and `voids`. */
3592
3680
  export type PickOfTheDayStatsSections = {
@@ -4027,37 +4115,6 @@ export type PickOfTheDayStatsSections = {
4027
4115
  pick_id: string;
4028
4116
  pick_rank: number;
4029
4117
  }[];
4030
- selections?: {
4031
- canonical_category?: string;
4032
- clv_avg_display?: string;
4033
- clv_avg_pct?: number;
4034
- clv_avg_pp?: number;
4035
- clv_avg_pp_display?: string;
4036
- clv_measured: number;
4037
- edge_display?: string;
4038
- edge_pp?: number;
4039
- key: string;
4040
- label: string;
4041
- losses: number;
4042
- net_profit_display?: string;
4043
- net_profit_usd?: number;
4044
- pending: number;
4045
- picks: number;
4046
- priced_decided: number;
4047
- priced_in_display?: string;
4048
- priced_in_pct?: number;
4049
- roi_display?: string;
4050
- roi_pct?: number;
4051
- settled: number;
4052
- small_sample: boolean;
4053
- staked_usd: number;
4054
- unit_score?: number;
4055
- unit_score_display?: string;
4056
- void: number;
4057
- win_rate_display?: string;
4058
- win_rate_pct?: number;
4059
- wins: number;
4060
- }[];
4061
4118
  };
4062
4119
  /** A settled uncommitted pick's market, side and price. The same eight fields as PickOfTheDayCommitmentPayload, in the same key order, so a settled pick's side and price sit under payload whatever the entry's state. It is NOT a commitment: no hash was taken over it before the game, and it proves nothing about when the pick was made. */
4063
4120
  export type PickOfTheDayUncommittedPayload = {
@@ -4302,6 +4359,25 @@ export type PotdEntryAuthorization = {
4302
4359
  /** Authorization expiry timestamp. Existing grants do not extend; an expired authorization cannot authorize a new automated entry. */
4303
4360
  expires_at: string;
4304
4361
  };
4362
+ /** Settings for market_price_moved: required when event_types includes it, refused (400) when it does not. A PATCH without it keeps the stored settings; removing the event clears them. A subscription receives at most one delivery per market per window: the one level step whose (previous_level_cents, level_cents] holds min_move_cents. */
4363
+ export type PriceMoveSubscriptionFilters = {
4364
+ /** Move threshold in whole cents of outcome 0's midpoint. */
4365
+ min_move_cents: number;
4366
+ /** The window the move is measured over. */
4367
+ window_seconds: 60 | 120 | 300 | 900;
4368
+ /** One market only. Raw or mkt_-prefixed. */
4369
+ condition_id?: string;
4370
+ /** One Polymarket event (game) only. */
4371
+ event_slug?: string;
4372
+ /** Event slug league prefixes such as nba or epl, matched case-insensitively; any one matches. */
4373
+ league?: string[];
4374
+ /** Game phase when the move was detected. any includes unknown. */
4375
+ phase: "any" | "pre_game" | "in_play";
4376
+ /** Deliver only moves with concurrent_sharp_flow.detected true. */
4377
+ require_concurrent_sharp_flow: boolean;
4378
+ /** Deliver only moves whose book_depth_within_2c is known and holds at least this many USD on each side. A move with book_depth_within_2c null does not match. */
4379
+ min_book_usd_within_2c?: number;
4380
+ };
4305
4381
  /** One PUBLISHED same-day pick whose holder proof is not readable yet: its stable slot rank, the release and kickoff instants, and the instant before which a retry cannot succeed. Every item in `picks` carries its full required shape, so a pick that cannot meet it is listed here instead of being served with missing fields or a synthetic zero. */
4306
4382
  export type ProofPendingPickSlot = {
4307
4383
  /**
@@ -4969,6 +5045,53 @@ export type TraderCategoryRecords = {
4969
5045
  /** One entry per canonical category with at least one decided market, ordered by decided descending then category. A category with no decided market is omitted. The Esports entry carries its per-game records in games. */
4970
5046
  records: TraderCategoryRecord[];
4971
5047
  };
5048
+ /** Closing line value over one wallet's large trades in a window (#32517). */
5049
+ export type TraderClv = {
5050
+ /** Wallet address, lowercase. */
5051
+ address: string;
5052
+ /** The CLV definition, clv@v1, each trade's clv.basis_version. */
5053
+ basis_version: string;
5054
+ /** The category filter as sent, or null. */
5055
+ category: string | null;
5056
+ /** The window's trades that carry no CLV, by clv.status. */
5057
+ excluded: {
5058
+ in_play: number;
5059
+ pending: number;
5060
+ unavailable: number;
5061
+ };
5062
+ /** Window start, inclusive. */
5063
+ from: string;
5064
+ /** trd_-prefixed trader id. */
5065
+ id: string;
5066
+ /** Large trades in the window, every status. */
5067
+ large_trades: number;
5068
+ /** Figures over the trades whose clv.status is measured. */
5069
+ measured: {
5070
+ /** Normal 95% interval on market_mean_clv_cents from the markets' sample deviation, as low and high. null below two markets. */
5071
+ market_ci95_cents: {
5072
+ high: number;
5073
+ low: number;
5074
+ } | null;
5075
+ /** Mean over markets of each market's mean clv_cents. null with no measured trade. */
5076
+ market_mean_clv_cents: number | null;
5077
+ /** Distinct markets among them. */
5078
+ markets: number;
5079
+ /** Plain mean of clv_cents. null with no measured trade. */
5080
+ mean_clv_cents: number | null;
5081
+ /** Share of measured trades with clv_cents > 0, 0 to 1. null with no measured trade. */
5082
+ share_beat_close: number | null;
5083
+ /** Their summed size in USDC. */
5084
+ size_usd: number;
5085
+ /** Mean of clv_cents weighted by each trade's size_usd. null with no measured trade. */
5086
+ stake_weighted_clv_cents: number | null;
5087
+ /** Large trades with clv.status measured. */
5088
+ trades: number;
5089
+ };
5090
+ /** Size floor in USDC, as /large-trades/history reads it. */
5091
+ min_size: number;
5092
+ /** Window end, exclusive. */
5093
+ to: string;
5094
+ };
4972
5095
  export type TraderContext = {
4973
5096
  trader: Trader;
4974
5097
  /** Aggregate position and P&L coverage for the trader, over its synced markets. markets_open, unrealized_mtm and cost_basis_locked cover the open positions on sports and esports markets, each market judged when the summary is read (#32119). markets_synced, markets_resolved and the resolved win figures count every stored market: since 2026-10-27 (#29366) those are mostly sports and esports markets, but a market that moved out of sports and esports, or one stored before its category was known, stays in them, and sync_coverage counts every category on both sides. markets_total, total_realized_pnl and synced_realized_pnl still cover every Polymarket market of the wallet. Omitted entirely (key absent, never null) when the trader is not in the local database or native net economics is unavailable. Realized fields remain numbers when present, including a genuine zero. */
@@ -5607,6 +5730,7 @@ export type UpdateWebhookRequest = {
5607
5730
  url?: string;
5608
5731
  event_types?: WebhookEventType[];
5609
5732
  trade_filters?: LargeTradeSubscriptionFilters;
5733
+ price_move_filters?: PriceMoveSubscriptionFilters;
5610
5734
  enabled?: boolean;
5611
5735
  };
5612
5736
  export type Usage = {
@@ -5703,6 +5827,8 @@ export type WebhookEndpoint = {
5703
5827
  url: string;
5704
5828
  event_types: WebhookEventType[];
5705
5829
  trade_filters: LargeTradeSubscriptionFilters;
5830
+ /** The market_price_moved settings; null unless that event is subscribed. */
5831
+ price_move_filters: PriceMoveSubscriptionFilters | null;
5706
5832
  status: WebhookStatus;
5707
5833
  verified_at: string | null;
5708
5834
  verification_token_expires_at: string;
@@ -5725,7 +5851,7 @@ export type WebhookEventDescriptor = {
5725
5851
  /** active: the event has a firing producer callsite. dormant: advertised and subscribable, but does not yet enqueue any delivery. */
5726
5852
  status: "active" | "dormant";
5727
5853
  };
5728
- export type WebhookEventType = "large_trade_inserted_v2" | "large_trades_inserted" | "whale_trades_inserted" | "live_sports_updated" | "trader_synced" | "whale_trader_synced" | "large_positions_updated" | "wallet_grade_changed" | "suspicious_trade_flagged" | "insider_radar_flag_raised" | "sharp_money_flow_detected" | "smart_money_flow_detected" | "export_job_ready" | "export_job_failed" | "export_job_expired" | "export_job_cancelled";
5854
+ export type WebhookEventType = "large_trade_inserted_v2" | "large_trades_inserted" | "whale_trades_inserted" | "live_sports_updated" | "trader_synced" | "whale_trader_synced" | "large_positions_updated" | "wallet_grade_changed" | "suspicious_trade_flagged" | "insider_radar_flag_raised" | "sharp_money_flow_detected" | "smart_money_flow_detected" | "export_job_ready" | "export_job_failed" | "export_job_expired" | "export_job_cancelled" | "market_price_moved";
5729
5855
  export type WebhookRetryPolicy = {
5730
5856
  max_attempts: 8;
5731
5857
  terminal_status: "dead_letter";
@@ -5898,6 +6024,23 @@ export type WhaleDatasetTrade = {
5898
6024
  /** Stored source trade identity. */
5899
6025
  trade_event_id: string;
5900
6026
  source_trade_ingested_at: string | null;
6027
+ /** Closing line value: the clv object of the same trade on /api/v1/large-trades, judged at the generation's selected_at from close states read inside the same snapshot. A pending row can be measured in a later generation. The close is stored once (GET /api/v1/market/{condition_id}/close), so a measured clv_cents changes only if the market's kickoff or YES token changes afterwards, which makes it unavailable (anchor_stale, close_token_mismatch). */
6028
+ clv: {
6029
+ /** The CLV definition, clv@v1. */
6030
+ basis_version: string;
6031
+ /** The anchor pre_kickoff was judged against: the stored close's anchor, else the market's kickoff. */
6032
+ close_anchor_at: string | null;
6033
+ /** The traded outcome's closing price, 0 to 1, whenever a usable close is stored and the outcome is known, in play included. */
6034
+ close_price: number | null;
6035
+ /** Cents per share, positive when the trade beat the close: buy is (close_price - price) * 100, sell is (price - close_price) * 100. Gross of fees. Computed from the exact stored price this row carries, so a recomputation from price and close_price agrees to the stored digits. Set exactly when status is measured. */
6036
+ clv_cents: number | null;
6037
+ /** Whether the trade filled before close_anchor_at. null when the market has no anchor. */
6038
+ pre_kickoff: boolean | null;
6039
+ /** measured: clv_cents is set. in_play: traded at or after the close anchor (kickoff), no CLV is defined. pending: traded before kickoff and the market's close is not stored yet. unavailable: see unavailable_reason. */
6040
+ status: "measured" | "in_play" | "pending" | "unavailable";
6041
+ /** Set exactly when status is unavailable. The market's reasons (see MarketClose.unavailable_reason), plus anchor_stale (the kickoff moved after the close was captured) and outcome_unknown (the traded outcome is not known for this trade). */
6042
+ unavailable_reason: "no_observation_in_lookback" | "provider_empty_window" | "provider_invalid_contract" | "capture_window_closed" | "no_game_start_time" | "not_one_sided_resolution" | "not_captured" | "close_token_mismatch" | "anchor_stale" | "outcome_unknown" | null;
6043
+ };
5901
6044
  };
5902
6045
  /**
5903
6046
  * The `data` payload of each webhook event type, from the document's
@@ -5913,6 +6056,7 @@ export interface WebhookEventData {
5913
6056
  large_trade_inserted_v2: LargeTradeInsertedV2Data;
5914
6057
  large_trades_inserted: LargeTradesInsertedData;
5915
6058
  live_sports_updated: LiveSportsUpdatedData;
6059
+ market_price_moved: MarketPriceMovedData;
5916
6060
  sharp_money_flow_detected: SharpMoneyFlowDetectedData;
5917
6061
  smart_money_flow_detected: SharpMoneyFlowDetectedData;
5918
6062
  suspicious_trade_flagged: SuspiciousTradeFlaggedData;
@@ -5928,6 +6072,7 @@ export interface WebhookEventData {
5928
6072
  */
5929
6073
  export interface OperationData {
5930
6074
  activateWebhookSecret: WebhookEndpoint;
6075
+ batchGetMarketClose: BatchMarketCloseItem[];
5931
6076
  batchGetMarketFlow: BatchMarketFlowItem[];
5932
6077
  batchGetMarketIntel: BatchMarketFlowItem[];
5933
6078
  batchGetTraders: BatchTraderItem[];
@@ -6098,6 +6243,7 @@ export interface OperationData {
6098
6243
  getInsiderRadarFlag: SuspiciousTrade;
6099
6244
  getLargeTrade: LargeTradeDetail;
6100
6245
  getMarketCandles: MarketCandles;
6246
+ getMarketClose: MarketClose;
6101
6247
  getMarketContextMarkdown: string;
6102
6248
  getMarketFlow: MarketFlow;
6103
6249
  getMarketHolders: MarketHolder[];
@@ -6174,6 +6320,7 @@ export interface OperationData {
6174
6320
  getSuspiciousTrade: SuspiciousTrade;
6175
6321
  getTrader: Trader;
6176
6322
  getTraderCategoryRecords: TraderCategoryRecords;
6323
+ getTraderClv: TraderClv;
6177
6324
  getTraderContext: TraderContext;
6178
6325
  getTraderContextMarkdown: string;
6179
6326
  getTraderExportSnapshot: TraderExportSnapshot;
@@ -6539,6 +6686,7 @@ export interface OperationData {
6539
6686
  /** Each operation's documented query parameters. */
6540
6687
  export interface OperationQuery {
6541
6688
  activateWebhookSecret: Record<string, never>;
6689
+ batchGetMarketClose: Record<string, never>;
6542
6690
  batchGetMarketFlow: Record<string, never>;
6543
6691
  batchGetMarketIntel: Record<string, never>;
6544
6692
  batchGetTraders: Record<string, never>;
@@ -6657,6 +6805,7 @@ export interface OperationQuery {
6657
6805
  /** Inclusive upper bound as a URL-decoded unix timestamp in seconds; points after this timestamp are omitted. If from is also present, from must be less than or equal to to. */
6658
6806
  to?: number;
6659
6807
  };
6808
+ getMarketClose: Record<string, never>;
6660
6809
  getMarketContextMarkdown: Record<string, never>;
6661
6810
  getMarketFlow: {
6662
6811
  /** Lookback window for whale flow aggregation. */
@@ -6715,10 +6864,10 @@ export interface OperationQuery {
6715
6864
  getPickOfTheDayStats: {
6716
6865
  /** full (default) is every section. summary returns view, sections and every section except the five that grow with the record: series, days, categories, months and voids. In summary and sections bodies hit_rate carries no series; series is its own top-level section. Ignored when sections is sent. Any other value returns 400 bad_request with error.param=view. */
6717
6866
  view?: "full" | "summary";
6718
- /** Exactly the sections to return, in the body's order whatever the request order. Repeatable and comma-separated: hit_rate, series, market_expectations, outcome_stats, days, categories, sports, tiers, selections, months, price_bands, market_types, total_sides, streaks, records, voids. The body names them in sections and carries view=sections. An unrecognized name returns 400 bad_request with error.param=sections rather than being ignored. */
6719
- sections?: ("hit_rate" | "series" | "market_expectations" | "outcome_stats" | "days" | "categories" | "sports" | "tiers" | "selections" | "months" | "price_bands" | "market_types" | "total_sides" | "streaks" | "records" | "voids")[];
6867
+ /** Exactly the sections to return, in the body's order whatever the request order. Repeatable and comma-separated: hit_rate, series, market_expectations, outcome_stats, days, categories, sports, tiers, months, price_bands, market_types, total_sides, streaks, records, voids. The body names them in sections and carries view=sections. An unrecognized name returns 400 bad_request with error.param=sections rather than being ignored. */
6868
+ sections?: ("hit_rate" | "series" | "market_expectations" | "outcome_stats" | "days" | "categories" | "sports" | "tiers" | "months" | "price_bands" | "market_types" | "total_sides" | "streaks" | "records" | "voids")[];
6720
6869
  /** Backward-compatible bracket alias for sections, for clients that emit array keys. Repeatable and comma-separated, with the same names. */
6721
- "sections[]"?: ("hit_rate" | "series" | "market_expectations" | "outcome_stats" | "days" | "categories" | "sports" | "tiers" | "selections" | "months" | "price_bands" | "market_types" | "total_sides" | "streaks" | "records" | "voids")[];
6870
+ "sections[]"?: ("hit_rate" | "series" | "market_expectations" | "outcome_stats" | "days" | "categories" | "sports" | "tiers" | "months" | "price_bands" | "market_types" | "total_sides" | "streaks" | "records" | "voids")[];
6722
6871
  };
6723
6872
  getPlatforms: Record<string, never>;
6724
6873
  getPositionTimeline: {
@@ -6774,6 +6923,12 @@ export interface OperationQuery {
6774
6923
  wallet?: string;
6775
6924
  /** Filter LargeTradeInsertedV2 frames to trades at or above this USD notional. Positive decimal with at most six places; other event types are excluded when set. */
6776
6925
  min_size?: string;
6926
+ /** Filter MarketPriceMoved frames to these event slug league prefixes (comma-separated, case-insensitive, e.g. nba,epl). Other event types are excluded when set. */
6927
+ league?: string;
6928
+ /** Filter MarketPriceMoved frames to the one level step per market and window that crosses this threshold, in whole cents (2 to 50): previous_level_cents < min_move_cents <= level_cents, the market_price_moved webhook rule. Other event types are excluded when set. */
6929
+ min_move_cents?: number;
6930
+ /** Filter MarketPriceMoved frames to moves measured over this window. Other event types are excluded when set. */
6931
+ window_seconds?: 60 | 120 | 300 | 900;
6777
6932
  };
6778
6933
  getSuspiciousTrade: Record<string, never>;
6779
6934
  getTrader: {
@@ -6788,6 +6943,16 @@ export interface OperationQuery {
6788
6943
  /** Filter to one canonical category, matched through the same rollup every other category surface uses: soccer, EPL and champions league all reach Soccer, every esports label folds into Esports, and football is AMERICAN football and reaches Football. A filter that reaches Esports returns the Esports record with all of its games; a game is not a filter of its own, so ask for esports and read games. A sports or esports category the wallet has no record in answers 200 with an empty records array, never 404. Sports and esports only (#27311): a category outside them, or a value that reaches no category, returns 400 bad_request with param category and names the accepted buckets. The word sports, in any casing, matches every sport but Esports, the provider's catch-all Sports category (cycling, lacrosse) included: use esports for Esports alone, or omit category for both (#32657). */
6789
6944
  category?: string;
6790
6945
  };
6946
+ getTraderClv: {
6947
+ /** Inclusive RFC3339 lower bound on the trade time. Defaults to 90 days before to. */
6948
+ from?: string;
6949
+ /** Exclusive RFC3339 upper bound on the trade time. Defaults to now; must be after from, and at most 366 days after it. */
6950
+ to?: string;
6951
+ /** Minimum trade size in USD. The capture floor was 3,000 USD before 2026-07-06 and 10,000 USD from then (1,000 USD in earnings markets), so 10000 gives one size rule across the whole archive. From 2026-09-23 a fill must also be at least 0.1% of its market's recorded traded volume (Polymarket's own share count); rows written before that date were not re-filtered. */
6952
+ min_size?: number;
6953
+ /** Filter by market category (case-insensitive). A canonical bucket name (e.g. Basketball) matches every provider member that folds into it (NBA, WNBA, NCAAB); a raw provider value also resolves to its bucket. Sports and esports only (#27430): a category outside them returns 400 bad_request with param category and names the accepted buckets. The word sports, in any casing, matches every sport but Esports, the provider's catch-all Sports category (cycling, lacrosse) included: use esports for Esports alone, or omit category for both (#32657). */
6954
+ category?: string;
6955
+ };
6791
6956
  getTraderContext: Record<string, never>;
6792
6957
  getTraderContextMarkdown: Record<string, never>;
6793
6958
  getTraderExportSnapshot: Record<string, never>;
@@ -7207,6 +7372,7 @@ export interface OperationPath {
7207
7372
  /** Webhook endpoint id owned by the authenticated API key user. */
7208
7373
  id: number;
7209
7374
  };
7375
+ batchGetMarketClose: Record<string, never>;
7210
7376
  batchGetMarketFlow: Record<string, never>;
7211
7377
  batchGetMarketIntel: Record<string, never>;
7212
7378
  batchGetTraders: Record<string, never>;
@@ -7269,6 +7435,10 @@ export interface OperationPath {
7269
7435
  /** Market condition ID. Accepts the raw provider-backed condition_id returned by /api/v1/markets/search or /api/v1/markets/explore, or the mkt_-prefixed market.id emitted by V1 responses. */
7270
7436
  condition_id: string;
7271
7437
  };
7438
+ getMarketClose: {
7439
+ /** Market condition ID. Accepts the raw provider-backed condition_id returned by /api/v1/markets/search or /api/v1/markets/explore, or the mkt_-prefixed market.id emitted by V1 responses. */
7440
+ condition_id: string;
7441
+ };
7272
7442
  getMarketContextMarkdown: {
7273
7443
  /** Market condition ID. Accepts the raw provider-backed condition_id returned by /api/v1/markets/search or /api/v1/markets/explore, or the mkt_-prefixed market.id emitted by V1 responses. */
7274
7444
  condition_id: string;
@@ -7334,6 +7504,10 @@ export interface OperationPath {
7334
7504
  /** Wallet address (0x...), username, or trd_-prefixed trader id. */
7335
7505
  address: string;
7336
7506
  };
7507
+ getTraderClv: {
7508
+ /** Wallet address (0x...), username, or trd_-prefixed trader id. */
7509
+ address: string;
7510
+ };
7337
7511
  getTraderContext: {
7338
7512
  /** Ethereum wallet address (0x...), known trader username, or trd_-prefixed trader ID emitted by this API. */
7339
7513
  address: string;
@@ -7466,6 +7640,10 @@ export interface OperationPath {
7466
7640
  /** Each operation's JSON request body; `never` when it takes none. */
7467
7641
  export interface OperationBody {
7468
7642
  activateWebhookSecret: never;
7643
+ batchGetMarketClose: {
7644
+ /** Market condition IDs (raw or mkt_-prefixed) to resolve in input order. */
7645
+ condition_ids: string[];
7646
+ };
7469
7647
  batchGetMarketFlow: {
7470
7648
  /** Market condition IDs to resolve in input order. */
7471
7649
  condition_ids: string[];
@@ -7516,6 +7694,7 @@ export interface OperationBody {
7516
7694
  getInsiderRadarFlag: never;
7517
7695
  getLargeTrade: never;
7518
7696
  getMarketCandles: never;
7697
+ getMarketClose: never;
7519
7698
  getMarketContextMarkdown: never;
7520
7699
  getMarketFlow: never;
7521
7700
  getMarketHolders: never;
@@ -7539,6 +7718,7 @@ export interface OperationBody {
7539
7718
  getSuspiciousTrade: never;
7540
7719
  getTrader: never;
7541
7720
  getTraderCategoryRecords: never;
7721
+ getTraderClv: never;
7542
7722
  getTraderContext: never;
7543
7723
  getTraderContextMarkdown: never;
7544
7724
  getTraderExportSnapshot: never;
@@ -7606,6 +7786,11 @@ export interface OperationResponse {
7606
7786
  data: OperationData["activateWebhookSecret"];
7607
7787
  meta: ResponseMeta;
7608
7788
  };
7789
+ batchGetMarketClose: {
7790
+ object: "market_close_batch";
7791
+ data: OperationData["batchGetMarketClose"];
7792
+ meta: BatchResponseMeta;
7793
+ };
7609
7794
  batchGetMarketFlow: {
7610
7795
  object: "market_flow_batch";
7611
7796
  data: OperationData["batchGetMarketFlow"];
@@ -7735,6 +7920,11 @@ export interface OperationResponse {
7735
7920
  data: OperationData["getMarketCandles"];
7736
7921
  meta: ResponseMeta;
7737
7922
  };
7923
+ getMarketClose: {
7924
+ object: "market_close";
7925
+ data: OperationData["getMarketClose"];
7926
+ meta: ResponseMeta;
7927
+ };
7738
7928
  getMarketContextMarkdown: string;
7739
7929
  getMarketFlow: {
7740
7930
  object: "market_flow";
@@ -7858,6 +8048,11 @@ export interface OperationResponse {
7858
8048
  data: OperationData["getTraderCategoryRecords"];
7859
8049
  meta: ResponseMeta;
7860
8050
  };
8051
+ getTraderClv: {
8052
+ object: "trader_clv";
8053
+ data: OperationData["getTraderClv"];
8054
+ meta: ResponseMeta;
8055
+ };
7861
8056
  getTraderContext: {
7862
8057
  object: "trader_context";
7863
8058
  data: OperationData["getTraderContext"];