@structbuild/sdk 0.5.11 → 0.6.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.
@@ -248,7 +248,7 @@ export interface webhooks {
248
248
  put?: never;
249
249
  /**
250
250
  * Global PnL callback
251
- * @description Fired when a trader's global PnL crosses a configured threshold
251
+ * @description Fired when a trader's global PnL crosses a configured threshold
252
252
  */
253
253
  post: operations["trader-global-pnl"];
254
254
  delete?: never;
@@ -268,7 +268,7 @@ export interface webhooks {
268
268
  put?: never;
269
269
  /**
270
270
  * Market PnL callback
271
- * @description Fired when a trader's market-level PnL crosses a configured threshold
271
+ * @description Fired when a trader's market-level PnL crosses a configured threshold
272
272
  */
273
273
  post: operations["trader-market-pnl"];
274
274
  delete?: never;
@@ -277,7 +277,7 @@ export interface webhooks {
277
277
  patch?: never;
278
278
  trace?: never;
279
279
  };
280
- "trader-event-pnl": {
280
+ "trader-category-pnl": {
281
281
  parameters: {
282
282
  query?: never;
283
283
  header?: never;
@@ -287,10 +287,110 @@ export interface webhooks {
287
287
  get?: never;
288
288
  put?: never;
289
289
  /**
290
- * Event PnL callback
291
- * @description Fired when a trader's event-level PnL crosses a configured threshold
290
+ * Category PnL callback
291
+ * @description Fired when a trader's category-level PnL crosses a configured threshold
292
292
  */
293
- post: operations["trader-event-pnl"];
293
+ post: operations["trader-category-pnl"];
294
+ delete?: never;
295
+ options?: never;
296
+ head?: never;
297
+ patch?: never;
298
+ trace?: never;
299
+ };
300
+ "trader-position-resolved": {
301
+ parameters: {
302
+ query?: never;
303
+ header?: never;
304
+ path?: never;
305
+ cookie?: never;
306
+ };
307
+ get?: never;
308
+ put?: never;
309
+ /**
310
+ * Position Resolved callback
311
+ * @description Fired once when a trader's position is resolved (won or lost)
312
+ */
313
+ post: operations["trader-position-resolved"];
314
+ delete?: never;
315
+ options?: never;
316
+ head?: never;
317
+ patch?: never;
318
+ trace?: never;
319
+ };
320
+ "trader-pnl-exits": {
321
+ parameters: {
322
+ query?: never;
323
+ header?: never;
324
+ path?: never;
325
+ cookie?: never;
326
+ };
327
+ get?: never;
328
+ put?: never;
329
+ /**
330
+ * Exit Markers callback
331
+ * @description Fired once per position close, labelled with the exit reason (resolved_win / resolved_loss / sold_win / sold_loss).
332
+ */
333
+ post: operations["trader-pnl-exits"];
334
+ delete?: never;
335
+ options?: never;
336
+ head?: never;
337
+ patch?: never;
338
+ trace?: never;
339
+ };
340
+ "position-holder-metrics": {
341
+ parameters: {
342
+ query?: never;
343
+ header?: never;
344
+ path?: never;
345
+ cookie?: never;
346
+ };
347
+ get?: never;
348
+ put?: never;
349
+ /**
350
+ * Position holder metrics callback
351
+ * @description Fired when holder metrics change for a position.
352
+ */
353
+ post: operations["position-holder-metrics"];
354
+ delete?: never;
355
+ options?: never;
356
+ head?: never;
357
+ patch?: never;
358
+ trace?: never;
359
+ };
360
+ "condition-holder-metrics": {
361
+ parameters: {
362
+ query?: never;
363
+ header?: never;
364
+ path?: never;
365
+ cookie?: never;
366
+ };
367
+ get?: never;
368
+ put?: never;
369
+ /**
370
+ * Condition holder metrics callback
371
+ * @description Fired when holder metrics change for a condition.
372
+ */
373
+ post: operations["condition-holder-metrics"];
374
+ delete?: never;
375
+ options?: never;
376
+ head?: never;
377
+ patch?: never;
378
+ trace?: never;
379
+ };
380
+ "event-holder-metrics": {
381
+ parameters: {
382
+ query?: never;
383
+ header?: never;
384
+ path?: never;
385
+ cookie?: never;
386
+ };
387
+ get?: never;
388
+ put?: never;
389
+ /**
390
+ * Event holder metrics callback
391
+ * @description Fired when holder metrics change for an event.
392
+ */
393
+ post: operations["event-holder-metrics"];
294
394
  delete?: never;
295
395
  options?: never;
296
396
  head?: never;
@@ -795,6 +895,77 @@ export interface components {
795
895
  * @enum {string}
796
896
  */
797
897
  AssetWindowFilterTimeframe: "5m" | "15m" | "1h" | "4h" | "1d" | "24h";
898
+ /** @description Category PnL webhook payload. */
899
+ CategoryPnlPayload: {
900
+ trader?: string | null;
901
+ category?: string | null;
902
+ /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
903
+ timeframe: string;
904
+ /** Format: double */
905
+ realized_pnl_usd?: number | null;
906
+ /** Format: int64 */
907
+ markets_in_category?: number | null;
908
+ /** Format: int64 */
909
+ markets_traded?: number | null;
910
+ /** Format: int64 */
911
+ outcomes_traded?: number | null;
912
+ /** Format: int64 */
913
+ total_buys?: number | null;
914
+ /** Format: int64 */
915
+ total_sells?: number | null;
916
+ /** Format: int64 */
917
+ total_redemptions?: number | null;
918
+ /** Format: int64 */
919
+ total_merges?: number | null;
920
+ /** Format: int64 */
921
+ total_splits?: number | null;
922
+ /** Format: double */
923
+ total_volume_usd?: number | null;
924
+ /** Format: double */
925
+ buy_usd?: number | null;
926
+ /** Format: double */
927
+ sell_usd?: number | null;
928
+ /** Format: double */
929
+ redemption_usd?: number | null;
930
+ /** Format: double */
931
+ merge_usd?: number | null;
932
+ /** Format: double */
933
+ convert_collateral_usd?: number | null;
934
+ /** Format: double */
935
+ split_volume_usd?: number | null;
936
+ /** Format: double */
937
+ total_fees?: number | null;
938
+ /** Format: double */
939
+ total_shares_bought?: number | null;
940
+ /** Format: int64 */
941
+ markets_won?: number | null;
942
+ /** Format: int64 */
943
+ markets_lost?: number | null;
944
+ /** Format: double */
945
+ market_win_rate_pct?: number | null;
946
+ /** Format: double */
947
+ avg_hold_time_seconds?: number | null;
948
+ /** Format: double */
949
+ best_trade_pnl_usd?: number | null;
950
+ best_trade_condition_id?: string | null;
951
+ /** Format: double */
952
+ worst_trade_pnl_usd?: number | null;
953
+ worst_trade_condition_id?: string | null;
954
+ /** Format: double */
955
+ total_wins_usd?: number | null;
956
+ /** Format: double */
957
+ total_losses_usd?: number | null;
958
+ /** Format: double */
959
+ avg_win_usd?: number | null;
960
+ /** Format: double */
961
+ avg_loss_usd?: number | null;
962
+ /** Format: double */
963
+ profit_factor?: number | null;
964
+ /** Format: int64 */
965
+ first_trade_at?: number | null;
966
+ /** Format: int64 */
967
+ last_trade_at?: number | null;
968
+ };
798
969
  /**
799
970
  * @description Subscription filters for the `close_to_bond` event. At least one of
800
971
  * `min_probability` or `max_probability` is required (enforced at runtime).
@@ -895,6 +1066,18 @@ export interface components {
895
1066
  */
896
1067
  threshold: number;
897
1068
  };
1069
+ ConditionHolderMetricsFilters: {
1070
+ condition_ids?: string[];
1071
+ };
1072
+ ConditionHolderMetricsPayload: {
1073
+ /** Format: int32 */
1074
+ ts: number;
1075
+ /** Format: int64 */
1076
+ block: number;
1077
+ condition_id: string;
1078
+ /** Format: int32 */
1079
+ holder_count: number;
1080
+ };
898
1081
  /** @description Payload delivered when a market's volume or transaction metrics cross a configured threshold */
899
1082
  ConditionMetricsPayload: {
900
1083
  /** @description Market condition ID */
@@ -1001,6 +1184,25 @@ export interface components {
1001
1184
  DeleteWebhookResponse: {
1002
1185
  deleted: boolean;
1003
1186
  };
1187
+ /**
1188
+ * @description What triggered a position update. Each value is serialised as a
1189
+ * lowercase string in the `dirty_kinds` array on every payload, and
1190
+ * the same values are accepted as a subscribe-time filter on rooms
1191
+ * that expose one.
1192
+ *
1193
+ * * `trade` — a buy, sell, merge, split, redemption, or NegRisk
1194
+ * convert landed for the position
1195
+ * * `price` — the outcome price moved (mark-to-market refresh)
1196
+ * * `window` — a 1d / 7d / 30d rolling window boundary was crossed
1197
+ * * `position_resolved` — the market that owns this position resolved
1198
+ * on this update
1199
+ * * `market_resolved` — the market itself resolved (stamped on
1200
+ * `MarketRollup` rows for lifetime holders who never redeemed).
1201
+ * Carried on the resolution tick stream and on any full-row update
1202
+ * that bundles a resolution with a trade.
1203
+ * @enum {string}
1204
+ */
1205
+ DirtyKind: "trade" | "price" | "window" | "position_resolved" | "market_resolved";
1004
1206
  /** @description V2 UMA OOv2: a proposed price was disputed. */
1005
1207
  DisputePriceEvent: {
1006
1208
  id: string;
@@ -1031,6 +1233,18 @@ export interface components {
1031
1233
  slug?: string | null;
1032
1234
  event_slug?: string | null;
1033
1235
  };
1236
+ EventHolderMetricsFilters: {
1237
+ event_slugs?: string[];
1238
+ };
1239
+ EventHolderMetricsPayload: {
1240
+ /** Format: int32 */
1241
+ ts: number;
1242
+ /** Format: int64 */
1243
+ block: number;
1244
+ event_slug: string;
1245
+ /** Format: int32 */
1246
+ holder_count: number;
1247
+ };
1034
1248
  /** @description Subscription filters for the `event_metrics` event. All fields are optional. */
1035
1249
  EventMetricsFilters: {
1036
1250
  /** @description Restrict to these events. Empty = all events. */
@@ -1120,47 +1334,6 @@ export interface components {
1120
1334
  */
1121
1335
  unique_builder_traders?: number | null;
1122
1336
  };
1123
- /** @description Event PnL webhook payload. */
1124
- EventPnlPayload: {
1125
- trader?: string | null;
1126
- event_slug?: string | null;
1127
- /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
1128
- timeframe: string;
1129
- /** Format: int64 */
1130
- markets_traded?: number | null;
1131
- /** Format: int64 */
1132
- outcomes_traded?: number | null;
1133
- /** Format: int64 */
1134
- total_buys?: number | null;
1135
- /** Format: int64 */
1136
- total_sells?: number | null;
1137
- /** Format: int64 */
1138
- total_redemptions?: number | null;
1139
- /** Format: int64 */
1140
- total_merges?: number | null;
1141
- /** Format: double */
1142
- total_volume_usd?: number | null;
1143
- /** Format: double */
1144
- buy_usd?: number | null;
1145
- /** Format: double */
1146
- sell_usd?: number | null;
1147
- /** Format: double */
1148
- redemption_usd?: number | null;
1149
- /** Format: double */
1150
- merge_usd?: number | null;
1151
- /** Format: double */
1152
- realized_pnl_usd?: number | null;
1153
- /** Format: int64 */
1154
- winning_markets?: number | null;
1155
- /** Format: int64 */
1156
- losing_markets?: number | null;
1157
- /** Format: double */
1158
- total_fees?: number | null;
1159
- /** Format: int64 */
1160
- first_trade_at?: number | null;
1161
- /** Format: int64 */
1162
- last_trade_at?: number | null;
1163
- };
1164
1337
  /** @description Subscription filters for the `event_volume_milestone` event. */
1165
1338
  EventVolumeMilestoneFilters: {
1166
1339
  /** @description **Required.** Aggregation windows to monitor. */
@@ -1253,6 +1426,35 @@ export interface components {
1253
1426
  */
1254
1427
  fees: number;
1255
1428
  };
1429
+ /** @description Exit Markers webhook payload — one position open->closed transition. */
1430
+ ExitMarkersPayload: {
1431
+ trader: string;
1432
+ position_id: string;
1433
+ condition_id: string;
1434
+ event_slug: string;
1435
+ market_slug: string;
1436
+ title: string;
1437
+ question: string;
1438
+ image_url: string;
1439
+ outcome: string;
1440
+ /** Format: int32 */
1441
+ outcome_index?: number | null;
1442
+ /** Format: double */
1443
+ pnl_usd: number;
1444
+ /** Format: double */
1445
+ pnl_pct: number;
1446
+ /** Format: double */
1447
+ cost_basis_usd: number;
1448
+ /** @description resolved_win | resolved_loss | sold_win | sold_loss */
1449
+ reason: string;
1450
+ /** Format: int64 */
1451
+ block: number;
1452
+ /**
1453
+ * Format: int32
1454
+ * @description Exit time, unix seconds.
1455
+ */
1456
+ ts: number;
1457
+ };
1256
1458
  /** @description Payload delivered when a tracked trader executes their first-ever trade on Polymarket */
1257
1459
  FirstTradePayload: {
1258
1460
  /** @description Limit-order maker wallet address (lowercase) */
@@ -1324,7 +1526,10 @@ export interface components {
1324
1526
  trader?: string | null;
1325
1527
  /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
1326
1528
  timeframe: string;
1327
- /** Format: double */
1529
+ /**
1530
+ * Format: double
1531
+ * @description Realized PnL for the timeframe (matches REST `/pnl/global`).
1532
+ */
1328
1533
  realized_pnl_usd?: number | null;
1329
1534
  /** Format: int64 */
1330
1535
  events_traded?: number | null;
@@ -1338,6 +1543,8 @@ export interface components {
1338
1543
  total_redemptions?: number | null;
1339
1544
  /** Format: int64 */
1340
1545
  total_merges?: number | null;
1546
+ /** Format: int64 */
1547
+ total_splits?: number | null;
1341
1548
  /** Format: double */
1342
1549
  total_volume_usd?: number | null;
1343
1550
  /** Format: double */
@@ -1348,6 +1555,26 @@ export interface components {
1348
1555
  redemption_volume_usd?: number | null;
1349
1556
  /** Format: double */
1350
1557
  merge_volume_usd?: number | null;
1558
+ /** Format: double */
1559
+ convert_collateral_usd?: number | null;
1560
+ /** Format: double */
1561
+ split_volume_usd?: number | null;
1562
+ /** Format: int64 */
1563
+ maker_rebate_count?: number | null;
1564
+ /** Format: double */
1565
+ maker_rebate_usd?: number | null;
1566
+ /** Format: int64 */
1567
+ reward_count?: number | null;
1568
+ /** Format: double */
1569
+ reward_usd?: number | null;
1570
+ /** Format: int64 */
1571
+ yield_count?: number | null;
1572
+ /** Format: double */
1573
+ yield_usd?: number | null;
1574
+ /** Format: int64 */
1575
+ total_credit_count?: number | null;
1576
+ /** Format: double */
1577
+ total_credit_usd?: number | null;
1351
1578
  /** Format: int64 */
1352
1579
  markets_won?: number | null;
1353
1580
  /** Format: int64 */
@@ -1355,9 +1582,15 @@ export interface components {
1355
1582
  /** Format: double */
1356
1583
  market_win_rate_pct?: number | null;
1357
1584
  /** Format: double */
1358
- avg_pnl_per_market?: number | null;
1585
+ total_wins_usd?: number | null;
1359
1586
  /** Format: double */
1360
- avg_pnl_per_trade?: number | null;
1587
+ total_losses_usd?: number | null;
1588
+ /** Format: double */
1589
+ avg_win_usd?: number | null;
1590
+ /** Format: double */
1591
+ avg_loss_usd?: number | null;
1592
+ /** Format: double */
1593
+ profit_factor?: number | null;
1361
1594
  /** Format: double */
1362
1595
  avg_hold_time_seconds?: number | null;
1363
1596
  /** Format: double */
@@ -1365,6 +1598,9 @@ export interface components {
1365
1598
  /** Format: double */
1366
1599
  best_trade_pnl_usd?: number | null;
1367
1600
  best_trade_condition_id?: string | null;
1601
+ /** Format: double */
1602
+ worst_trade_pnl_usd?: number | null;
1603
+ worst_trade_condition_id?: string | null;
1368
1604
  /** Format: int64 */
1369
1605
  first_trade_at?: number | null;
1370
1606
  /** Format: int64 */
@@ -1463,8 +1699,13 @@ export interface components {
1463
1699
  trader?: string | null;
1464
1700
  condition_id?: string | null;
1465
1701
  event_slug?: string | null;
1702
+ category?: string | null;
1466
1703
  /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
1467
1704
  timeframe: string;
1705
+ /** Format: double */
1706
+ realized_pnl_usd?: number | null;
1707
+ /** Format: double */
1708
+ current_shares_balance?: number | null;
1468
1709
  /** Format: int64 */
1469
1710
  outcomes_traded?: number | null;
1470
1711
  /** Format: int64 */
@@ -1475,6 +1716,8 @@ export interface components {
1475
1716
  total_redemptions?: number | null;
1476
1717
  /** Format: int64 */
1477
1718
  total_merges?: number | null;
1719
+ /** Format: int64 */
1720
+ total_splits?: number | null;
1478
1721
  /** Format: double */
1479
1722
  buy_usd?: number | null;
1480
1723
  /** Format: double */
@@ -1484,11 +1727,13 @@ export interface components {
1484
1727
  /** Format: double */
1485
1728
  merge_usd?: number | null;
1486
1729
  /** Format: double */
1487
- realized_pnl_usd?: number | null;
1488
- /** Format: int64 */
1489
- winning_outcomes?: number | null;
1730
+ convert_collateral_usd?: number | null;
1731
+ /** Format: double */
1732
+ split_volume_usd?: number | null;
1490
1733
  /** Format: double */
1491
1734
  total_fees?: number | null;
1735
+ /** Format: double */
1736
+ total_shares_bought?: number | null;
1492
1737
  /** Format: int64 */
1493
1738
  first_trade_at?: number | null;
1494
1739
  /** Format: int64 */
@@ -1825,7 +2070,7 @@ export interface components {
1825
2070
  */
1826
2071
  PnlFilterTimeframe: "1d" | "7d" | "30d" | "lifetime";
1827
2072
  /**
1828
- * @description PnL timeframe enum for webhook filtering
2073
+ * @description PnL timeframe enum for webhook filtering.
1829
2074
  * @enum {string}
1830
2075
  */
1831
2076
  PnlTimeframeFilter: "1d" | "7d" | "30d" | "lifetime";
@@ -1833,7 +2078,7 @@ export interface components {
1833
2078
  * @description Polymarket webhook event types
1834
2079
  * @enum {string}
1835
2080
  */
1836
- 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" | "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";
2081
+ 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";
1837
2082
  /**
1838
2083
  * @description Polymarket-specific webhook filters
1839
2084
  *
@@ -2022,6 +2267,26 @@ export interface components {
2022
2267
  */
2023
2268
  oracle_event_types?: string[];
2024
2269
  };
2270
+ PositionHolderMetricsFilters: {
2271
+ position_ids?: string[];
2272
+ };
2273
+ PositionHolderMetricsPayload: {
2274
+ /** Format: int32 */
2275
+ ts: number;
2276
+ /** Format: int64 */
2277
+ block: number;
2278
+ position_id: string;
2279
+ /** Format: int32 */
2280
+ holder_count: number;
2281
+ /** Format: double */
2282
+ total_balance: number;
2283
+ /** Format: double */
2284
+ total_cost_basis: number;
2285
+ /** Format: int32 */
2286
+ condition_holder_count?: number | null;
2287
+ /** Format: int32 */
2288
+ event_holder_count?: number | null;
2289
+ };
2025
2290
  /** @description Subscription filters for the `position_metrics` event. All fields are optional. */
2026
2291
  PositionMetricsFilters: {
2027
2292
  /** @description Restrict to these outcome token IDs. */
@@ -2180,11 +2445,146 @@ export interface components {
2180
2445
  /** Format: double */
2181
2446
  probability_low?: number | null;
2182
2447
  /** Format: double */
2183
- avg_trade_shares?: number | null;
2448
+ avg_trade_shares?: number | null;
2449
+ /** Format: double */
2450
+ avg_buy_shares?: number | null;
2451
+ /** Format: double */
2452
+ avg_sell_shares?: number | null;
2453
+ };
2454
+ PositionResolvedPayload: {
2455
+ trader?: string;
2456
+ position_id?: string;
2457
+ condition_id?: string | null;
2458
+ event_slug?: string | null;
2459
+ /**
2460
+ * @description Market category slug (e.g. "politics", "sports") — mirror of
2461
+ * `PositionRollup.category_id` resolved against the rollup
2462
+ * interner. Surfaces on the `/trader/{addr}/positions` API and
2463
+ * enables direct category-filtered + sorted position lookups
2464
+ * without a cross-grain join.
2465
+ */
2466
+ category?: string | null;
2467
+ outcome?: string | null;
2468
+ /** Format: int32 */
2469
+ outcome_index?: number | null;
2470
+ /** Format: int64 */
2471
+ total_buys?: number;
2472
+ /** Format: int64 */
2473
+ total_sells?: number;
2474
+ /** Format: int64 */
2475
+ total_merges?: number;
2476
+ /** Format: int64 */
2477
+ total_splits?: number;
2478
+ /** Format: int32 */
2479
+ winning_outcome_index?: number | null;
2480
+ /** Format: double */
2481
+ total_shares_bought?: number;
2482
+ /** Format: double */
2483
+ total_shares_sold?: number;
2484
+ /** Format: double */
2485
+ buy_usd?: number;
2486
+ /** Format: double */
2487
+ sell_usd?: number;
2488
+ /** Format: double */
2489
+ avg_entry_price?: number;
2490
+ /** Format: double */
2491
+ total_fees?: number;
2492
+ /** Format: double */
2493
+ realized_pnl_usd?: number;
2494
+ /** Format: double */
2495
+ total_pnl_usd?: number;
2496
+ /** Format: double */
2497
+ redemption_usd?: number;
2498
+ open?: boolean;
2499
+ won?: boolean | null;
2500
+ /** Format: int64 */
2501
+ first_trade_at?: number | null;
2502
+ /** Format: int64 */
2503
+ last_trade_at?: number | null;
2504
+ /**
2505
+ * @description What kind of activity triggered this update. One or more of
2506
+ * `"trade"`, `"price"`, `"window"`, `"position_resolved"`.
2507
+ * Subscribers that only care about one kind filter on
2508
+ * `data.dirty_kinds` containing the value.
2509
+ */
2510
+ dirty_kinds?: components["schemas"]["DirtyKind"][];
2511
+ /**
2512
+ * Format: double
2513
+ * @description `realized_pnl_usd / (buy_usd + total_fees) * 100` for the
2514
+ * window. `0.0` when the trader has no cost basis on this row yet.
2515
+ */
2516
+ realized_pnl_pct?: number;
2517
+ /** @description Market slug for the parent market of this outcome. */
2518
+ market_slug?: string | null;
2519
+ /** @description Market title. */
2520
+ title?: string | null;
2521
+ /** @description Market question. */
2522
+ question?: string | null;
2523
+ /** @description Market image URL. */
2524
+ image_url?: string | null;
2525
+ /**
2526
+ * Format: int32
2527
+ * @description NegRisk conversion count + share deltas for this position.
2528
+ */
2529
+ converted_count?: number;
2530
+ /** Format: double */
2531
+ converted_shares_gained?: number;
2532
+ /** Format: double */
2533
+ converted_shares_lost?: number;
2534
+ /**
2535
+ * Format: double
2536
+ * @description Aggregate buy/sell USD totals for this position across its
2537
+ * lifetime.
2538
+ */
2539
+ total_buy_usd?: number;
2540
+ /** Format: double */
2541
+ total_sell_usd?: number;
2542
+ /**
2543
+ * Format: double
2544
+ * @description Merge proceeds (Y+N → collateral).
2545
+ */
2546
+ merge_usd?: number;
2547
+ /**
2548
+ * Format: double
2549
+ * @description Sell-side average price.
2550
+ */
2551
+ avg_exit_price?: number | null;
2552
+ /**
2553
+ * Format: double
2554
+ * @description Volume-weighted average trade price across buys + sells.
2555
+ */
2556
+ avg_price?: number | null;
2557
+ /**
2558
+ * Format: double
2559
+ * @description Mark-to-market values from the latest price tick.
2560
+ */
2561
+ current_price?: number | null;
2184
2562
  /** Format: double */
2185
- avg_buy_shares?: number | null;
2563
+ current_shares_balance?: number | null;
2186
2564
  /** Format: double */
2187
- avg_sell_shares?: number | null;
2565
+ current_value?: number | null;
2566
+ /**
2567
+ * Format: double
2568
+ * @description Last on-chain trade price for the outcome token.
2569
+ */
2570
+ last_traded_price?: number | null;
2571
+ /**
2572
+ * Format: int64
2573
+ * @description Market resolution deadline as Unix seconds.
2574
+ */
2575
+ end_date?: number | null;
2576
+ /** @description NegRisk multi-outcome flag. */
2577
+ is_neg_risk?: boolean | null;
2578
+ /**
2579
+ * @description `true` when the market is resolved AND the trader still holds
2580
+ * shares (redeem available).
2581
+ */
2582
+ redeemable?: boolean | null;
2583
+ /**
2584
+ * @description `true` when the market is NegRisk, unresolved, and the trader
2585
+ * holds shares (NegRisk-adapter merge available).
2586
+ */
2587
+ mergeable?: boolean | null;
2188
2588
  };
2189
2589
  /** @description Subscription filters for the `position_volume_milestone` event. */
2190
2590
  PositionVolumeMilestoneFilters: {
@@ -2840,51 +3240,63 @@ export interface components {
2840
3240
  * @enum {string}
2841
3241
  */
2842
3242
  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";
2843
- /** @description Subscription filters for the `trader_event_pnl` event. All fields are optional. */
2844
- TraderEventPnlFilters: {
2845
- /** @description Track only these trader wallet addresses. */
3243
+ /** @description Subscription filters for the `trader_category_pnl` event. All fields are optional. */
3244
+ TraderCategoryPnlFilters: {
3245
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
2846
3246
  traders?: string[] | null;
2847
- /** @description Restrict to these events. */
2848
- event_slugs?: string[] | null;
3247
+ /** @description Restrict to these market categories (e.g. `politics`, `sports`). */
3248
+ categories?: string[] | null;
2849
3249
  /**
2850
3250
  * Format: double
2851
- * @description Only fire when per-event realized PnL ≥ this value (USD).
3251
+ * @description Only fire when per-category realized PnL ≥ this value (USD). Use negative values for loss thresholds.
2852
3252
  */
2853
3253
  min_realized_pnl_usd?: number | null;
2854
3254
  /**
2855
3255
  * Format: double
2856
- * @description Only fire when per-event realized PnL ≤ this value (USD).
3256
+ * @description Only fire when per-category realized PnL ≤ this value (USD).
2857
3257
  */
2858
3258
  max_realized_pnl_usd?: number | null;
2859
3259
  /**
2860
3260
  * Format: double
2861
- * @description Only fire when total event volume ≥ this value (USD).
3261
+ * @description Only fire when total category volume ≥ this value (USD).
2862
3262
  */
2863
3263
  min_volume_usd?: number | null;
2864
3264
  /**
2865
3265
  * Format: double
2866
- * @description Only fire when total event volume ≤ this value (USD).
3266
+ * @description Only fire when total category volume ≤ this value (USD).
2867
3267
  */
2868
3268
  max_volume_usd?: number | null;
2869
3269
  /**
2870
3270
  * Format: double
2871
- * @description Only fire when buy volume within the event ≥ this value (USD).
3271
+ * @description Only fire when buy volume within the category ≥ this value (USD).
2872
3272
  */
2873
3273
  min_buy_usd?: number | null;
2874
3274
  /**
2875
3275
  * Format: double
2876
- * @description Only fire when sell volume within the event ≥ this value (USD).
3276
+ * @description Only fire when sell volume within the category ≥ this value (USD).
2877
3277
  */
2878
3278
  min_sell_volume_usd?: number | null;
3279
+ /**
3280
+ * Format: double
3281
+ * @description Only fire when market win rate ≥ this percentage (0.0–100.0).
3282
+ */
3283
+ min_win_rate?: number | null;
2879
3284
  /**
2880
3285
  * Format: int64
2881
- * @description Only fire when the trader has traded in ≥ this many markets within the event.
3286
+ * @description Only fire when the trader has traded in ≥ this many markets within the category.
2882
3287
  */
2883
3288
  min_markets_traded?: number | null;
2884
- /** @description Restrict to these PnL windows. */
3289
+ /** @description Restrict to these PnL windows. Empty = all windows. */
2885
3290
  timeframes?: components["schemas"]["PnlFilterTimeframe"][] | null;
2886
- /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
2887
- exclude_shortterm_markets?: boolean | null;
3291
+ };
3292
+ /** @description Subscription filters for the `trader_pnl_exits` event. All fields are optional. */
3293
+ TraderExitMarkersFilters: {
3294
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
3295
+ traders?: string[] | null;
3296
+ /** @description Restrict to these markets. */
3297
+ condition_ids?: string[] | null;
3298
+ /** @description Restrict to positions in these events. */
3299
+ event_slugs?: string[] | null;
2888
3300
  };
2889
3301
  /** @description Subscription filters for the `trader_first_trade` event. All fields are optional. */
2890
3302
  TraderFirstTradeFilters: {
@@ -3057,6 +3469,19 @@ export interface components {
3057
3469
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
3058
3470
  exclude_shortterm_markets?: boolean | null;
3059
3471
  };
3472
+ /** @description Subscription filters for the `trader_position_resolved` event. All fields are optional. */
3473
+ TraderPositionResolvedFilters: {
3474
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
3475
+ traders?: string[] | null;
3476
+ /** @description Restrict to these markets. */
3477
+ condition_ids?: string[] | null;
3478
+ /** @description Restrict to positions in these events. */
3479
+ event_slugs?: string[] | null;
3480
+ /** @description Restrict to these outcome indexes within the resolved market. */
3481
+ outcome_indexes?: number[] | null;
3482
+ /** @description Only fire for won (`true`) or lost (`false`) positions. Omit to receive both. */
3483
+ won_only?: boolean | null;
3484
+ };
3060
3485
  /**
3061
3486
  * @description Subscription filters for the `trader_trade_event` event. All fields are optional.
3062
3487
  * `event_slugs` and `exclude_shortterm_markets` require explicit `trade_types` that
@@ -4712,7 +5137,222 @@ export interface operations {
4712
5137
  };
4713
5138
  };
4714
5139
  };
4715
- "trader-event-pnl": {
5140
+ "trader-category-pnl": {
5141
+ parameters: {
5142
+ query?: never;
5143
+ header: {
5144
+ /** @description UUID of the webhook subscription that fired */
5145
+ "X-Webhook-ID": string;
5146
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5147
+ "X-Delivery-ID": string;
5148
+ /** @description Event name string (e.g. `trader_first_trade`) */
5149
+ "X-Event-Type": string;
5150
+ /** @description Delivery attempt number (1 = first attempt) */
5151
+ "X-Attempt": number;
5152
+ /** @description HMAC-SHA256 of the raw request body: `sha256=<hex>`. Present only when the webhook has a secret configured. Verify with: HMAC-SHA256(secret, raw_body_bytes) == hex_part. */
5153
+ "X-Webhook-Signature"?: string;
5154
+ };
5155
+ path?: never;
5156
+ cookie?: never;
5157
+ };
5158
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5159
+ requestBody: {
5160
+ content: {
5161
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5162
+ data?: components["schemas"]["CategoryPnlPayload"];
5163
+ };
5164
+ };
5165
+ };
5166
+ responses: {
5167
+ /** @description Webhook delivery acknowledged */
5168
+ 200: {
5169
+ headers: {
5170
+ [name: string]: unknown;
5171
+ };
5172
+ content?: never;
5173
+ };
5174
+ /** @description Server error (will retry) */
5175
+ 500: {
5176
+ headers: {
5177
+ [name: string]: unknown;
5178
+ };
5179
+ content?: never;
5180
+ };
5181
+ };
5182
+ };
5183
+ "trader-position-resolved": {
5184
+ parameters: {
5185
+ query?: never;
5186
+ header: {
5187
+ /** @description UUID of the webhook subscription that fired */
5188
+ "X-Webhook-ID": string;
5189
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5190
+ "X-Delivery-ID": string;
5191
+ /** @description Event name string (e.g. `trader_first_trade`) */
5192
+ "X-Event-Type": string;
5193
+ /** @description Delivery attempt number (1 = first attempt) */
5194
+ "X-Attempt": number;
5195
+ /** @description HMAC-SHA256 of the raw request body: `sha256=<hex>`. Present only when the webhook has a secret configured. Verify with: HMAC-SHA256(secret, raw_body_bytes) == hex_part. */
5196
+ "X-Webhook-Signature"?: string;
5197
+ };
5198
+ path?: never;
5199
+ cookie?: never;
5200
+ };
5201
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5202
+ requestBody: {
5203
+ content: {
5204
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5205
+ data?: components["schemas"]["PositionResolvedPayload"];
5206
+ };
5207
+ };
5208
+ };
5209
+ responses: {
5210
+ /** @description Webhook delivery acknowledged */
5211
+ 200: {
5212
+ headers: {
5213
+ [name: string]: unknown;
5214
+ };
5215
+ content?: never;
5216
+ };
5217
+ /** @description Server error (will retry) */
5218
+ 500: {
5219
+ headers: {
5220
+ [name: string]: unknown;
5221
+ };
5222
+ content?: never;
5223
+ };
5224
+ };
5225
+ };
5226
+ "trader-pnl-exits": {
5227
+ parameters: {
5228
+ query?: never;
5229
+ header: {
5230
+ /** @description UUID of the webhook subscription that fired */
5231
+ "X-Webhook-ID": string;
5232
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5233
+ "X-Delivery-ID": string;
5234
+ /** @description Event name string (e.g. `trader_first_trade`) */
5235
+ "X-Event-Type": string;
5236
+ /** @description Delivery attempt number (1 = first attempt) */
5237
+ "X-Attempt": number;
5238
+ /** @description HMAC-SHA256 of the raw request body: `sha256=<hex>`. Present only when the webhook has a secret configured. Verify with: HMAC-SHA256(secret, raw_body_bytes) == hex_part. */
5239
+ "X-Webhook-Signature"?: string;
5240
+ };
5241
+ path?: never;
5242
+ cookie?: never;
5243
+ };
5244
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5245
+ requestBody: {
5246
+ content: {
5247
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5248
+ data?: components["schemas"]["ExitMarkersPayload"];
5249
+ };
5250
+ };
5251
+ };
5252
+ responses: {
5253
+ /** @description Webhook delivery acknowledged */
5254
+ 200: {
5255
+ headers: {
5256
+ [name: string]: unknown;
5257
+ };
5258
+ content?: never;
5259
+ };
5260
+ /** @description Server error (will retry) */
5261
+ 500: {
5262
+ headers: {
5263
+ [name: string]: unknown;
5264
+ };
5265
+ content?: never;
5266
+ };
5267
+ };
5268
+ };
5269
+ "position-holder-metrics": {
5270
+ parameters: {
5271
+ query?: never;
5272
+ header: {
5273
+ /** @description UUID of the webhook subscription that fired */
5274
+ "X-Webhook-ID": string;
5275
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5276
+ "X-Delivery-ID": string;
5277
+ /** @description Event name string (e.g. `trader_first_trade`) */
5278
+ "X-Event-Type": string;
5279
+ /** @description Delivery attempt number (1 = first attempt) */
5280
+ "X-Attempt": number;
5281
+ /** @description HMAC-SHA256 of the raw request body: `sha256=<hex>`. Present only when the webhook has a secret configured. Verify with: HMAC-SHA256(secret, raw_body_bytes) == hex_part. */
5282
+ "X-Webhook-Signature"?: string;
5283
+ };
5284
+ path?: never;
5285
+ cookie?: never;
5286
+ };
5287
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5288
+ requestBody: {
5289
+ content: {
5290
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5291
+ data?: components["schemas"]["PositionHolderMetricsPayload"];
5292
+ };
5293
+ };
5294
+ };
5295
+ responses: {
5296
+ /** @description Webhook delivery acknowledged */
5297
+ 200: {
5298
+ headers: {
5299
+ [name: string]: unknown;
5300
+ };
5301
+ content?: never;
5302
+ };
5303
+ /** @description Server error (will retry) */
5304
+ 500: {
5305
+ headers: {
5306
+ [name: string]: unknown;
5307
+ };
5308
+ content?: never;
5309
+ };
5310
+ };
5311
+ };
5312
+ "condition-holder-metrics": {
5313
+ parameters: {
5314
+ query?: never;
5315
+ header: {
5316
+ /** @description UUID of the webhook subscription that fired */
5317
+ "X-Webhook-ID": string;
5318
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5319
+ "X-Delivery-ID": string;
5320
+ /** @description Event name string (e.g. `trader_first_trade`) */
5321
+ "X-Event-Type": string;
5322
+ /** @description Delivery attempt number (1 = first attempt) */
5323
+ "X-Attempt": number;
5324
+ /** @description HMAC-SHA256 of the raw request body: `sha256=<hex>`. Present only when the webhook has a secret configured. Verify with: HMAC-SHA256(secret, raw_body_bytes) == hex_part. */
5325
+ "X-Webhook-Signature"?: string;
5326
+ };
5327
+ path?: never;
5328
+ cookie?: never;
5329
+ };
5330
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5331
+ requestBody: {
5332
+ content: {
5333
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5334
+ data?: components["schemas"]["ConditionHolderMetricsPayload"];
5335
+ };
5336
+ };
5337
+ };
5338
+ responses: {
5339
+ /** @description Webhook delivery acknowledged */
5340
+ 200: {
5341
+ headers: {
5342
+ [name: string]: unknown;
5343
+ };
5344
+ content?: never;
5345
+ };
5346
+ /** @description Server error (will retry) */
5347
+ 500: {
5348
+ headers: {
5349
+ [name: string]: unknown;
5350
+ };
5351
+ content?: never;
5352
+ };
5353
+ };
5354
+ };
5355
+ "event-holder-metrics": {
4716
5356
  parameters: {
4717
5357
  query?: never;
4718
5358
  header: {
@@ -4734,7 +5374,7 @@ export interface operations {
4734
5374
  requestBody: {
4735
5375
  content: {
4736
5376
  "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
4737
- data?: components["schemas"]["EventPnlPayload"];
5377
+ data?: components["schemas"]["EventHolderMetricsPayload"];
4738
5378
  };
4739
5379
  };
4740
5380
  };