@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.
@@ -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;
1586
+ /** Format: double */
1587
+ total_losses_usd?: number | null;
1588
+ /** Format: double */
1589
+ avg_win_usd?: number | null;
1359
1590
  /** Format: double */
1360
- avg_pnl_per_trade?: number | null;
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,150 @@ 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
+ unrealized_pnl_usd?: number;
2498
+ /** Format: double */
2499
+ redemption_usd?: number;
2500
+ open?: boolean;
2501
+ won?: boolean | null;
2502
+ /** Format: int64 */
2503
+ first_trade_at?: number | null;
2504
+ /** Format: int64 */
2505
+ last_trade_at?: number | null;
2506
+ /**
2507
+ * @description What kind of activity triggered this update. One or more of
2508
+ * `"trade"`, `"price"`, `"window"`, `"position_resolved"`.
2509
+ * Subscribers that only care about one kind filter on
2510
+ * `data.dirty_kinds` containing the value.
2511
+ */
2512
+ dirty_kinds?: components["schemas"]["DirtyKind"][];
2513
+ /**
2514
+ * Format: double
2515
+ * @description `realized_pnl_usd / (buy_usd + total_fees) * 100` for the
2516
+ * window. `0.0` when the trader has no cost basis on this row yet.
2517
+ */
2518
+ realized_pnl_pct?: number;
2519
+ /** Format: double */
2520
+ total_pnl_pct?: number;
2521
+ /** @description Market slug for the parent market of this outcome. */
2522
+ market_slug?: string | null;
2523
+ /** @description Market title. */
2524
+ title?: string | null;
2525
+ /** @description Market question. */
2526
+ question?: string | null;
2527
+ /** @description Market image URL. */
2528
+ image_url?: string | null;
2529
+ /**
2530
+ * Format: int32
2531
+ * @description NegRisk conversion count + share deltas for this position.
2532
+ */
2533
+ converted_count?: number;
2534
+ /** Format: double */
2535
+ converted_shares_gained?: number;
2536
+ /** Format: double */
2537
+ converted_shares_lost?: number;
2538
+ /**
2539
+ * Format: double
2540
+ * @description Aggregate buy/sell USD totals for this position across its
2541
+ * lifetime.
2542
+ */
2543
+ total_buy_usd?: number;
2544
+ /** Format: double */
2545
+ total_sell_usd?: number;
2546
+ /**
2547
+ * Format: double
2548
+ * @description Merge proceeds (Y+N → collateral).
2549
+ */
2550
+ merge_usd?: number;
2551
+ /**
2552
+ * Format: double
2553
+ * @description Sell-side average price.
2554
+ */
2555
+ avg_exit_price?: number | null;
2556
+ /**
2557
+ * Format: double
2558
+ * @description Volume-weighted average trade price across buys + sells.
2559
+ */
2560
+ avg_price?: number | null;
2561
+ /**
2562
+ * Format: double
2563
+ * @description Mark-to-market values from the latest price tick.
2564
+ */
2565
+ current_price?: number | null;
2184
2566
  /** Format: double */
2185
- avg_buy_shares?: number | null;
2567
+ current_shares_balance?: number | null;
2186
2568
  /** Format: double */
2187
- avg_sell_shares?: number | null;
2569
+ current_value?: number | null;
2570
+ /**
2571
+ * Format: double
2572
+ * @description Last on-chain trade price for the outcome token.
2573
+ */
2574
+ last_traded_price?: number | null;
2575
+ /**
2576
+ * Format: int64
2577
+ * @description Market resolution deadline as Unix seconds.
2578
+ */
2579
+ end_date?: number | null;
2580
+ /** @description NegRisk multi-outcome flag. */
2581
+ is_neg_risk?: boolean | null;
2582
+ /**
2583
+ * @description `true` when the market is resolved AND the trader still holds
2584
+ * shares (redeem available).
2585
+ */
2586
+ redeemable?: boolean | null;
2587
+ /**
2588
+ * @description `true` when the market is NegRisk, unresolved, and the trader
2589
+ * holds shares (NegRisk-adapter merge available).
2590
+ */
2591
+ mergeable?: boolean | null;
2188
2592
  };
