@structbuild/sdk 0.5.11 → 0.6.1

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.
@@ -157,6 +157,77 @@ export interface components {
157
157
  * @enum {string}
158
158
  */
159
159
  AssetWindowFilterTimeframe: "5m" | "15m" | "1h" | "4h" | "1d" | "24h";
160
+ /** @description Category PnL webhook payload. */
161
+ CategoryPnlPayload: {
162
+ trader?: string | null;
163
+ category?: string | null;
164
+ /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
165
+ timeframe: string;
166
+ /** Format: double */
167
+ realized_pnl_usd?: number | null;
168
+ /** Format: int64 */
169
+ markets_in_category?: number | null;
170
+ /** Format: int64 */
171
+ markets_traded?: number | null;
172
+ /** Format: int64 */
173
+ outcomes_traded?: number | null;
174
+ /** Format: int64 */
175
+ total_buys?: number | null;
176
+ /** Format: int64 */
177
+ total_sells?: number | null;
178
+ /** Format: int64 */
179
+ total_redemptions?: number | null;
180
+ /** Format: int64 */
181
+ total_merges?: number | null;
182
+ /** Format: int64 */
183
+ total_splits?: number | null;
184
+ /** Format: double */
185
+ total_volume_usd?: number | null;
186
+ /** Format: double */
187
+ buy_usd?: number | null;
188
+ /** Format: double */
189
+ sell_usd?: number | null;
190
+ /** Format: double */
191
+ redemption_usd?: number | null;
192
+ /** Format: double */
193
+ merge_usd?: number | null;
194
+ /** Format: double */
195
+ convert_collateral_usd?: number | null;
196
+ /** Format: double */
197
+ split_volume_usd?: number | null;
198
+ /** Format: double */
199
+ total_fees?: number | null;
200
+ /** Format: double */
201
+ total_shares_bought?: number | null;
202
+ /** Format: int64 */
203
+ markets_won?: number | null;
204
+ /** Format: int64 */
205
+ markets_lost?: number | null;
206
+ /** Format: double */
207
+ market_win_rate_pct?: number | null;
208
+ /** Format: double */
209
+ avg_hold_time_seconds?: number | null;
210
+ /** Format: double */
211
+ best_trade_pnl_usd?: number | null;
212
+ best_trade_condition_id?: string | null;
213
+ /** Format: double */
214
+ worst_trade_pnl_usd?: number | null;
215
+ worst_trade_condition_id?: string | null;
216
+ /** Format: double */
217
+ total_wins_usd?: number | null;
218
+ /** Format: double */
219
+ total_losses_usd?: number | null;
220
+ /** Format: double */
221
+ avg_win_usd?: number | null;
222
+ /** Format: double */
223
+ avg_loss_usd?: number | null;
224
+ /** Format: double */
225
+ profit_factor?: number | null;
226
+ /** Format: int64 */
227
+ first_trade_at?: number | null;
228
+ /** Format: int64 */
229
+ last_trade_at?: number | null;
230
+ };
160
231
  /**
161
232
  * @description Subscription filters for the `close_to_bond` event. At least one of
162
233
  * `min_probability` or `max_probability` is required (enforced at runtime).
@@ -257,6 +328,18 @@ export interface components {
257
328
  */
258
329
  threshold: number;
259
330
  };
331
+ ConditionHolderMetricsFilters: {
332
+ condition_ids?: string[];
333
+ };
334
+ ConditionHolderMetricsPayload: {
335
+ /** Format: int32 */
336
+ ts: number;
337
+ /** Format: int64 */
338
+ block: number;
339
+ condition_id: string;
340
+ /** Format: int32 */
341
+ holder_count: number;
342
+ };
260
343
  /** @description Payload delivered when a market's volume or transaction metrics cross a configured threshold */