2189
2593
  /** @description Subscription filters for the `position_volume_milestone` event. */
2190
2594
  PositionVolumeMilestoneFilters: {
@@ -2840,51 +3244,63 @@ export interface components {
2840
3244
  * @enum {string}
2841
3245
  */
2842
3246
  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. */
3247
+ /** @description Subscription filters for the `trader_category_pnl` event. All fields are optional. */
3248
+ TraderCategoryPnlFilters: {
3249
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
2846
3250
  traders?: string[] | null;
2847
- /** @description Restrict to these events. */
2848
- event_slugs?: string[] | null;
3251
+ /** @description Restrict to these market categories (e.g. `politics`, `sports`). */
3252
+ categories?: string[] | null;
2849
3253
  /**
2850
3254
  * Format: double
2851
- * @description Only fire when per-event realized PnL ≥ this value (USD).
3255
+ * @description Only fire when per-category realized PnL ≥ this value (USD). Use negative values for loss thresholds.
2852
3256
  */
2853
3257
  min_realized_pnl_usd?: number | null;
2854
3258
  /**
2855
3259
  * Format: double
2856
- * @description Only fire when per-event realized PnL ≤ this value (USD).
3260
+ * @description Only fire when per-category realized PnL ≤ this value (USD).
2857
3261
  */
2858
3262
  max_realized_pnl_usd?: number | null;
2859
3263
  /**
2860
3264
  * Format: double
2861
- * @description Only fire when total event volume ≥ this value (USD).
3265
+ * @description Only fire when total category volume ≥ this value (USD).
2862
3266
  */
2863
3267
  min_volume_usd?: number | null;
2864
3268
  /**
2865
3269
  * Format: double
2866
- * @description Only fire when total event volume ≤ this value (USD).
3270
+ * @description Only fire when total category volume ≤ this value (USD).
2867
3271
  */
2868
3272
  max_volume_usd?: number | null;
2869
3273
  /**
2870
3274
  * Format: double
2871
- * @description Only fire when buy volume within the event ≥ this value (USD).
3275
+ * @description Only fire when buy volume within the category ≥ this value (USD).
2872
3276
  */
2873
3277
  min_buy_usd?: number | null;
2874
3278
  /**
2875
3279
  * Format: double
2876
- * @description Only fire when sell volume within the event ≥ this value (USD).
3280
+ * @description Only fire when sell volume within the category ≥ this value (USD).
2877
3281
  */
2878
3282
  min_sell_volume_usd?: number | null;
3283
+ /**
3284
+ * Format: double
3285
+ * @description Only fire when market win rate ≥ this percentage (0.0–100.0).
3286
+ */
3287
+ min_win_rate?: number | null;
2879
3288
  /**
2880
3289
  * Format: int64
2881
- * @description Only fire when the trader has traded in ≥ this many markets within the event.
3290
+ * @description Only fire when the trader has traded in ≥ this many markets within the category.
2882
3291
  */
2883
3292
  min_markets_traded?: number | null;
2884
- /** @description Restrict to these PnL windows. */
3293
+ /** @description Restrict to these PnL windows. Empty = all windows. */
2885
3294
  timeframes?: components["schemas"]["PnlFilterTimeframe"][] | null;
2886
- /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
2887
- exclude_shortterm_markets?: boolean | null;
3295
+ };
3296
+ /** @description Subscription filters for the `trader_pnl_exits` event. All fields are optional. */
3297
+ TraderExitMarkersFilters: {
3298
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
3299
+ traders?: string[] | null;
3300
+ /** @description Restrict to these markets. */
3301
+ condition_ids?: string[] | null;
3302
+ /** @description Restrict to positions in these events. */
3303
+ event_slugs?: string[] | null;
2888
3304
  };
2889
3305
  /** @description Subscription filters for the `trader_first_trade` event. All fields are optional. */
2890
3306
  TraderFirstTradeFilters: {
@@ -3057,6 +3473,19 @@ export interface components {
3057
3473
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
3058
3474
  exclude_shortterm_markets?: boolean | null;
3059
3475
  };
3476
+ /** @description Subscription filters for the `trader_position_resolved` event. All fields are optional. */
3477
+ TraderPositionResolvedFilters: {
3478
+ /** @description Track only these trader wallet addresses. Empty = all traders. */
3479
+ traders?: string[] | null;
3480
+ /** @description Restrict to these markets. */
3481
+ condition_ids?: string[] | null;
3482
+ /** @description Restrict to positions in these events. */
3483
+ event_slugs?: string[] | null;
3484
+ /** @description Restrict to these outcome indexes within the resolved market. */
3485
+ outcome_indexes?: number[] | null;
3486
+ /** @description Only fire for won (`true`) or lost (`false`) positions. Omit to receive both. */
3487
+ won_only?: boolean | null;
3488
+ };
3060
3489
  /**
3061
3490
  * @description Subscription filters for the `trader_trade_event` event. All fields are optional.
3062
3491
  * `event_slugs` and `exclude_shortterm_markets` require explicit `trade_types` that
@@ -4712,7 +5141,222 @@ export interface operations {
4712
5141
  };
4713
5142
  };
4714
5143
  };
4715
- "trader-event-pnl": {
5144
+ "trader-category-pnl": {
5145
+ parameters: {
5146
+ query?: never;
5147
+ header: {
5148
+ /** @description UUID of the webhook subscription that fired */
5149
+ "X-Webhook-ID": string;
5150
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5151
+ "X-Delivery-ID": string;
5152
+ /** @description Event name string (e.g. `trader_first_trade`) */
5153
+ "X-Event-Type": string;
5154
+ /** @description Delivery attempt number (1 = first attempt) */
5155
+ "X-Attempt": number;
5156
+ /** @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. */
5157
+ "X-Webhook-Signature"?: string;
5158
+ };
5159
+ path?: never;
5160
+ cookie?: never;
5161
+ };
5162
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5163
+ requestBody: {
5164
+ content: {
5165
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5166
+ data?: components["schemas"]["CategoryPnlPayload"];
5167
+ };
5168
+ };
5169
+ };
5170
+ responses: {
5171
+ /** @description Webhook delivery acknowledged */
5172
+ 200: {
5173
+ headers: {
5174
+ [name: string]: unknown;
5175
+ };
5176
+ content?: never;
5177
+ };
5178
+ /** @description Server error (will retry) */
5179
+ 500: {
5180
+ headers: {
5181
+ [name: string]: unknown;
5182
+ };
5183
+ content?: never;
5184
+ };
5185
+ };
5186
+ };
5187
+ "trader-position-resolved": {
5188
+ parameters: {
5189
+ query?: never;
5190
+ header: {
5191
+ /** @description UUID of the webhook subscription that fired */
5192
+ "X-Webhook-ID": string;
5193
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5194
+ "X-Delivery-ID": string;
5195
+ /** @description Event name string (e.g. `trader_first_trade`) */
5196
+ "X-Event-Type": string;
5197
+ /** @description Delivery attempt number (1 = first attempt) */
5198
+ "X-Attempt": number;
5199
+ /** @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. */
5200
+ "X-Webhook-Signature"?: string;
5201
+ };
5202
+ path?: never;
5203
+ cookie?: never;
5204
+ };
5205
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5206
+ requestBody: {
5207
+ content: {
5208
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5209
+ data?: components["schemas"]["PositionResolvedPayload"];
5210
+ };
5211
+ };
5212
+ };
5213
+ responses: {
5214
+ /** @description Webhook delivery acknowledged */
5215
+ 200: {
5216
+ headers: {
5217
+ [name: string]: unknown;
5218
+ };
5219
+ content?: never;
5220
+ };
5221
+ /** @description Server error (will retry) */
5222
+ 500: {
5223
+ headers: {
5224
+ [name: string]: unknown;
5225
+ };
5226
+ content?: never;
5227
+ };
5228
+ };
5229
+ };
5230
+ "trader-pnl-exits": {
5231
+ parameters: {
5232
+ query?: never;
5233
+ header: {
5234
+ /** @description UUID of the webhook subscription that fired */
5235
+ "X-Webhook-ID": string;
5236
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5237
+ "X-Delivery-ID": string;
5238
+ /** @description Event name string (e.g. `trader_first_trade`) */
5239
+ "X-Event-Type": string;
5240
+ /** @description Delivery attempt number (1 = first attempt) */
5241
+ "X-Attempt": number;
5242
+ /** @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. */
5243
+ "X-Webhook-Signature"?: string;
5244
+ };
5245
+ path?: never;
5246
+ cookie?: never;
5247
+ };
5248
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5249
+ requestBody: {
5250
+ content: {
5251
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5252
+ data?: components["schemas"]["ExitMarkersPayload"];
5253
+ };
5254
+ };
5255
+ };
5256
+ responses: {
5257
+ /** @description Webhook delivery acknowledged */
5258
+ 200: {
5259
+ headers: {
5260
+ [name: string]: unknown;
5261
+ };
5262
+ content?: never;
5263
+ };
5264
+ /** @description Server error (will retry) */
5265
+ 500: {
5266
+ headers: {
5267
+ [name: string]: unknown;
5268
+ };
5269
+ content?: never;
5270
+ };
5271
+ };
5272
+ };
5273
+ "position-holder-metrics": {
5274
+ parameters: {
5275
+ query?: never;
5276
+ header: {
5277
+ /** @description UUID of the webhook subscription that fired */
5278
+ "X-Webhook-ID": string;
5279
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5280
+ "X-Delivery-ID": string;
5281
+ /** @description Event name string (e.g. `trader_first_trade`) */
5282
+ "X-Event-Type": string;
5283
+ /** @description Delivery attempt number (1 = first attempt) */
5284
+ "X-Attempt": number;
5285
+ /** @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. */
5286
+ "X-Webhook-Signature"?: string;
5287
+ };
5288
+ path?: never;
5289
+ cookie?: never;
5290
+ };
5291
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5292
+ requestBody: {
5293
+ content: {
5294
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5295
+ data?: components["schemas"]["PositionHolderMetricsPayload"];
5296
+ };
5297
+ };
5298
+ };
5299
+ responses: {
5300
+ /** @description Webhook delivery acknowledged */
5301
+ 200: {
5302
+ headers: {
5303
+ [name: string]: unknown;
5304
+ };
5305
+ content?: never;
5306
+ };
5307
+ /** @description Server error (will retry) */
5308
+ 500: {
5309
+ headers: {
5310
+ [name: string]: unknown;
5311
+ };
5312
+ content?: never;
5313
+ };
5314
+ };
5315
+ };
5316
+ "condition-holder-metrics": {
5317
+ parameters: {
5318
+ query?: never;
5319
+ header: {
5320
+ /** @description UUID of the webhook subscription that fired */
5321
+ "X-Webhook-ID": string;
5322
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
5323
+ "X-Delivery-ID": string;
5324
+ /** @description Event name string (e.g. `trader_first_trade`) */
5325
+ "X-Event-Type": string;
5326
+ /** @description Delivery attempt number (1 = first attempt) */
5327
+ "X-Attempt": number;
5328
+ /** @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. */
5329
+ "X-Webhook-Signature"?: string;
5330
+ };
5331
+ path?: never;
5332
+ cookie?: never;
5333
+ };
5334
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
5335
+ requestBody: {
5336
+ content: {
5337
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
5338
+ data?: components["schemas"]["ConditionHolderMetricsPayload"];
5339
+ };
5340
+ };
5341
+ };
5342
+ responses: {
5343
+ /** @description Webhook delivery acknowledged */
5344
+ 200: {
5345
+ headers: {
5346
+ [name: string]: unknown;
5347
+ };
5348
+ content?: never;
5349
+ };
5350
+ /** @description Server error (will retry) */
5351
+ 500: {
5352
+ headers: {
5353
+ [name: string]: unknown;
5354
+ };
5355
+ content?: never;
5356
+ };
5357
+ };
5358
+ };
5359
+ "event-holder-metrics": {
4716
5360
  parameters: {
4717
5361
  query?: never;
4718
5362
  header: {
@@ -4734,7 +5378,7 @@ export interface operations {
4734
5378
  requestBody: {
4735
5379
  content: {
4736
5380
  "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
4737
- data?: components["schemas"]["EventPnlPayload"];
5381
+ data?: components["schemas"]["EventHolderMetricsPayload"];
4738
5382
  };
4739
5383
  };
4740
5384
  };