261
344
  ConditionMetricsPayload: {
262
345
  /** @description Market condition ID */
@@ -363,6 +446,25 @@ export interface components {
363
446
  DeleteWebhookResponse: {
364
447
  deleted: boolean;
365
448
  };
449
+ /**
450
+ * @description What triggered a position update. Each value is serialised as a
451
+ * lowercase string in the `dirty_kinds` array on every payload, and
452
+ * the same values are accepted as a subscribe-time filter on rooms
453
+ * that expose one.
454
+ *
455
+ * * `trade` — a buy, sell, merge, split, redemption, or NegRisk
456
+ * convert landed for the position
457
+ * * `price` — the outcome price moved (mark-to-market refresh)
458
+ * * `window` — a 1d / 7d / 30d rolling window boundary was crossed
459
+ * * `position_resolved` — the market that owns this position resolved
460
+ * on this update
461
+ * * `market_resolved` — the market itself resolved (stamped on
462
+ * `MarketRollup` rows for lifetime holders who never redeemed).
463
+ * Carried on the resolution tick stream and on any full-row update
464
+ * that bundles a resolution with a trade.
465
+ * @enum {string}
466
+ */
467
+ DirtyKind: "trade" | "price" | "window" | "position_resolved" | "market_resolved";
366
468
  /** @description V2 UMA OOv2: a proposed price was disputed. */
367
469
  DisputePriceEvent: {
368
470
  id: string;
@@ -393,6 +495,18 @@ export interface components {
393
495
  slug?: string | null;
394
496
  event_slug?: string | null;
395
497
  };
498
+ EventHolderMetricsFilters: {
499
+ event_slugs?: string[];
500
+ };
501
+ EventHolderMetricsPayload: {
502
+ /** Format: int32 */
503
+ ts: number;
504
+ /** Format: int64 */
505
+ block: number;
506
+ event_slug: string;
507
+ /** Format: int32 */
508
+ holder_count: number;
509
+ };
396
510
  /** @description Subscription filters for the `event_metrics` event. All fields are optional. */
397
511
  EventMetricsFilters: {
398
512
  /** @description Restrict to these events. Empty = all events. */
@@ -482,47 +596,6 @@ export interface components {
482
596
  */
483
597
  unique_builder_traders?: number | null;
484
598
  };
485
- /** @description Event PnL webhook payload. */
486
- EventPnlPayload: {
487
- trader?: string | null;
488
- event_slug?: string | null;
489
- /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
490
- timeframe: string;
491
- /** Format: int64 */
492
- markets_traded?: number | null;
493
- /** Format: int64 */
494
- outcomes_traded?: number | null;
495
- /** Format: int64 */
496
- total_buys?: number | null;
497
- /** Format: int64 */
498
- total_sells?: number | null;
499
- /** Format: int64 */
500
- total_redemptions?: number | null;
501
- /** Format: int64 */
502
- total_merges?: number | null;
503
- /** Format: double */
504
- total_volume_usd?: number | null;
505
- /** Format: double */
506
- buy_usd?: number | null;
507
- /** Format: double */
508
- sell_usd?: number | null;
509
- /** Format: double */
510
- redemption_usd?: number | null;
511
- /** Format: double */
512
- merge_usd?: number | null;
513
- /** Format: double */
514
- realized_pnl_usd?: number | null;
515
- /** Format: int64 */
516
- winning_markets?: number | null;
517
- /** Format: int64 */
518
- losing_markets?: number | null;
519
- /** Format: double */
520
- total_fees?: number | null;
521
- /** Format: int64 */
522
- first_trade_at?: number | null;
523
- /** Format: int64 */
524
- last_trade_at?: number | null;
525
- };
526
599
  /** @description Subscription filters for the `event_volume_milestone` event. */
527
600
  EventVolumeMilestoneFilters: {
528
601
  /** @description **Required.** Aggregation windows to monitor. */
@@ -615,6 +688,35 @@ export interface components {
615
688
  */
616
689
  fees: number;
617
690
  };
691
+ /** @description Exit Markers webhook payload — one position open->closed transition. */
692
+ ExitMarkersPayload: {
693
+ trader: string;
694
+ position_id: string;
695
+ condition_id: string;
696
+ event_slug: string;
697
+ market_slug: string;
698
+ title: string;
699
+ question: string;
700
+ image_url: string;
701
+ outcome: string;
702
+ /** Format: int32 */
703
+ outcome_index?: number | null;
704
+ /** Format: double */
705
+ pnl_usd: number;
706
+ /** Format: double */
707
+ pnl_pct: number;
708
+ /** Format: double */
709
+ cost_basis_usd: number;
710
+ /** @description resolved_win | resolved_loss | sold_win | sold_loss */
711
+ reason: string;
712
+ /** Format: int64 */
713
+ block: number;
714
+ /**
715
+ * Format: int32
716
+ * @description Exit time, unix seconds.
717
+ */
718
+ ts: number;
719
+ };
618
720
  /** @description Payload delivered when a tracked trader executes their first-ever trade on Polymarket */
619
721
  FirstTradePayload: {
620
722
  /** @description Limit-order maker wallet address (lowercase) */
@@ -686,7 +788,10 @@ export interface components {
686
788
  trader?: string | null;
687
789
  /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
688
790
  timeframe: string;
689
- /** Format: double */
791
+ /**
792
+ * Format: double
793
+ * @description Realized PnL for the timeframe (matches REST `/pnl/global`).
794
+ */
690
795
  realized_pnl_usd?: number | null;
691
796
  /** Format: int64 */
692
797
  events_traded?: number | null;
@@ -700,6 +805,8 @@ export interface components {
700
805
  total_redemptions?: number | null;
701
806
  /** Format: int64 */
702
807
  total_merges?: number | null;
808
+ /** Format: int64 */
809
+ total_splits?: number | null;
703
810
  /** Format: double */
704
811
  total_volume_usd?: number | null;
705
812
  /** Format: double */
@@ -710,6 +817,26 @@ export interface components {
710
817
  redemption_volume_usd?: number | null;
711
818
  /** Format: double */
712
819
  merge_volume_usd?: number | null;
820
+ /** Format: double */
821
+ convert_collateral_usd?: number | null;
822
+ /** Format: double */
823
+ split_volume_usd?: number | null;
824
+ /** Format: int64 */
825
+ maker_rebate_count?: number | null;
826
+ /** Format: double */
827
+ maker_rebate_usd?: number | null;
828
+ /** Format: int64 */
829
+ reward_count?: number | null;
830
+ /** Format: double */
831
+ reward_usd?: number | null;
832
+ /** Format: int64 */
833
+ yield_count?: number | null;
834
+ /** Format: double */
835
+ yield_usd?: number | null;
836
+ /** Format: int64 */
837
+ total_credit_count?: number | null;
838
+ /** Format: double */
839
+ total_credit_usd?: number | null;
713
840
  /** Format: int64 */
714
841
  markets_won?: number | null;
715
842
  /** Format: int64 */
@@ -717,9 +844,15 @@ export interface components {
717
844
  /** Format: double */
718
845
  market_win_rate_pct?: number | null;
719
846
  /** Format: double */
720
- avg_pnl_per_market?: number | null;
847
+ total_wins_usd?: number | null;
721
848
  /** Format: double */
722
- avg_pnl_per_trade?: number | null;
849
+ total_losses_usd?: number | null;
850
+ /** Format: double */
851
+ avg_win_usd?: number | null;
852
+ /** Format: double */
853
+ avg_loss_usd?: number | null;
854
+ /** Format: double */
855
+ profit_factor?: number | null;
723
856
  /** Format: double */
724
857
  avg_hold_time_seconds?: number | null;
725
858
  /** Format: double */
@@ -727,6 +860,9 @@ export interface components {
727
860
  /** Format: double */
728
861
  best_trade_pnl_usd?: number | null;
729
862
  best_trade_condition_id?: string | null;
863
+ /** Format: double */
864
+ worst_trade_pnl_usd?: number | null;
865
+ worst_trade_condition_id?: string | null;
730
866
  /** Format: int64 */
731
867
  first_trade_at?: number | null;
732
868
  /** Format: int64 */
@@ -825,8 +961,13 @@ export interface components {
825
961
  trader?: string | null;
826
962
  condition_id?: string | null;
827
963
  event_slug?: string | null;
964
+ category?: string | null;
828
965
  /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
829
966
  timeframe: string;
967
+ /** Format: double */
968
+ realized_pnl_usd?: number | null;
969
+ /** Format: double */
970
+ current_shares_balance?: number | null;
830
971
  /** Format: int64 */
831
972
  outcomes_traded?: number | null;
832
973
  /** Format: int64 */
@@ -837,6 +978,8 @@ export interface components {
837
978
  total_redemptions?: number | null;
838
979
  /** Format: int64 */
839
980
  total_merges?: number | null;
981
+ /** Format: int64 */
982
+ total_splits?: number | null;
840
983
  /** Format: double */
841
984
  buy_usd?: number | null;
842
985
  /** Format: double */
@@ -846,11 +989,13 @@ export interface components {
846
989
  /** Format: double */
847
990
  merge_usd?: number | null;
848
991
  /** Format: double */
849
- realized_pnl_usd?: number | null;
850
- /** Format: int64 */
851
- winning_outcomes?: number | null;
992
+ convert_collateral_usd?: number | null;
993
+ /** Format: double */
994
+ split_volume_usd?: number | null;
852
995
  /** Format: double */
853
996
  total_fees?: number | null;
997
+ /** Format: double */
998
+ total_shares_bought?: number | null;
854
999
  /** Format: int64 */
855
1000
  first_trade_at?: number | null;
856
1001
  /** Format: int64 */
@@ -1187,7 +1332,7 @@ export interface components {
1187
1332
  */
1188
1333
  PnlFilterTimeframe: "1d" | "7d" | "30d" | "lifetime";
1189
1334
  /**
1190
- * @description PnL timeframe enum for webhook filtering
1335
+ * @description PnL timeframe enum for webhook filtering.
1191
1336
  * @enum {string}
1192
1337
  */
1193
1338
  PnlTimeframeFilter: "1d" | "7d" | "30d" | "lifetime";
@@ -1195,7 +1340,7 @@ export interface components {
1195
1340
  * @description Polymarket webhook event types
1196
1341
  * @enum {string}
1197
1342
  */
1198
- PolymarketWebhookEvent: "trader_first_trade" | "trader_new_market" | "trader_whale_trade" | "trader_new_trade" | "trader_trade_event" | "trader_global_pnl" | "trader_market_pnl" | "trader_event_pnl" | "trader_global_pnl_v3" | "trader_market_pnl_v3" | "trader_event_pnl_v3" | "trader_category_pnl_v3" | "trader_position_resolved_v3" | "trader_exit_markers_v3" | "position_holder_metrics_v3" | "condition_holder_metrics_v3" | "event_holder_metrics_v3" | "condition_metrics" | "event_metrics" | "tag_metrics" | "position_metrics" | "market_volume_milestone" | "event_volume_milestone" | "position_volume_milestone" | "probability_spike" | "market_volume_spike" | "event_volume_spike" | "position_volume_spike" | "close_to_bond" | "market_created" | "asset_price_tick" | "asset_price_window_update" | "price_spike" | "oracle_events";
1343
+ PolymarketWebhookEvent: "trader_first_trade" | "trader_new_market" | "trader_whale_trade" | "trader_new_trade" | "trader_trade_event" | "trader_global_pnl" | "trader_market_pnl" | "trader_category_pnl" | "trader_position_resolved" | "trader_exit_markers" | "position_holder_metrics" | "condition_holder_metrics" | "event_holder_metrics" | "condition_metrics" | "event_metrics" | "tag_metrics" | "position_metrics" | "market_volume_milestone" | "event_volume_milestone" | "position_volume_milestone" | "probability_spike" | "market_volume_spike" | "event_volume_spike" | "position_volume_spike" | "close_to_bond" | "market_created" | "asset_price_tick" | "asset_price_window_update" | "price_spike" | "oracle_events";
1199
1344
  /**
1200
1345
  * @description Polymarket-specific webhook filters
1201
1346
  *
@@ -1384,6 +1529,26 @@ export interface components {
1384
1529
  */
1385
1530
  oracle_event_types?: string[];
1386
1531
  };
1532
+ PositionHolderMetricsFilters: {
1533
+ position_ids?: string[];
1534
+ };
1535
+ PositionHolderMetricsPayload: {
1536
+ /** Format: int32 */
1537
+ ts: number;
1538
+ /** Format: int64 */
1539
+ block: number;
1540
+ position_id: string;
1541
+ /** Format: int32 */
1542
+ holder_count: number;
1543
+ /** Format: double */
1544
+ total_balance: number;
1545
+ /** Format: double */
1546
+ total_cost_basis: number;
1547
+ /** Format: int32 */
1548
+ condition_holder_count?: number | null;
1549
+ /** Format: int32 */
1550
+ event_holder_count?: number | null;
1551
+ };
1387
1552
  /** @description Subscription filters for the `position_metrics` event. All fields are optional. */
1388
1553
  PositionMetricsFilters: {
1389
1554
  /** @description Restrict to these outcome token IDs. */
@@ -1548,6 +1713,145 @@ export interface components {
1548
1713
  /** Format: double */
1549
1714
  avg_sell_shares?: number | null;
1550
1715
  };
1716
+ PositionResolvedPayload: {
1717
+ trader?: string;
1718
+ position_id?: string;
1719
+ condition_id?: string | null;
1720
+ event_slug?: string | null;
1721
+ /**
1722
+ * @description Market category slug (e.g. "politics", "sports") — mirror of
1723
+ * `PositionRollup.category_id` resolved against the rollup
1724
+ * interner. Surfaces on the `/trader/{addr}/positions` API and
1725
+ * enables direct category-filtered + sorted position lookups
1726
+ * without a cross-grain join.
1727
+ */
1728
+ category?: string | null;
1729
+ outcome?: string | null;
1730
+ /** Format: int32 */
1731
+ outcome_index?: number | null;
1732
+ /** Format: int64 */
1733
+ total_buys?: number;
1734
+ /** Format: int64 */
1735
+ total_sells?: number;
1736
+ /** Format: int64 */
1737
+ total_merges?: number;
1738
+ /** Format: int64 */
1739
+ total_splits?: number;
1740
+ /** Format: int32 */
1741
+ winning_outcome_index?: number | null;
1742
+ /** Format: double */
1743
+ total_shares_bought?: number;
1744
+ /** Format: double */
1745
+ total_shares_sold?: number;
1746
+ /** Format: double */
1747
+ buy_usd?: number;
1748
+ /** Format: double */
1749
+ sell_usd?: number;
1750
+ /** Format: double */
1751
+ avg_entry_price?: number;
1752
+ /** Format: double */
1753
+ total_fees?: number;
1754
+ /** Format: double */
1755
+ realized_pnl_usd?: number;
1756
+ /** Format: double */
1757
+ total_pnl_usd?: number;
1758
+ /** Format: double */
1759
+ unrealized_pnl_usd?: number;
1760
+ /** Format: double */
1761
+ redemption_usd?: number;
1762
+ open?: boolean;
1763
+ won?: boolean | null;
1764
+ /** Format: int64 */
1765
+ first_trade_at?: number | null;
1766
+ /** Format: int64 */
1767
+ last_trade_at?: number | null;
1768
+ /**
1769
+ * @description What kind of activity triggered this update. One or more of
1770
+ * `"trade"`, `"price"`, `"window"`, `"position_resolved"`.
1771
+ * Subscribers that only care about one kind filter on
1772
+ * `data.dirty_kinds` containing the value.
1773
+ */
1774
+ dirty_kinds?: components["schemas"]["DirtyKind"][];
1775
+ /**
1776
+ * Format: double
1777
+ * @description `realized_pnl_usd / (buy_usd + total_fees) * 100` for the
1778
+ * window. `0.0` when the trader has no cost basis on this row yet.
1779
+ */
1780
+ realized_pnl_pct?: number;
1781
+ /** Format: double */
1782
+ total_pnl_pct?: number;
1783
+ /** @description Market slug for the parent market of this outcome. */
1784
+ market_slug?: string | null;
1785
+ /** @description Market title. */
1786
+ title?: string | null;
1787
+ /** @description Market question. */
1788
+ question?: string | null;
1789
+ /** @description Market image URL. */
1790
+ image_url?: string | null;
1791
+ /**
1792
+ * Format: int32
1793
+ * @description NegRisk conversion count + share deltas for this position.
1794
+ */
1795
+ converted_count?: number;
1796
+ /** Format: double */
1797
+ converted_shares_gained?: number;
1798
+ /** Format: double */
1799
+ converted_shares_lost?: number;
1800
+ /**
1801
+ * Format: double
1802
+ * @description Aggregate buy/sell USD totals for this position across its
1803
+ * lifetime.
1804
+ */
1805
+ total_buy_usd?: number;
1806
+ /** Format: double */
1807
+ total_sell_usd?: number;
1808
+ /**
1809
+ * Format: double
1810
+ * @description Merge proceeds (Y+N → collateral).
1811
+ */
1812
+ merge_usd?: number;
1813
+ /**
1814
+ * Format: double
1815
+ * @description Sell-side average price.
1816
+ */
1817
+ avg_exit_price?: number | null;
1818
+ /**
1819
+ * Format: double
1820
+ * @description Volume-weighted average trade price across buys + sells.
1821
+ */
1822
+ avg_price?: number | null;
1823
+ /**
1824
+ * Format: double
1825
+ * @description Mark-to-market values from the latest price tick.
1826
+ */
1827
+ current_price?: number | null;
1828
+ /** Format: double */
1829
+ current_shares_balance?: number | null;
1830
+ /** Format: double */
1831
+ current_value?: number | null;
1832
+ /**
1833
+ * Format: double
1834
+ * @description Last on-chain trade price for the outcome token.
1835
+ */
1836
+ last_traded_price?: number | null;
1837
+ /**
1838
+ * Format: int64
1839
+ * @description Market resolution deadline as Unix seconds.
1840
+ */
1841
+ end_date?: number | null;
1842
+ /** @description NegRisk multi-outcome flag. */
1843
+ is_neg_risk?: boolean | null;
1844
+ /**
1845
+ * @description `true` when the market is resolved AND the trader still holds
1846
+ * shares (redeem available).
1847
+ */
1848
+ redeemable?: boolean | null;
1849
+ /**
1850
+ * @description `true` when the market is NegRisk, unresolved, and the trader
1851
+ * holds shares (NegRisk-adapter merge available).
1852
+ */
1853
+ mergeable?: boolean | null;
1854
+ };
1551
1855
  /** @description Subscription filters for the `position_volume_milestone` event. */
1552
1856
  PositionVolumeMilestoneFilters: {
1553
1857
  /** @description **Required.** Aggregation windows to monitor. */
@@ -2202,51 +2506,63 @@ export interface components {
2202
2506
  * @enum {string}
2203
2507
  */
2204
2508
  TradeEventFilterType: "OrderFilled" | "OrdersMatched" | "MakerRebate" | "Reward" | "Yield" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken";
2205
- /** @description Subscription filters for the `trader_event_pnl` event. All fields are optional. */
2206
- TraderEventPnlFilters: {
2207
- /** @description Track only these trader wallet addresses. */
2509
+ /** @description Subscription filters for the `trader_category_pnl` event. All fields are optional. */
2510
+ TraderCategoryPnlFilters: {
2511
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
2208
2512
  traders?: string[] | null;
2209
- /** @description Restrict to these events. */
2210
- event_slugs?: string[] | null;
2513
+ /** @description Restrict to these market categories (e.g. `politics`, `sports`). */
2514
+ categories?: string[] | null;
2211
2515
  /**
2212
2516
  * Format: double
2213
- * @description Only fire when per-event realized PnL ≥ this value (USD).
2517
+ * @description Only fire when per-category realized PnL ≥ this value (USD). Use negative values for loss thresholds.
2214
2518
  */
2215
2519
  min_realized_pnl_usd?: number | null;
2216
2520
  /**
2217
2521
  * Format: double
2218
- * @description Only fire when per-event realized PnL ≤ this value (USD).
2522
+ * @description Only fire when per-category realized PnL ≤ this value (USD).
2219
2523
  */
2220
2524
  max_realized_pnl_usd?: number | null;
2221
2525
  /**
2222
2526
  * Format: double
2223
- * @description Only fire when total event volume ≥ this value (USD).
2527
+ * @description Only fire when total category volume ≥ this value (USD).
2224
2528
  */
2225
2529
  min_volume_usd?: number | null;
2226
2530
  /**
2227
2531
  * Format: double
2228
- * @description Only fire when total event volume ≤ this value (USD).
2532
+ * @description Only fire when total category volume ≤ this value (USD).
2229
2533
  */
2230
2534
  max_volume_usd?: number | null;
2231
2535
  /**
2232
2536
  * Format: double
2233
- * @description Only fire when buy volume within the event ≥ this value (USD).
2537
+ * @description Only fire when buy volume within the category ≥ this value (USD).
2234
2538
  */
2235
2539
  min_buy_usd?: number | null;
2236
2540
  /**
2237
2541
  * Format: double
2238
- * @description Only fire when sell volume within the event ≥ this value (USD).
2542
+ * @description Only fire when sell volume within the category ≥ this value (USD).
2239
2543
  */
2240
2544
  min_sell_volume_usd?: number | null;
2545
+ /**
2546
+ * Format: double
2547
+ * @description Only fire when market win rate ≥ this percentage (0.0–100.0).
2548
+ */
2549
+ min_win_rate?: number | null;
2241
2550
  /**
2242
2551
  * Format: int64
2243
- * @description Only fire when the trader has traded in ≥ this many markets within the event.
2552
+ * @description Only fire when the trader has traded in ≥ this many markets within the category.
2244
2553
  */
2245
2554
  min_markets_traded?: number | null;
2246
- /** @description Restrict to these PnL windows. */
2555
+ /** @description Restrict to these PnL windows. Empty = all windows. */
2247
2556
  timeframes?: components["schemas"]["PnlFilterTimeframe"][] | null;
2248
- /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
2249
- exclude_shortterm_markets?: boolean | null;
2557
+ };
2558
+ /** @description Subscription filters for the `trader_pnl_exits` event. All fields are optional. */
2559
+ TraderExitMarkersFilters: {
2560
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
2561
+ traders?: string[] | null;
2562
+ /** @description Restrict to these markets. */
2563
+ condition_ids?: string[] | null;
2564
+ /** @description Restrict to positions in these events. */
2565
+ event_slugs?: string[] | null;
2250
2566
  };
2251
2567
  /** @description Subscription filters for the `trader_first_trade` event. All fields are optional. */
2252
2568
  TraderFirstTradeFilters: {
@@ -2418,6 +2734,19 @@ export interface components {
2418
2734
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
2419
2735
  exclude_shortterm_markets?: boolean | null;
2420
2736
  };
2737
+ /** @description Subscription filters for the `trader_position_resolved` event. All fields are optional. */
2738
+ TraderPositionResolvedFilters: {
2739
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
2740
+ traders?: string[] | null;
2741
+ /** @description Restrict to these markets. */
2742
+ condition_ids?: string[] | null;
2743
+ /** @description Restrict to positions in these events. */
2744
+ event_slugs?: string[] | null;
2745
+ /** @description Restrict to these outcome indexes within the resolved market. */
2746
+ outcome_indexes?: number[] | null;
2747
+ /** @description Only fire for won (`true`) or lost (`false`) positions. Omit to receive both. */
2748
+ won_only?: boolean | null;
2749
+ };
2421
2750
  /**
2422
2751
  * @description Subscription filters for the `trader_trade_event` event. All fields are optional.
2423
2752
  * `event_slugs` and `exclude_shortterm_markets` require explicit `trade_types` that
@@ -2927,7 +3256,7 @@ export interface components {
2927
3256
  /** @description Non-null when the subscribe was rejected. */
2928
3257
  error?: string | null;
2929
3258
  };
2930
- /** @description List-API-shaped filter evaluated in-memory against changed rows. `status` is NOT accepted — the cache only holds open markets. */
3259
+ /** @description List-API-shaped filter applied to changed rows. `status` is NOT accepted — only open markets are streamed. */
2931
3260
  MarketsStreamFilter: {
2932
3261
  /** @description Case-insensitive substring match on `title`. 3–100 chars. */
2933
3262
  search?: string;
@@ -3619,16 +3948,18 @@ export interface components {
3619
3948
  action: "subscribe" | "unsubscribe_all";
3620
3949
  /** @description EVM wallet addresses */
3621
3950
  traders: string[];
3622
- /** @description Restrict pushed updates to this subset of PnL granularities. Empty/omitted = all three. Unknown values reject the subscription. */
3623
- update_types?: ("global" | "market" | "event")[];
3624
- /** @description Restrict pushed updates to these aggregation timeframes. Empty/omitted = all four. Unknown values reject the subscription. */
3951
+ /** @description Restrict pushed updates to this subset of PnL granularities. Empty/omitted = all four. Unknown values reject the subscription. */
3952
+ update_types?: ("global" | "market" | "category")[];
3953
+ /** @description Restrict pushed updates to these aggregation timeframes. Empty/omitted = all four. Unknown values reject the subscription. Ignored by window-agnostic tick / resolution events. */
3625
3954
  timeframes?: ("1d" | "7d" | "30d" | "lifetime")[];
3955
+ /** @description Restrict pushed updates to events whose `dirty_kinds` intersects this set. Empty/omitted or `["all"]` = every kind. Unknown values reject the subscription. */
3956
+ dirty_kinds?: ("trade" | "price" | "window" | "market_resolved" | "all")[];
3626
3957
  };
3627
3958
  /** @description Server acknowledgement for a trader PnL subscription. Echoes the accepted (normalized) filter sets so clients can confirm the active subscription. */
3628
3959
  TraderPnlSubscribeResponse: {
3629
3960
  traders?: string[];
3630
3961
  /** @description Accepted update types. Empty = all. */
3631
- update_types?: ("global" | "market" | "event")[];
3962
+ update_types?: ("global" | "market" | "category")[];
3632
3963
  /** @description Accepted timeframes. Empty = all. */
3633
3964
  timeframes?: ("1d" | "7d" | "30d" | "lifetime")[];
3634
3965
  /** @description Trader addresses that were rejected (invalid EVM format). */
@@ -3636,43 +3967,62 @@ export interface components {
3636
3967
  /** @description Set if the entire subscription was rejected (e.g. empty traders, or an invalid update_type / timeframe value). */
3637
3968
  error?: string | null;
3638
3969
  };
3639
- /** @description Server-pushed event: global (portfolio-level) PnL update for a trader. Envelope type: "trader_global_pnl_update". */
3640
- TraderGlobalPnlEvent: {
3970
+ /** @description One global (portfolio-level) PnL row inside a `trader_global_pnl_batch` envelope's `data` array. */
3971
+ TraderGlobalPnlRow: {
3641
3972
  /** @description Trader EVM wallet address */
3642
3973
  trader: string;
3643
- /** @description Total realized PnL in USD (decimal string) */
3644
- realized_pnl_usd: string;
3974
+ dirty_kinds?: ("trade" | "price" | "window" | "market_resolved")[];
3975
+ /** @description "1d", "7d", "30d", or "lifetime" */
3976
+ timeframe?: string | null;
3977
+ /** @description Realized PnL for the timeframe */
3978
+ realized_pnl_usd: number;
3645
3979
  /** Format: int64 */
3646
- events_traded?: number | null;
3980
+ events_traded?: number;
3647
3981
  /** Format: int64 */
3648
- markets_traded?: number | null;
3982
+ markets_traded?: number;
3649
3983
  /** Format: int64 */
3650
- total_buys?: number | null;
3984
+ total_buys?: number;
3651
3985
  /** Format: int64 */
3652
- total_sells?: number | null;
3986
+ total_sells?: number;
3653
3987
  /** Format: int64 */
3654
- total_redemptions?: number | null;
3988
+ total_redemptions?: number;
3655
3989
  /** Format: int64 */
3656
- total_merges?: number | null;
3657
- /** @description Total USD volume (decimal string) */
3658
- total_volume_usd: string;
3659
- buy_volume_usd: string;
3660
- sell_volume_usd: string;
3661
- redemption_volume_usd: string;
3662
- merge_volume_usd: string;
3990
+ total_merges?: number;
3663
3991
  /** Format: int64 */
3664
- markets_won?: number | null;
3992
+ total_splits?: number;
3993
+ total_volume_usd?: number;
3994
+ buy_volume_usd?: number;
3995
+ sell_volume_usd?: number;
3996
+ redemption_volume_usd?: number;
3997
+ merge_volume_usd?: number;
3998
+ split_volume_usd?: number;
3665
3999
  /** Format: int64 */
3666
- markets_lost?: number | null;
3667
- /** @description Win rate percentage (decimal string) */
3668
- market_win_rate_pct: string;
3669
- avg_pnl_per_market: string;
3670
- avg_pnl_per_trade: string;
3671
- avg_hold_time_seconds: string;
3672
- total_fees: string;
3673
- best_trade_pnl_usd: string;
4000
+ maker_rebate_count?: number;
4001
+ maker_rebate_usd?: number;
4002
+ /** Format: int64 */
4003
+ reward_count?: number;
4004
+ reward_usd?: number;
4005
+ /** Format: int64 */
4006
+ yield_count?: number;
4007
+ yield_usd?: number;
4008
+ /** Format: int64 */
4009
+ total_credit_count?: number;
4010
+ total_credit_usd?: number;
4011
+ /** Format: int64 */
4012
+ markets_won?: number;
4013
+ /** Format: int64 */
4014
+ markets_lost?: number;
4015
+ market_win_rate_pct?: number;
4016
+ total_wins_usd?: number;
4017
+ total_losses_usd?: number;
4018
+ avg_win_usd?: number | null;
4019
+ avg_loss_usd?: number | null;
4020
+ profit_factor?: number | null;
4021
+ avg_hold_time_seconds?: number;
4022
+ total_fees?: number;
4023
+ best_trade_pnl_usd?: number | null;
3674
4024
  best_trade_condition_id?: string | null;
3675
- worst_trade_pnl_usd: string;
4025
+ worst_trade_pnl_usd?: number | null;
3676
4026
  worst_trade_condition_id?: string | null;
3677
4027
  /**
3678
4028
  * Format: int64
@@ -3684,37 +4034,38 @@ export interface components {
3684
4034
  * @description Unix seconds
3685
4035
  */
3686
4036
  last_trade_at?: number | null;
3687
- /** Format: int64 */
3688
- timestamp?: number | null;
3689
- /** @description "1d", "7d", "30d", or "lifetime" */
3690
- timeframe?: string | null;
3691
4037
  };
3692
- /** @description Server-pushed event: per-market PnL update for a trader. Envelope type: "trader_market_pnl_update". */
3693
- TraderMarketPnlEvent: {
4038
+ /** @description One per-market PnL row inside a `trader_market_pnl_batch` envelope's `data` array. */
4039
+ TraderMarketPnlRow: {
3694
4040
  trader: string;
4041
+ dirty_kinds?: ("trade" | "price" | "window" | "market_resolved")[];
4042
+ /** @description "1d", "7d", "30d", or "lifetime" */
4043
+ timeframe?: string | null;
3695
4044
  /** @description 64-char hex condition ID */
3696
4045
  condition_id: string;
4046
+ realized_pnl_usd?: number;
4047
+ current_shares_balance?: number;
4048
+ category?: string | null;
3697
4049
  event_slug?: string | null;
3698
4050
  /** Format: int64 */
3699
- outcomes_traded?: number | null;
4051
+ outcomes_traded?: number;
3700
4052
  /** Format: int64 */
3701
- total_buys?: number | null;
4053
+ total_buys?: number;
3702
4054
  /** Format: int64 */
3703
- total_sells?: number | null;
4055
+ total_sells?: number;
3704
4056
  /** Format: int64 */
3705
- total_redemptions?: number | null;
4057
+ total_redemptions?: number;
3706
4058
  /** Format: int64 */
3707
- total_merges?: number | null;
3708
- /** @description Total buy volume in USD (decimal string) */
3709
- buy_usd: string;
3710
- sell_usd: string;
3711
- redemption_usd: string;
3712
- merge_usd: string;
3713
- /** @description Realized PnL in USD (decimal string) */
3714
- realized_pnl_usd: string;
4059
+ total_merges?: number;
3715
4060
  /** Format: int64 */
3716
- winning_outcomes?: number | null;
3717
- total_fees: string;
4061
+ total_splits?: number;
4062
+ buy_usd?: number;
4063
+ sell_usd?: number;
4064
+ redemption_usd?: number;
4065
+ merge_usd?: number;
4066
+ split_volume_usd?: number;
4067
+ total_fees?: number;
4068
+ total_shares_bought?: number;
3718
4069
  /**
3719
4070
  * Format: int64
3720
4071
  * @description Unix seconds
@@ -3725,114 +4076,540 @@ export interface components {
3725
4076
  * @description Unix seconds
3726
4077
  */
3727
4078
  last_trade_at?: number | null;
3728
- /** Format: int64 */
3729
- timestamp?: number | null;
4079
+ };
4080
+ /** @description One per-category PnL row inside a `trader_category_pnl_batch` envelope's `data` array. */
4081
+ TraderCategoryPnlRow: {
4082
+ trader: string;
4083
+ dirty_kinds?: ("trade" | "price" | "window" | "market_resolved")[];
3730
4084
  /** @description "1d", "7d", "30d", or "lifetime" */
3731
4085
  timeframe?: string | null;
4086
+ category: string;
4087
+ realized_pnl_usd?: number;
4088
+ /** Format: int64 */
4089
+ markets_in_category?: number;
4090
+ /** Format: int64 */
4091
+ markets_traded?: number;
4092
+ /** Format: int64 */
4093
+ outcomes_traded?: number;
4094
+ /** Format: int64 */
4095
+ total_buys?: number;
4096
+ /** Format: int64 */
4097
+ total_sells?: number;
4098
+ /** Format: int64 */
4099
+ total_redemptions?: number;
4100
+ /** Format: int64 */
4101
+ total_merges?: number;
4102
+ /** Format: int64 */
4103
+ total_splits?: number;
4104
+ total_volume_usd?: number;
4105
+ buy_usd?: number;
4106
+ sell_usd?: number;
4107
+ redemption_usd?: number;
4108
+ merge_usd?: number;
4109
+ split_volume_usd?: number;
4110
+ total_fees?: number;
4111
+ total_shares_bought?: number;
4112
+ /** Format: int64 */
4113
+ markets_won?: number;
4114
+ /** Format: int64 */
4115
+ markets_lost?: number;
4116
+ market_win_rate_pct?: number;
4117
+ avg_hold_time_seconds?: number;
4118
+ best_trade_pnl_usd?: number | null;
4119
+ best_trade_condition_id?: string | null;
4120
+ worst_trade_pnl_usd?: number | null;
4121
+ worst_trade_condition_id?: string | null;
4122
+ total_wins_usd?: number;
4123
+ total_losses_usd?: number;
4124
+ avg_win_usd?: number | null;
4125
+ avg_loss_usd?: number | null;
4126
+ profit_factor?: number | null;
4127
+ /**
4128
+ * Format: int64
4129
+ * @description Unix seconds
4130
+ */
4131
+ first_trade_at?: number | null;
4132
+ /**
4133
+ * Format: int64
4134
+ * @description Unix seconds
4135
+ */
4136
+ last_trade_at?: number | null;
3732
4137
  };
3733
- /** @description Server-pushed event: per-event PnL update for a trader. Envelope type: "trader_event_pnl_update". */
3734
- TraderEventPnlEvent: {
4138
+ /** @description Row carried by `trader_global_tick_batch` (price-only trader aggregate). */
4139
+ TraderGlobalTickRow: {
3735
4140
  trader: string;
3736
- event_slug: string;
4141
+ realized_pnl_usd?: number;
4142
+ open_positions_value?: number;
3737
4143
  /** Format: int64 */
3738
- markets_traded?: number | null;
4144
+ last_block?: number;
4145
+ /**
4146
+ * Format: int64
4147
+ * @description Unix seconds
4148
+ */
4149
+ last_trade_at?: number | null;
4150
+ dirty_kinds?: "price"[];
4151
+ };
4152
+ /** @description Row carried by `trader_market_tick_batch` (price-only per-market). */
4153
+ TraderMarketTickRow: {
4154
+ trader: string;
4155
+ condition_id: string;
4156
+ realized_pnl_usd?: number;
3739
4157
  /** Format: int64 */
3740
- outcomes_traded?: number | null;
4158
+ last_block?: number;
4159
+ /**
4160
+ * Format: int64
4161
+ * @description Unix seconds
4162
+ */
4163
+ last_trade_at?: number | null;
4164
+ dirty_kinds?: "price"[];
4165
+ };
4166
+ /** @description Row carried by `trader_category_tick_batch` (price-only per-category). */
4167
+ TraderCategoryTickRow: {
4168
+ trader: string;
4169
+ category: string;
4170
+ realized_pnl_usd?: number;
3741
4171
  /** Format: int64 */
3742
- total_buys?: number | null;
4172
+ last_block?: number;
4173
+ /**
4174
+ * Format: int64
4175
+ * @description Unix seconds
4176
+ */
4177
+ last_trade_at?: number | null;
4178
+ dirty_kinds?: "price"[];
4179
+ };
4180
+ /** @description Row carried by `trader_global_resolution_batch` (trader-aggregate resolution). */
4181
+ TraderGlobalResolutionRow: {
4182
+ trader: string;
4183
+ realized_pnl_usd?: number;
3743
4184
  /** Format: int64 */
3744
- total_sells?: number | null;
4185
+ markets_won?: number;
3745
4186
  /** Format: int64 */
3746
- total_redemptions?: number | null;
4187
+ markets_lost?: number;
3747
4188
  /** Format: int64 */
3748
- total_merges?: number | null;
3749
- /** @description Total USD volume (decimal string) */
3750
- total_volume_usd: string;
3751
- buy_usd: string;
3752
- sell_usd: string;
3753
- redemption_usd: string;
3754
- merge_usd: string;
3755
- /** @description Realized PnL in USD (decimal string) */
3756
- realized_pnl_usd: string;
4189
+ markets_resolved?: number;
4190
+ total_wins_usd_lifetime?: number;
4191
+ total_losses_usd_lifetime?: number;
3757
4192
  /** Format: int64 */
3758
- winning_markets?: number | null;
4193
+ last_block?: number;
4194
+ /**
4195
+ * Format: int64
4196
+ * @description Unix seconds
4197
+ */
4198
+ last_trade_at?: number | null;
4199
+ dirty_kinds?: "market_resolved"[];
4200
+ };
4201
+ /** @description Row carried by `trader_market_resolution_batch` (per-market resolution). */
4202
+ TraderMarketResolutionRow: {
4203
+ trader: string;
4204
+ condition_id: string;
4205
+ resolved?: boolean;
4206
+ won?: boolean | null;
4207
+ realized_pnl_usd?: number;
3759
4208
  /** Format: int64 */
3760
- losing_markets?: number | null;
3761
- total_fees: string;
4209
+ last_block?: number;
3762
4210
  /**
3763
4211
  * Format: int64
3764
4212
  * @description Unix seconds
3765
4213
  */
3766
- first_trade_at?: number | null;
4214
+ last_trade_at?: number | null;
4215
+ dirty_kinds?: "market_resolved"[];
4216
+ };
4217
+ /** @description Row carried by `trader_category_resolution_batch` (per-category resolution). */
4218
+ TraderCategoryResolutionRow: {
4219
+ trader: string;
4220
+ category: string;
4221
+ realized_pnl_usd?: number;
4222
+ /** Format: int64 */
4223
+ markets_won?: number;
4224
+ /** Format: int64 */
4225
+ markets_lost?: number;
4226
+ total_wins_usd_lifetime?: number;
4227
+ total_losses_usd_lifetime?: number;
4228
+ /** Format: int64 */
4229
+ last_block?: number;
3767
4230
  /**
3768
4231
  * Format: int64
3769
4232
  * @description Unix seconds
3770
4233
  */
3771
4234
  last_trade_at?: number | null;
4235
+ dirty_kinds?: "market_resolved"[];
4236
+ };
4237
+ /** @description Server-pushed per-block batch. Envelope type: `trader_global_pnl_batch`. `data` carries every matching row from the block. */
4238
+ TraderGlobalPnlBatchEvent: {
4239
+ /** @enum {string} */
4240
+ type: "trader_global_pnl_batch";
4241
+ /** @enum {string} */
4242
+ room_id: "polymarket_trader_pnl";
3772
4243
  /** Format: int64 */
3773
- timestamp?: number | null;
4244
+ block: number;
4245
+ /** @description "1d", "7d", "30d", or "lifetime" */
4246
+ timeframe?: string | null;
4247
+ data: components["schemas"]["TraderGlobalPnlRow"][];
4248
+ };
4249
+ /** @description Server-pushed per-block batch. Envelope type: `trader_market_pnl_batch`. `data` carries every matching row from the block. */
4250
+ TraderMarketPnlBatchEvent: {
4251
+ /** @enum {string} */
4252
+ type: "trader_market_pnl_batch";
4253
+ /** @enum {string} */
4254
+ room_id: "polymarket_trader_pnl";
4255
+ /** Format: int64 */
4256
+ block: number;
4257
+ /** @description "1d", "7d", "30d", or "lifetime" */
4258
+ timeframe?: string | null;
4259
+ data: components["schemas"]["TraderMarketPnlRow"][];
4260
+ };
4261
+ /** @description Server-pushed per-block batch. Envelope type: `trader_category_pnl_batch`. `data` carries every matching row from the block. */
4262
+ TraderCategoryPnlBatchEvent: {
4263
+ /** @enum {string} */
4264
+ type: "trader_category_pnl_batch";
4265
+ /** @enum {string} */
4266
+ room_id: "polymarket_trader_pnl";
4267
+ /** Format: int64 */
4268
+ block: number;
3774
4269
  /** @description "1d", "7d", "30d", or "lifetime" */
3775
4270
  timeframe?: string | null;
4271
+ data: components["schemas"]["TraderCategoryPnlRow"][];
4272
+ };
4273
+ /** @description Server-pushed per-block batch. Envelope type: `trader_global_tick_batch`. `data` carries every matching row from the block. */
4274
+ TraderGlobalTickBatchEvent: {
4275
+ /** @enum {string} */
4276
+ type: "trader_global_tick_batch";
4277
+ /** @enum {string} */
4278
+ room_id: "polymarket_trader_pnl";
4279
+ /** Format: int64 */
4280
+ block: number;
4281
+ data: components["schemas"]["TraderGlobalTickRow"][];
4282
+ };
4283
+ /** @description Server-pushed per-block batch. Envelope type: `trader_market_tick_batch`. `data` carries every matching row from the block. */
4284
+ TraderMarketTickBatchEvent: {
4285
+ /** @enum {string} */
4286
+ type: "trader_market_tick_batch";
4287
+ /** @enum {string} */
4288
+ room_id: "polymarket_trader_pnl";
4289
+ /** Format: int64 */
4290
+ block: number;
4291
+ data: components["schemas"]["TraderMarketTickRow"][];
4292
+ };
4293
+ /** @description Server-pushed per-block batch. Envelope type: `trader_category_tick_batch`. `data` carries every matching row from the block. */
4294
+ TraderCategoryTickBatchEvent: {
4295
+ /** @enum {string} */
4296
+ type: "trader_category_tick_batch";
4297
+ /** @enum {string} */
4298
+ room_id: "polymarket_trader_pnl";
4299
+ /** Format: int64 */
4300
+ block: number;
4301
+ data: components["schemas"]["TraderCategoryTickRow"][];
3776
4302
  };
3777
- /** @description Subscribe to the trader positions stream. traders is required and must be non-empty. */
4303
+ /** @description Server-pushed per-block batch. Envelope type: `trader_global_resolution_batch`. `data` carries every matching row from the block. */
4304
+ TraderGlobalResolutionBatchEvent: {
4305
+ /** @enum {string} */
4306
+ type: "trader_global_resolution_batch";
4307
+ /** @enum {string} */
4308
+ room_id: "polymarket_trader_pnl";
4309
+ /** Format: int64 */
4310
+ block: number;
4311
+ data: components["schemas"]["TraderGlobalResolutionRow"][];
4312
+ };
4313
+ /** @description Server-pushed per-block batch. Envelope type: `trader_market_resolution_batch`. `data` carries every matching row from the block. */
4314
+ TraderMarketResolutionBatchEvent: {
4315
+ /** @enum {string} */
4316
+ type: "trader_market_resolution_batch";
4317
+ /** @enum {string} */
4318
+ room_id: "polymarket_trader_pnl";
4319
+ /** Format: int64 */
4320
+ block: number;
4321
+ data: components["schemas"]["TraderMarketResolutionRow"][];
4322
+ };
4323
+ /** @description Server-pushed per-block batch. Envelope type: `trader_category_resolution_batch`. `data` carries every matching row from the block. */
4324
+ TraderCategoryResolutionBatchEvent: {
4325
+ /** @enum {string} */
4326
+ type: "trader_category_resolution_batch";
4327
+ /** @enum {string} */
4328
+ room_id: "polymarket_trader_pnl";
4329
+ /** Format: int64 */
4330
+ block: number;
4331
+ data: components["schemas"]["TraderCategoryResolutionRow"][];
4332
+ };
4333
+ /** @description Subscribe to the trader positions stream. `traders` is required and must be non-empty. `dirty_kinds` is an optional narrowing filter — empty/omitted or `["all"]` = receive every kind of update. */
3778
4334
  TraderPositionsSubscribeMessage: {
3779
4335
  /** @enum {string} */
3780
4336
  action: "subscribe" | "unsubscribe_all";
3781
4337
  /** @description EVM wallet addresses */
3782
4338
  traders: string[];
4339
+ /** @description Restrict pushed updates to this subset of update kinds. Omit, leave empty, or pass `["all"]` to accept every kind (the default). Unknown values reject the subscription. */
4340
+ dirty_kinds?: ("trade" | "price" | "position_resolved" | "all")[];
3783
4341
  };
3784
- /** @description Server acknowledgement for a trader positions subscription */
4342
+ /** @description Server acknowledgement for a trader positions subscription. */
3785
4343
  TraderPositionsSubscribeResponse: {
3786
4344
  traders?: string[];
4345
+ /** @description Echoed accepted dirty_kinds filter. Empty = all. */
4346
+ dirty_kinds?: ("trade" | "price" | "position_resolved")[];
3787
4347
  rejected?: string[];
3788
4348
  error?: string | null;
3789
4349
  };
3790
- /** @description Server-pushed event: full position snapshot for a tracked trader. Envelope type: "trader_position_update". Pushed whenever a position's PnL changes. */
3791
- TraderPositionUpdateEvent: {
3792
- /** @description Trader EVM wallet address */
3793
- trader: string;
4350
+ /** @description One position-update row inside a `trader_position_batch` envelope's `data` array. */
4351
+ TraderPositionRow: {
3794
4352
  /** @description ERC-1155 token ID (decimal string) */
3795
4353
  position_id?: string | null;
3796
4354
  condition_id?: string | null;
3797
4355
  market_slug?: string | null;
3798
4356
  event_slug?: string | null;
3799
- /** @description Market title / question */
3800
4357
  title?: string | null;
4358
+ question?: string | null;
3801
4359
  image_url?: string | null;
3802
4360
  /** @description Outcome name (e.g. "Yes") */
3803
4361
  outcome?: string | null;
3804
4362
  outcome_index?: number | null;
3805
- /** @description True if this outcome resolved as winner */
4363
+ open?: boolean | null;
4364
+ /** @description Resolution outcome — present once the market resolved */
3806
4365
  won?: boolean | null;
3807
4366
  /** Format: int64 */
3808
4367
  total_buys?: number | null;
3809
4368
  /** Format: int64 */
3810
4369
  total_sells?: number | null;
4370
+ /** Format: int64 */
4371
+ converted_count?: number | null;
4372
+ converted_shares_gained?: number | null;
4373
+ converted_shares_lost?: number | null;
3811
4374
  total_shares_bought?: number | null;
3812
4375
  total_shares_sold?: number | null;
3813
4376
  total_buy_usd?: number | null;
3814
4377
  total_sell_usd?: number | null;
3815
4378
  redemption_usd?: number | null;
3816
- /** @description Average entry price (0–1) */
4379
+ merge_usd?: number | null;
4380
+ /** @description 0–1 */
3817
4381
  avg_entry_price?: number | null;
3818
- /** @description Average exit price (0–1) */
3819
4382
  avg_exit_price?: number | null;
4383
+ /** @description Volume-weighted across buys + sells */
4384
+ avg_price?: number | null;
3820
4385
  realized_pnl_usd?: number | null;
4386
+ realized_pnl_pct?: number | null;
3821
4387
  total_fees?: number | null;
3822
4388
  /**
3823
4389
  * Format: int64
3824
- * @description Unix seconds
4390
+ * @description Unix milliseconds
3825
4391
  */
3826
4392
  first_trade_at?: number | null;
3827
4393
  /**
3828
4394
  * Format: int64
3829
- * @description Unix seconds
4395
+ * @description Unix milliseconds
3830
4396
  */
3831
4397
  last_trade_at?: number | null;
3832
- /** @description Current ERC-1155 token balance */
4398
+ /** @description Latest on-chain mark for the outcome token */
4399
+ current_price?: number | null;
3833
4400
  current_shares_balance?: number | null;
3834
- /** @description Realized PnL as a percentage of cost basis */
4401
+ /** @description current_price × current_shares_balance */
4402
+ current_value?: number | null;
4403
+ last_traded_price?: number | null;
4404
+ /**
4405
+ * Format: int64
4406
+ * @description Market resolution deadline (Unix seconds)
4407
+ */
4408
+ end_date?: number | null;
4409
+ /** @description True for multi-outcome NegRisk markets */
4410
+ is_neg_risk?: boolean | null;
4411
+ /** @description Market resolved AND trader still holds shares */
4412
+ redeemable?: boolean | null;
4413
+ /** @description NegRisk market, unresolved, trader holds shares */
4414
+ mergeable?: boolean | null;
4415
+ /** @description What kind of activity triggered this update. One or more of: `trade` (a buy, sell, merge, split, redemption, or NegRisk convert landed), `price` (outcome price moved), `position_resolved` (the position's market resolved on this update). */
4416
+ dirty_kinds?: ("trade" | "price" | "position_resolved")[];
4417
+ };
4418
+ /** @description Server-pushed per-block batch of position updates. Envelope type: `trader_position_batch`. Carries every row from the named block that matched the subscriber's filter. Empty batches are not sent. Each row's `dirty_kinds` field describes what triggered that row's update — including resolutions (`position_resolved`). */
4419
+ TraderPositionBatchEvent: {
4420
+ /** @enum {string} */
4421
+ type: "trader_position_batch";
4422
+ /** @enum {string} */
4423
+ room_id: "polymarket_trader_positions";
4424
+ /**
4425
+ * Format: int64
4426
+ * @description Block number these rows were computed at.
4427
+ */
4428
+ block: number;
4429
+ data: components["schemas"]["TraderPositionRow"][];
4430
+ };
4431
+ /** @description One price-tick row inside a `trader_position_price_batch` envelope's `data` array. */
4432
+ TraderPositionPriceRow: {
4433
+ trader?: string | null;
4434
+ /** @description ERC-1155 token ID (decimal string) */
4435
+ position_id?: string | null;
4436
+ condition_id?: string | null;
4437
+ /** @description Latest on-chain mark for the outcome token */
4438
+ current_price?: number | null;
4439
+ current_value?: number | null;
4440
+ realized_pnl_usd?: number | null;
4441
+ realized_pnl_pct?: number | null;
4442
+ /** Format: int64 */
4443
+ last_block?: number | null;
4444
+ /**
4445
+ * Format: int64
4446
+ * @description Unix milliseconds
4447
+ */
4448
+ last_trade_at?: number | null;
4449
+ dirty_kinds?: "price"[];
4450
+ };
4451
+ /** @description Server-pushed per-block batch of position price ticks (mark-to-market refreshes). Envelope type: `trader_position_price_batch`. */
4452
+ TraderPositionPriceBatchEvent: {
4453
+ /** @enum {string} */
4454
+ type: "trader_position_price_batch";
4455
+ /** @enum {string} */
4456
+ room_id: "polymarket_trader_positions";
4457
+ /** Format: int64 */
4458
+ block: number;
4459
+ data: components["schemas"]["TraderPositionPriceRow"][];
4460
+ };
4461
+ /** @description One resolution row inside a `trader_position_resolution_batch` envelope's `data` array. */
4462
+ TraderPositionResolutionRow: {
4463
+ trader?: string | null;
4464
+ /** @description ERC-1155 token ID (decimal string) */
4465
+ position_id?: string | null;
4466
+ condition_id?: string | null;
4467
+ resolved?: boolean | null;
4468
+ won?: boolean | null;
4469
+ realized_pnl_usd?: number | null;
3835
4470
  realized_pnl_pct?: number | null;
4471
+ /** Format: int64 */
4472
+ last_block?: number | null;
4473
+ /**
4474
+ * Format: int64
4475
+ * @description Unix milliseconds
4476
+ */
4477
+ last_trade_at?: number | null;
4478
+ dirty_kinds?: "position_resolved"[];
4479
+ };
4480
+ /** @description Server-pushed per-block batch of position resolutions. Envelope type: `trader_position_resolution_batch`. */
4481
+ TraderPositionResolutionBatchEvent: {
4482
+ /** @enum {string} */
4483
+ type: "trader_position_resolution_batch";
4484
+ /** @enum {string} */
4485
+ room_id: "polymarket_trader_positions";
4486
+ /** Format: int64 */
4487
+ block: number;
4488
+ data: components["schemas"]["TraderPositionResolutionRow"][];
4489
+ };
4490
+ /** @description Subscribe to the trader exit markers stream. `traders` is required and must be non-empty. `reasons` is an optional narrowing filter — empty/omitted or `["all"]` = receive every exit reason. */
4491
+ TraderExitMarkersSubscribeMessage: {
4492
+ /** @enum {string} */
4493
+ action: "subscribe" | "unsubscribe_all";
4494
+ /** @description EVM wallet addresses */
4495
+ traders: string[];
4496
+ /** @description Restrict pushed exits to this subset of reasons. Omit, leave empty, or pass `["all"]` to accept every reason (the default). Unknown values reject the subscription. */
4497
+ reasons?: ("resolved_win" | "resolved_loss" | "sold_win" | "sold_loss" | "all")[];
4498
+ };
4499
+ /** @description Server acknowledgement for a trader exit markers subscription. */
4500
+ TraderExitMarkersSubscribeResponse: {
4501
+ traders?: string[];
4502
+ /** @description Echoed accepted reasons filter. Empty = all. */
4503
+ reasons?: ("resolved_win" | "resolved_loss" | "sold_win" | "sold_loss")[];
4504
+ rejected?: string[];
4505
+ error?: string | null;
4506
+ };
4507
+ /** @description One exit row inside a `trader_exit_marker_batch` envelope's `data` array. */
4508
+ TraderExitMarkerRow: {
4509
+ /** @description EVM wallet address */
4510
+ trader?: string;
4511
+ /** @description ERC-1155 token ID (decimal string) */
4512
+ position_id?: string;
4513
+ condition_id?: string;
4514
+ event_slug?: string;
4515
+ market_slug?: string;
4516
+ title?: string;
4517
+ /** @description Full market question text */
4518
+ question?: string;
4519
+ image_url?: string;
4520
+ /** @description Outcome name (e.g. "Yes") */
4521
+ outcome?: string;
4522
+ outcome_index?: number | null;
4523
+ /** @description Realized PnL at exit, USD */
4524
+ pnl_usd?: number;
4525
+ /** @description Realized PnL at exit, percent */
4526
+ pnl_pct?: number;
4527
+ cost_basis_usd?: number;
4528
+ /**
4529
+ * @description Why the position closed: `resolved_*` held to market resolution (win/loss by verdict); `sold_*` closed before resolution (win/loss by realized PnL sign).
4530
+ * @enum {string}
4531
+ */
4532
+ reason?: "resolved_win" | "resolved_loss" | "sold_win" | "sold_loss";
4533
+ /**
4534
+ * Format: int64
4535
+ * @description Block the exit was recorded at
4536
+ */
4537
+ block?: number;
4538
+ /**
4539
+ * Format: int64
4540
+ * @description Exit time, Unix seconds
4541
+ */
4542
+ ts?: number;
4543
+ };
4544
+ /** @description Server-pushed per-block batch of position exits. Envelope type: `trader_exit_marker_batch`. Carries every exit from the named block that matched the subscriber's filter. Empty batches are not sent. */
4545
+ TraderExitMarkerBatchEvent: {
4546
+ /** @enum {string} */
4547
+ type: "trader_exit_marker_batch";
4548
+ /** @enum {string} */
4549
+ room_id: "polymarket_trader_pnl_exits";
4550
+ /**
4551
+ * Format: int64
4552
+ * @description Block number these exits were recorded at.
4553
+ */
4554
+ block: number;
4555
+ data: components["schemas"]["TraderExitMarkerRow"][];
4556
+ };
4557
+ /** @description Subscribe to holder metrics for explicit positions, conditions, or events. At least one identifier array must be non-empty. Omitted arrays receive no updates for that metric family. Up to 500 total identifiers are accepted. */
4558
+ HolderMetricsSubscribeMessage: {
4559
+ /** @enum {string} */
4560
+ action: "subscribe" | "unsubscribe_all";
4561
+ /** @description Position token IDs to receive position holder metrics for. */
4562
+ position_ids?: string[];
4563
+ /** @description Condition IDs to receive condition holder metrics for. */
4564
+ condition_ids?: string[];
4565
+ /** @description Event slugs to receive event holder metrics for. */
4566
+ event_slugs?: string[];
4567
+ };
4568
+ PositionHolderMetricsRow: {
4569
+ ts?: number;
4570
+ block?: number;
4571
+ position_id?: string;
4572
+ holder_count?: number;
4573
+ total_balance?: number;
4574
+ total_cost_basis?: number;
4575
+ condition_holder_count?: number | null;
4576
+ event_holder_count?: number | null;
4577
+ };
4578
+ ConditionHolderMetricsRow: {
4579
+ ts?: number;
4580
+ block?: number;
4581
+ condition_id?: string;
4582
+ holder_count?: number;
4583
+ };
4584
+ EventHolderMetricsRow: {
4585
+ ts?: number;
4586
+ block?: number;
4587
+ event_slug?: string;
4588
+ holder_count?: number;
4589
+ };
4590
+ HolderMetricsPositionBatchEvent: {
4591
+ /** @enum {string} */
4592
+ type: "holder_metrics_position_batch";
4593
+ /** @enum {string} */
4594
+ room_id: "polymarket_holder_metrics";
4595
+ block: number;
4596
+ data: components["schemas"]["PositionHolderMetricsRow"][];
4597
+ };
4598
+ HolderMetricsConditionBatchEvent: {
4599
+ /** @enum {string} */
4600
+ type: "holder_metrics_condition_batch";
4601
+ /** @enum {string} */
4602
+ room_id: "polymarket_holder_metrics";
4603
+ block: number;
4604
+ data: components["schemas"]["ConditionHolderMetricsRow"][];
4605
+ };
4606
+ HolderMetricsEventBatchEvent: {
4607
+ /** @enum {string} */
4608
+ type: "holder_metrics_event_batch";
4609
+ /** @enum {string} */
4610
+ room_id: "polymarket_holder_metrics";
4611
+ block: number;
4612
+ data: components["schemas"]["EventHolderMetricsRow"][];
3836
4613
  };
3837
4614
  /** @description Subscribe to the accounts stream. `wallets` is required. Share balance updates (`accounts_update`) are always delivered. Set `include_usdce`, `include_pusd`, or `include_matic` to also receive those balance streams. */
3838
4615
  AccountsSubscribeMessage: {
@@ -4062,7 +4839,7 @@ export interface components {
4062
4839
  /** @description Ids mode: event ids to watch. Combined with `event_slugs` up to 500 total. */
4063
4840
  event_ids?: string[];
4064
4841
  };
4065
- /** @description List-API-shaped filter evaluated in-memory against changed rows. `status` is NOT an accepted field — the cache only holds open events. */
4842
+ /** @description List-API-shaped filter applied to changed rows. `status` is NOT an accepted field — only open events are streamed. */
4066
4843
  EventsStreamFilter: {
4067
4844
  /** @description Case-insensitive substring match on `title`. 3–100 chars. */
4068
4845
  search?: string;