@structbuild/sdk 0.1.9 → 0.1.11

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.
@@ -23,7 +23,7 @@ export interface paths {
23
23
  patch?: never;
24
24
  trace?: never;
25
25
  };
26
- "/polymarket/events/metrics": {
26
+ "/polymarket/events/chart": {
27
27
  parameters: {
28
28
  query?: never;
29
29
  header?: never;
@@ -31,10 +31,10 @@ export interface paths {
31
31
  cookie?: never;
32
32
  };
33
33
  /**
34
- * Get event metrics
35
- * @description Retrieve volume, transaction, and trader metrics for an event. Supports single timeframe (e.g., '1m'), multiple timeframes (e.g., '1m,5m,1h'), or 'all' to get all available timeframes.
34
+ * Get event chart
35
+ * @description Retrieve price data over time for up to 4 markets with highest YES outcome (outcome_index 0) prices in an event. Perfect for rendering multi-line charts showing price movement across top markets.
36
36
  */
37
- get: operations["get_event_metrics"];
37
+ get: operations["get_event_chart"];
38
38
  put?: never;
39
39
  post?: never;
40
40
  delete?: never;
@@ -43,27 +43,7 @@ export interface paths {
43
43
  patch?: never;
44
44
  trace?: never;
45
45
  };
46
- "/polymarket/holders/events/{event_slug}": {
47
- parameters: {
48
- query?: never;
49
- header?: never;
50
- path?: never;
51
- cookie?: never;
52
- };
53
- /**
54
- * Get event holders
55
- * @description Retrieve holders aggregated across all markets in an event, sorted by total shares. Uses cursor-based pagination for efficient traversal.
56
- */
57
- get: operations["get_event_holders"];
58
- put?: never;
59
- post?: never;
60
- delete?: never;
61
- options?: never;
62
- head?: never;
63
- patch?: never;
64
- trace?: never;
65
- };
66
- "/polymarket/holders/events/{event_slug}/history": {
46
+ "/polymarket/events/metrics": {
67
47
  parameters: {
68
48
  query?: never;
69
49
  header?: never;
@@ -71,10 +51,10 @@ export interface paths {
71
51
  cookie?: never;
72
52
  };
73
53
  /**
74
- * Get event holders history
75
- * @description Retrieve historical holder count snapshots for an event over a time range
54
+ * Get event metrics
55
+ * @description Retrieve volume, transaction, and trader metrics for an event. Supports single timeframe (e.g., '1m'), multiple timeframes (e.g., '1m,5m,1h'), or 'all' to get all available timeframes.
76
56
  */
77
- get: operations["get_event_holders_history"];
57
+ get: operations["get_event_metrics"];
78
58
  put?: never;
79
59
  post?: never;
80
60
  delete?: never;
@@ -83,7 +63,7 @@ export interface paths {
83
63
  patch?: never;
84
64
  trace?: never;
85
65
  };
86
- "/polymarket/holders/markets/{condition_id}": {
66
+ "/polymarket/holders/markets": {
87
67
  parameters: {
88
68
  query?: never;
89
69
  header?: never;
@@ -92,7 +72,7 @@ export interface paths {
92
72
  };
93
73
  /**
94
74
  * Get market holders
95
- * @description Retrieve holders of a market grouped by outcome, sorted by shares held
75
+ * @description Retrieve holders of a market grouped by outcome, sorted by shares held. Identify the market with either `condition_id` or `market_slug` — exactly one must be provided. Each holder includes a nested `pnl` object with position-level PnL sourced from the position PnL table.
96
76
  */
97
77
  get: operations["get_market_holders"];
98
78
  put?: never;
@@ -103,7 +83,7 @@ export interface paths {
103
83
  patch?: never;
104
84
  trace?: never;
105
85
  };
106
- "/polymarket/holders/markets/{condition_id}/history": {
86
+ "/polymarket/holders/markets/history": {
107
87
  parameters: {
108
88
  query?: never;
109
89
  header?: never;
@@ -112,7 +92,7 @@ export interface paths {
112
92
  };
113
93
  /**
114
94
  * Get market holders history
115
- * @description Retrieve historical holder count snapshots for a market over a time range
95
+ * @description Retrieve historical holder count snapshots for a market over a time range. Identify the market with either `condition_id` or `market_slug` — exactly one must be provided.
116
96
  */
117
97
  get: operations["get_market_holders_history"];
118
98
  put?: never;
@@ -132,7 +112,7 @@ export interface paths {
132
112
  };
133
113
  /**
134
114
  * Get position holders
135
- * @description Retrieve holders of a specific position (ERC1155 token), sorted by shares held. Uses cursor-based pagination for efficient traversal.
115
+ * @description Retrieve holders of a specific position (ERC1155 token), sorted by shares held. Each holder includes a nested `pnl` object with position-level PnL (realized_pnl_usd, buy_usd, sell_usd, avg_entry_price, avg_exit_price, total_buys, total_sells, total_fees, first/last_trade_at) sourced from the position PnL table — no extra joins required at query time. Uses cursor-based pagination for efficient traversal.
136
116
  */
137
117
  get: operations["get_position_holders"];
138
118
  put?: never;
@@ -223,6 +203,26 @@ export interface paths {
223
203
  patch?: never;
224
204
  trace?: never;
225
205
  };
206
+ "/polymarket/market/chart": {
207
+ parameters: {
208
+ query?: never;
209
+ header?: never;
210
+ path?: never;
211
+ cookie?: never;
212
+ };
213
+ /**
214
+ * Get market chart
215
+ * @description Retrieve price data over time for up to 4 position outcomes in a market condition. Auto-selects the 4 most active outcomes if position_ids not specified.
216
+ */
217
+ get: operations["get_chart"];
218
+ put?: never;
219
+ post?: never;
220
+ delete?: never;
221
+ options?: never;
222
+ head?: never;
223
+ patch?: never;
224
+ trace?: never;
225
+ };
226
226
  "/polymarket/market/metrics": {
227
227
  parameters: {
228
228
  query?: never;
@@ -563,27 +563,7 @@ export interface paths {
563
563
  patch?: never;
564
564
  trace?: never;
565
565
  };
566
- "/polymarket/trader/portfolio/{address}": {
567
- parameters: {
568
- query?: never;
569
- header?: never;
570
- path?: never;
571
- cookie?: never;
572
- };
573
- /**
574
- * Get trader portfolio
575
- * @description Retrieve a trader's portfolio overview including balances and active positions
576
- */
577
- get: operations["get_portfolio"];
578
- put?: never;
579
- post?: never;
580
- delete?: never;
581
- options?: never;
582
- head?: never;
583
- patch?: never;
584
- trace?: never;
585
- };
586
- "/polymarket/trader/positions/{address}": {
566
+ "/polymarket/trader/pnl/{address}/positions": {
587
567
  parameters: {
588
568
  query?: never;
589
569
  header?: never;
@@ -591,10 +571,10 @@ export interface paths {
591
571
  cookie?: never;
592
572
  };
593
573
  /**
594
- * Get trader positions
595
- * @description Retrieve a trader's active positions with PnL data, sorted by the specified field
574
+ * Get trader position PnL
575
+ * @description Retrieve per-outcome-token PnL for a trader. Only includes OrderFilled trades (no redemptions/merges). Each entry represents a specific position (outcome token) the trader has bought or sold.
596
576
  */
597
- get: operations["get_portfolio_positions"];
577
+ get: operations["get_trader_position_pnl"];
598
578
  put?: never;
599
579
  post?: never;
600
580
  delete?: never;
@@ -632,7 +612,7 @@ export interface paths {
632
612
  };
633
613
  /**
634
614
  * Get multiple trader profiles
635
- * @description Retrieve profiles for multiple traders in a single request. Returns a map of address -> profile.
615
+ * @description Retrieve profiles for multiple traders in a single request. Returns an array of profiles.
636
616
  */
637
617
  get: operations["get_trader_profiles_batch"];
638
618
  put?: never;
@@ -691,11 +671,11 @@ export interface components {
691
671
  condition_id: string;
692
672
  title?: string | null;
693
673
  question: string;
694
- slug: string;
674
+ market_slug: string;
695
675
  event_slug?: string | null;
696
676
  image_url?: string | null;
697
677
  /** Format: int64 */
698
- end_date: number;
678
+ end_time: number;
699
679
  /** Format: int32 */
700
680
  best_outcome_index: number;
701
681
  /** Format: double */
@@ -703,16 +683,16 @@ export interface components {
703
683
  /** Format: double */
704
684
  apy: number;
705
685
  /** Format: double */
706
- usd_volume_24h?: number | null;
686
+ volume_24h?: number | null;
707
687
  outcomes: components["schemas"]["BondOutcome"][];
708
688
  };
709
689
  BondOutcome: {
710
690
  name: string;
711
691
  /** Format: int32 */
712
692
  index: number;
693
+ position_id: string;
713
694
  /** Format: double */
714
695
  price: number;
715
- position_id: string;
716
696
  };
717
697
  /** @enum {string} */
718
698
  CandlestickResolution: "1" | "5" | "15" | "30" | "60" | "240" | "D" | "1D";
@@ -741,64 +721,6 @@ export interface components {
741
721
  /** Format: int32 */
742
722
  unique_traders: number;
743
723
  };
744
- /** @description Holder data for event-level queries (aggregated across markets) */
745
- EventHolder: {
746
- /** @description Trader profile information */
747
- trader: components["schemas"]["Trader"];
748
- /** @description Total shares across all positions in this event */
749
- total_shares: string;
750
- /** @description USD value of all shares (sum of shares * price per position) */
751
- shares_usd?: string | null;
752
- /**
753
- * Format: int32
754
- * @description Number of distinct positions held
755
- */
756
- position_count: number;
757
- /** @description USD balance (USDe on Polygon) */
758
- usd_balance?: string | null;
759
- /**
760
- * Format: double
761
- * @description Lifetime realized PnL in USD
762
- */
763
- realized_pnl_usd?: number | null;
764
- };
765
- /** @description Event-level PnL data for a holder */
766
- EventHolderPnl: {
767
- /** Format: double */
768
- realized_pnl_usd?: number | null;
769
- /** Format: double */
770
- total_volume_usd?: number | null;
771
- /** Format: double */
772
- buy_usd?: number | null;
773
- /** Format: double */
774
- sell_usd?: number | null;
775
- /** Format: double */
776
- total_fees?: number | null;
777
- /** Format: int64 */
778
- markets_traded?: number | null;
779
- /** Format: int64 */
780
- winning_markets?: number | null;
781
- /** Format: int64 */
782
- losing_markets?: number | null;
783
- /** Format: int64 */
784
- first_trade_at?: number | null;
785
- /** Format: int64 */
786
- last_trade_at?: number | null;
787
- };
788
- /** @description Response for event holders endpoint */
789
- EventHoldersResponse: {
790
- /** @description Event slug */
791
- event_slug: string;
792
- /** @description Event title */
793
- title?: string | null;
794
- /**
795
- * Format: int64
796
- * @description Total unique holders across all markets (from holder_stats)
797
- */
798
- total_holders: number;
799
- /** @description Top holders across all markets */
800
- holders: components["schemas"]["EventHolder"][];
801
- };
802
724
  /** @description Enriched market data for event API responses */
803
725
  EventMarket: {
804
726
  /** @default */
@@ -810,14 +732,19 @@ export interface components {
810
732
  /** @default */
811
733
  question: string;
812
734
  /** @default */
813
- slug: string;
735
+ market_slug: string;
814
736
  /** @default */
815
737
  status: string;
816
738
  /**
817
739
  * Format: int64
818
740
  * @default null
819
741
  */
820
- end_date: number | null;
742
+ created_time: number | null;
743
+ /**
744
+ * Format: int64
745
+ * @default null
746
+ */
747
+ end_time: number | null;
821
748
  /**
822
749
  * Format: double
823
750
  * @default null
@@ -845,13 +772,29 @@ export interface components {
845
772
  clob_rewards: components["schemas"]["ClobReward"][];
846
773
  /** @default [] */
847
774
  outcomes: components["schemas"]["EventMarketOutcome"][];
775
+ /** @default null */
776
+ winning_outcome: null | components["schemas"]["EventMarketOutcome"];
777
+ };
778
+ EventMarketChartDataPoint: {
779
+ /** Format: double */
780
+ value: number;
781
+ /** Format: int64 */
782
+ timestamp: number;
783
+ };
784
+ EventMarketChartOutcome: {
785
+ condition_id: string;
786
+ market_slug: string;
787
+ name: string;
788
+ data: components["schemas"]["EventMarketChartDataPoint"][];
848
789
  };
849
- /** @description Market outcome with probability for event API responses */
790
+ /** @description Market outcome for event API responses */
850
791
  EventMarketOutcome: {
851
792
  name: string;
852
793
  /** Format: double */
853
- probability?: number | null;
794
+ price?: number | null;
854
795
  position_id?: string | null;
796
+ /** Format: int32 */
797
+ outcome_index?: number | null;
855
798
  };
856
799
  /** @description Response type for event metrics query */
857
800
  EventMetricsResponse: {
@@ -936,11 +879,7 @@ export interface components {
936
879
  shares_usd?: string | null;
937
880
  /** @description USD balance of wallet (USDe on Polygon) */
938
881
  usd_balance?: string | null;
939
- /**
940
- * Format: double
941
- * @description Lifetime realized PnL in USD
942
- */
943
- realized_pnl_usd?: number | null;
882
+ pnl?: null | components["schemas"]["PositionHolderPnl"];
944
883
  };
945
884
  /** @description Holder statistics data point (single time bucket) */
946
885
  HolderHistoryCandle: {
@@ -1051,10 +990,74 @@ export interface components {
1051
990
  };
1052
991
  /** @enum {string} */
1053
992
  MarketPnlSortBy: "realized_pnl_usd" | "buy_usd" | "total_buys" | "total_fees" | "outcomes_traded";
993
+ /** @description Formatted market response with structured metrics, tags, outcomes, and event */
994
+ MarketResponse: {
995
+ condition_id: string;
996
+ id?: string | null;
997
+ market_slug?: string | null;
998
+ question?: string | null;
999
+ title?: string | null;
1000
+ description?: string | null;
1001
+ image_url?: string | null;
1002
+ oracle?: string | null;
1003
+ status: string;
1004
+ /** Format: int64 */
1005
+ created_time?: number | null;
1006
+ /** Format: int64 */
1007
+ start_time?: number | null;
1008
+ /** Format: int64 */
1009
+ game_start_time?: number | null;
1010
+ /** Format: int64 */
1011
+ closed_time?: number | null;
1012
+ /** Format: int64 */
1013
+ end_time?: number | null;
1014
+ accepting_orders?: boolean | null;
1015
+ uma_resolution_status?: string | null;
1016
+ is_neg_risk?: boolean | null;
1017
+ market_maker_address?: string | null;
1018
+ creator?: string | null;
1019
+ category?: string | null;
1020
+ /** Format: double */
1021
+ volume_usd?: number | null;
1022
+ /** Format: double */
1023
+ liquidity_usd?: number | null;
1024
+ /** Format: double */
1025
+ highest_probability?: number | null;
1026
+ /** Format: int64 */
1027
+ total_holders?: number | null;
1028
+ winning_outcome?: null | components["schemas"]["MarketOutcome"];
1029
+ outcomes?: components["schemas"]["MarketOutcome"][];
1030
+ rewards?: components["schemas"]["MarketReward"][];
1031
+ clob_rewards?: components["schemas"]["ClobReward"][];
1032
+ tags?: string[];
1033
+ event_slug?: string | null;
1034
+ resolution_source?: string | null;
1035
+ metrics?: {
1036
+ [key: string]: components["schemas"]["SimpleTimeframeMetrics"];
1037
+ };
1038
+ };
1039
+ /** @description Reward info for market API responses */
1040
+ MarketReward: {
1041
+ /**
1042
+ * Format: double
1043
+ * @default null
1044
+ */
1045
+ min_size: number | null;
1046
+ /**
1047
+ * Format: double
1048
+ * @default null
1049
+ */
1050
+ max_spread: number | null;
1051
+ /**
1052
+ * Format: double
1053
+ * @default null
1054
+ */
1055
+ daily_rate: number | null;
1056
+ };
1054
1057
  /** @enum {string} */
1055
1058
  MarketSortBy: "volume" | "txns" | "unique_traders" | "liquidity" | "holders" | "end_time" | "start_time" | "created_time" | "created_at" | "relevance";
1056
1059
  /** @enum {string} */
1057
- MarketStatus: "open" | "closed";
1060
+ MarketStatus: "open" | "closed" | "all";
1058
1061
  MarketVolumeChartResponse: {
1059
1062
  volumes: components["schemas"]["MarketVolumeDataPoint"][];
1060
1063
  has_more: boolean;
@@ -1134,11 +1137,6 @@ export interface components {
1134
1137
  * @default 0
1135
1138
  */
1136
1139
  sells: number;
1137
- /**
1138
- * Format: double
1139
- * @default 0
1140
- */
1141
- open_interest_change: number;
1142
1140
  /**
1143
1141
  * Format: double
1144
1142
  * @default null
@@ -1194,7 +1192,7 @@ export interface components {
1194
1192
  /** @default */
1195
1193
  id: string;
1196
1194
  /** @default null */
1197
- slug: string | null;
1195
+ event_slug: string | null;
1198
1196
  /** @default null */
1199
1197
  title: string | null;
1200
1198
  /** @default null */
@@ -1216,12 +1214,22 @@ export interface components {
1216
1214
  * Format: int64
1217
1215
  * @default null
1218
1216
  */
1219
- start_date: number | null;
1217
+ created_time: number | null;
1220
1218
  /**
1221
1219
  * Format: int64
1222
1220
  * @default null
1223
1221
  */
1224
- end_date: number | null;
1222
+ closed_time: number | null;
1223
+ /**
1224
+ * Format: int64
1225
+ * @default null
1226
+ */
1227
+ start_time: number | null;
1228
+ /**
1229
+ * Format: int64
1230
+ * @default null
1231
+ */
1232
+ end_time: number | null;
1225
1233
  /** @default false */
1226
1234
  neg_risk: boolean;
1227
1235
  /** @default null */
@@ -1245,16 +1253,6 @@ export interface components {
1245
1253
  markets: components["schemas"]["EventMarket"][];
1246
1254
  /** @default null */
1247
1255
  series: null | components["schemas"]["PolymarketSeries"];
1248
- /**
1249
- * Format: int64
1250
- * @default null
1251
- */
1252
- creation_date: number | null;
1253
- /**
1254
- * Format: int64
1255
- * @default null
1256
- */
1257
- closed_time: number | null;
1258
1256
  };
1259
1257
  /**
1260
1258
  * @description A Polymarket series from the Gamma API
@@ -1330,22 +1328,41 @@ export interface components {
1330
1328
  is_mod: boolean;
1331
1329
  created_at?: string | null;
1332
1330
  };
1333
- /** @description PnL data for a holder (position-level) */
1334
- PositionHolderPnl: {
1331
+ PositionChartDataPoint: {
1335
1332
  /** Format: double */
1336
- realized_pnl_usd?: number | null;
1333
+ value: number;
1334
+ /** Format: int64 */
1335
+ timestamp: number;
1336
+ };
1337
+ PositionChartOutcome: {
1338
+ position_id: string;
1339
+ name: string;
1340
+ /** Format: int32 */
1341
+ outcome_index: number;
1342
+ data: components["schemas"]["PositionChartDataPoint"][];
1343
+ };
1344
+ /** @description Position-level PnL data for a holder (outcome token, OrderFilled trades only) */
1345
+ PositionHolderPnl: {
1337
1346
  /** Format: double */
1338
1347
  buy_usd?: number | null;
1339
1348
  /** Format: double */
1340
1349
  sell_usd?: number | null;
1341
- /** Format: double */
1342
- total_fees?: number | null;
1343
- /** Format: double */
1344
- net_shares?: number | null;
1350
+ /**
1351
+ * Format: double
1352
+ * @description Average price paid per share across all buys (0–1 range)
1353
+ */
1354
+ avg_entry_price?: number | null;
1355
+ /**
1356
+ * Format: double
1357
+ * @description Average price received per share across all sells (0–1 range)
1358
+ */
1359
+ avg_exit_price?: number | null;
1345
1360
  /** Format: int64 */
1346
- buy_count?: number | null;
1361
+ total_buys?: number | null;
1347
1362
  /** Format: int64 */
1348
- sell_count?: number | null;
1363
+ total_sells?: number | null;
1364
+ /** Format: double */
1365
+ total_fees?: number | null;
1349
1366
  /** Format: int64 */
1350
1367
  first_trade_at?: number | null;
1351
1368
  /** Format: int64 */
@@ -1407,6 +1424,8 @@ export interface components {
1407
1424
  /** Format: double */
1408
1425
  price_close: number;
1409
1426
  };
1427
+ /** @enum {string} */
1428
+ PositionPnlSortBy: "realized_pnl_usd" | "buy_usd" | "sell_usd" | "total_buys" | "total_sells" | "total_fees";
1410
1429
  PositionVolumeChartResponse: {
1411
1430
  volumes: components["schemas"]["PositionVolumeDataPoint"][];
1412
1431
  has_more: boolean;
@@ -1445,10 +1464,6 @@ export interface components {
1445
1464
  /** Format: double */
1446
1465
  m?: number | null;
1447
1466
  };
1448
- PredictionCandlestickResponseData: {
1449
- candles: components["schemas"]["PredictionCandlestickBar"][];
1450
- has_more: boolean;
1451
- };
1452
1467
  /** @description Response format for prediction trades */
1453
1468
  PredictionTradeResponse: {
1454
1469
  id: string;
@@ -1527,11 +1542,6 @@ export interface components {
1527
1542
  * @default 0
1528
1543
  */
1529
1544
  unique_traders: number;
1530
- /**
1531
- * Format: double
1532
- * @default 0
1533
- */
1534
- open_interest_change: number;
1535
1545
  };
1536
1546
  /** @enum {string} */
1537
1547
  SortDirection: "asc" | "desc";
@@ -1562,6 +1572,44 @@ export interface components {
1562
1572
  x_username?: string | null;
1563
1573
  verified_badge?: boolean;
1564
1574
  };
1575
+ /** @description Event-level PnL entry */
1576
+ TraderEventPnlEntry: {
1577
+ event_slug?: string | null;
1578
+ /** Format: int64 */
1579
+ markets_traded?: number | null;
1580
+ /** Format: int64 */
1581
+ outcomes_traded?: number | null;
1582
+ /** Format: int64 */
1583
+ total_buys?: number | null;
1584
+ /** Format: int64 */
1585
+ total_sells?: number | null;
1586
+ /** Format: int64 */
1587
+ total_redemptions?: number | null;
1588
+ /** Format: int64 */
1589
+ total_merges?: number | null;
1590
+ /** Format: double */
1591
+ total_volume_usd?: number | null;
1592
+ /** Format: double */
1593
+ buy_usd?: number | null;
1594
+ /** Format: double */
1595
+ sell_usd?: number | null;
1596
+ /** Format: double */
1597
+ redemption_usd?: number | null;
1598
+ /** Format: double */
1599
+ merge_usd?: number | null;
1600
+ /** Format: double */
1601
+ realized_pnl_usd?: number | null;
1602
+ /** Format: int64 */
1603
+ winning_markets?: number | null;
1604
+ /** Format: int64 */
1605
+ losing_markets?: number | null;
1606
+ /** Format: double */
1607
+ total_fees?: number | null;
1608
+ /** Format: int64 */
1609
+ first_trade_at?: number | null;
1610
+ /** Format: int64 */
1611
+ last_trade_at?: number | null;
1612
+ };
1565
1613
  /** @description Trader profile info - backwards compatibility */
1566
1614
  TraderInfo: {
1567
1615
  address: string;
@@ -1571,6 +1619,72 @@ export interface components {
1571
1619
  x_username?: string | null;
1572
1620
  verified_badge?: boolean;
1573
1621
  };
1622
+ /** @description Market-level PnL entry */
1623
+ TraderMarketPnlEntry: {
1624
+ condition_id?: string | null;
1625
+ event_slug?: string | null;
1626
+ /** Format: int64 */
1627
+ outcomes_traded?: number | null;
1628
+ /** Format: int64 */
1629
+ total_buys?: number | null;
1630
+ /** Format: int64 */
1631
+ total_sells?: number | null;
1632
+ /** Format: int64 */
1633
+ total_redemptions?: number | null;
1634
+ /** Format: int64 */
1635
+ total_merges?: number | null;
1636
+ /** Format: double */
1637
+ buy_usd?: number | null;
1638
+ /** Format: double */
1639
+ sell_usd?: number | null;
1640
+ /** Format: double */
1641
+ redemption_usd?: number | null;
1642
+ /** Format: double */
1643
+ merge_usd?: number | null;
1644
+ /** Format: double */
1645
+ realized_pnl_usd?: number | null;
1646
+ /** Format: int64 */
1647
+ winning_outcomes?: number | null;
1648
+ /** Format: double */
1649
+ total_fees?: number | null;
1650
+ /** Format: int64 */
1651
+ first_trade_at?: number | null;
1652
+ /** Format: int64 */
1653
+ last_trade_at?: number | null;
1654
+ };
1655
+ /** @description Outcome-level PnL entry (per outcome token / position_id, OrderFilled trades only) */
1656
+ TraderOutcomePnlEntry: {
1657
+ position_id?: string | null;
1658
+ condition_id?: string | null;
1659
+ event_slug?: string | null;
1660
+ outcome?: string | null;
1661
+ /** Format: int32 */
1662
+ outcome_index?: number | null;
1663
+ /** Format: int64 */
1664
+ total_buys?: number | null;
1665
+ /** Format: int64 */
1666
+ total_sells?: number | null;
1667
+ /** Format: double */
1668
+ buy_usd?: number | null;
1669
+ /** Format: double */
1670
+ sell_usd?: number | null;
1671
+ /**
1672
+ * Format: double
1673
+ * @description VWAP price paid per share across all buys (0–1)
1674
+ */
1675
+ avg_entry_price?: number | null;
1676
+ /**
1677
+ * Format: double
1678
+ * @description VWAP price received per share across all sells (0–1)
1679
+ */
1680
+ avg_exit_price?: number | null;
1681
+ /** Format: double */
1682
+ total_fees?: number | null;
1683
+ /** Format: int64 */
1684
+ first_trade_at?: number | null;
1685
+ /** Format: int64 */
1686
+ last_trade_at?: number | null;
1687
+ };
1574
1688
  TraderVolumeChartResponse: {
1575
1689
  volumes: components["schemas"]["TraderVolumeDataPoint"][];
1576
1690
  has_more: boolean;
@@ -1603,19 +1717,19 @@ export interface operations {
1603
1717
  get_events: {
1604
1718
  parameters: {
1605
1719
  query?: {
1606
- /** @description Filter by event ID(s) - comma-separated (max 50). Cannot be used with 'slug'. Example: id=99600,99601,99583 */
1720
+ /** @description Filter by event ID(s) - comma-separated (max 50). Cannot be used with 'event_slugs'. Example: id=99600,99601,99583 */
1607
1721
  id?: string;
1608
- /** @description Filter by event slug(s) - comma-separated (max 50). Cannot be used with 'id'. Example: slug=will-trump-win,bitcoin-100k */
1609
- slug?: string;
1722
+ /** @description Filter by event slug(s) - comma-separated (max 50). Cannot be used with 'id'. Example: event_slugs=will-trump-win,bitcoin-100k */
1723
+ event_slugs?: string;
1610
1724
  /** @description Search in title and description (3-100 characters). Example: search=trump */
1611
1725
  search?: string;
1612
- /** @description Sort: volume, txns, unique_traders, title, creation_date, start_date, end_date, relevance (relevance only works in search mode) */
1726
+ /** @description Sort: volume, txns, unique_traders, title, creation_date, start_date, end_date, relevance (relevance only works in search mode) (default: volume) */
1613
1727
  sort_by?: components["schemas"]["EventSortBy"];
1614
- /** @description Sort direction: asc, desc */
1728
+ /** @description Sort direction: asc, desc (default: desc) */
1615
1729
  sort_dir?: components["schemas"]["SortDirection"];
1616
- /** @description Metrics timeframe: 1m, 5m, 30m, 1h, 6h, 24h, 7d, 30d */
1730
+ /** @description Metrics timeframe: 1m, 5m, 30m, 1h, 6h, 24h, 7d, 30d (default: 24h) */
1617
1731
  timeframe?: components["schemas"]["MetricsTimeframe"];
1618
- /** @description Filter by status: open or closed */
1732
+ /** @description Filter by status: open, closed, or all (default: all) */
1619
1733
  status?: components["schemas"]["MarketStatus"];
1620
1734
  /** @description Comma-separated category filters */
1621
1735
  categories?: string;
@@ -1672,13 +1786,27 @@ export interface operations {
1672
1786
  };
1673
1787
  };
1674
1788
  };
1675
- get_event_metrics: {
1789
+ get_event_chart: {
1676
1790
  parameters: {
1677
1791
  query: {
1678
- /** @description Event slug */
1792
+ /** @description Event slug (required) */
1679
1793
  event_slug: string;
1680
- /** @description Timeframe: single (1m, 5m, 30m, 1h, 6h, 24h, 7d, 30d), comma-separated (1m,5m,1h), or 'all' */
1681
- timeframe: string;
1794
+ /** @description Comma-separated condition IDs to include (max 4, optional) */
1795
+ condition_ids?: string;
1796
+ /** @description Comma-separated market slugs to include (max 4, optional). Use either condition_ids or market_slugs, not both */
1797
+ market_slugs?: string;
1798
+ /** @description Number of top markets to include if neither condition_ids nor market_slugs specified (max 4, default: 4) */
1799
+ limit?: number;
1800
+ /** @description Time interval: 1, 5, 15, 30, 60, 240, D, 1D (default: 60) */
1801
+ resolution?: components["schemas"]["CandlestickResolution"];
1802
+ /** @description Number of data points (max: 2500) */
1803
+ count_back?: number;
1804
+ /** @description Start timestamp (Unix seconds) */
1805
+ from?: number;
1806
+ /** @description End timestamp (Unix seconds) */
1807
+ to?: number;
1808
+ /** @description Cursor-based pagination key for fetching next page */
1809
+ pagination_key?: string;
1682
1810
  };
1683
1811
  header?: never;
1684
1812
  path?: never;
@@ -1686,97 +1814,48 @@ export interface operations {
1686
1814
  };
1687
1815
  requestBody?: never;
1688
1816
  responses: {
1689
- /** @description Event metrics for the specified timeframe(s). Returns single object for one timeframe, array for multiple. */
1817
+ /** @description Price data over time for up to 4 markets with highest YES odds */
1690
1818
  200: {
1691
1819
  headers: {
1692
1820
  [name: string]: unknown;
1693
1821
  };
1694
1822
  content: {
1695
- "application/json": components["schemas"]["EventMetricsResponse"];
1823
+ "application/json": components["schemas"]["EventMarketChartOutcome"][];
1696
1824
  };
1697
1825
  };
1698
- /** @description Invalid timeframe */
1699
- 400: {
1700
- headers: {
1701
- [name: string]: unknown;
1702
- };
1703
- content?: never;
1704
- };
1705
- /** @description Event metrics not found */
1706
- 404: {
1707
- headers: {
1708
- [name: string]: unknown;
1709
- };
1710
- content?: never;
1711
- };
1712
1826
  };
1713
1827
  };
1714
- get_event_holders: {
1828
+ get_event_metrics: {
1715
1829
  parameters: {
1716
- query?: {
1717
- /** @description Results limit (default: 10, max: 100) */
1718
- limit?: number;
1719
- /** @description Cursor-based pagination key (base64-encoded, obtained from previous response's pagination.pagination_key) */
1720
- pagination_key?: string;
1721
- /** @description Minimum total shares held (decimal string) */
1722
- min_shares?: string;
1723
- /** @description Maximum total shares held (decimal string) */
1724
- max_shares?: string;
1725
- /** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
1726
- timeframe?: components["schemas"]["PnlTimeframe"];
1727
- };
1728
- header?: never;
1729
- path: {
1830
+ query: {
1730
1831
  /** @description Event slug */
1731
1832
  event_slug: string;
1833
+ /** @description Timeframe: single (1m, 5m, 30m, 1h, 6h, 24h, 7d, 30d), comma-separated (1m,5m,1h), or 'all' */
1834
+ timeframe: string;
1732
1835
  };
1836
+ header?: never;
1837
+ path?: never;
1733
1838
  cookie?: never;
1734
1839
  };
1735
1840
  requestBody?: never;
1736
1841
  responses: {
1737
- /** @description Event holders aggregated across markets (sorted by total_shares DESC). Response includes `pagination: { has_more, pagination_key }` for cursor-based pagination. */
1842
+ /** @description Event metrics for the specified timeframe(s). Returns single object for one timeframe, array for multiple. */
1738
1843
  200: {
1739
1844
  headers: {
1740
1845
  [name: string]: unknown;
1741
1846
  };
1742
1847
  content: {
1743
- "application/json": components["schemas"]["EventHoldersResponse"];
1848
+ "application/json": components["schemas"]["EventMetricsResponse"];
1744
1849
  };
1745
1850
  };
1746
- /** @description Event not found */
1747
- 404: {
1851
+ /** @description Invalid timeframe */
1852
+ 400: {
1748
1853
  headers: {
1749
1854
  [name: string]: unknown;
1750
1855
  };
1751
1856
  content?: never;
1752
1857
  };
1753
- };
1754
- };
1755
- get_event_holders_history: {
1756
- parameters: {
1757
- query?: {
1758
- /** @description Time range in hours (default: 24, max: 336 = 14 days) */
1759
- hours?: number;
1760
- };
1761
- header?: never;
1762
- path: {
1763
- /** @description Event slug */
1764
- event_slug: string;
1765
- };
1766
- cookie?: never;
1767
- };
1768
- requestBody?: never;
1769
- responses: {
1770
- /** @description Event holder count history with automatic view selection (1m/5m/15m/1h/6h buckets) */
1771
- 200: {
1772
- headers: {
1773
- [name: string]: unknown;
1774
- };
1775
- content: {
1776
- "application/json": components["schemas"]["HolderHistoryCandle"][];
1777
- };
1778
- };
1779
- /** @description Event not found */
1858
+ /** @description Event metrics not found */
1780
1859
  404: {
1781
1860
  headers: {
1782
1861
  [name: string]: unknown;
@@ -1788,25 +1867,24 @@ export interface operations {
1788
1867
  get_market_holders: {
1789
1868
  parameters: {
1790
1869
  query?: {
1870
+ /** @description Market condition ID (0x-prefixed hex) */
1871
+ condition_id?: string;
1872
+ /** @description Market slug (e.g. `will-trump-win`) */
1873
+ market_slug?: string;
1791
1874
  /** @description Results limit (default: 10, max: 100) */
1792
1875
  limit?: number;
1793
1876
  /** @description Minimum shares held (decimal string) */
1794
1877
  min_shares?: string;
1795
1878
  /** @description Maximum shares held (decimal string) */
1796
1879
  max_shares?: string;
1797
- /** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
1798
- timeframe?: components["schemas"]["PnlTimeframe"];
1799
1880
  };
1800
1881
  header?: never;
1801
- path: {
1802
- /** @description Market condition ID */
1803
- condition_id: string;
1804
- };
1882
+ path?: never;
1805
1883
  cookie?: never;
1806
1884
  };
1807
1885
  requestBody?: never;
1808
1886
  responses: {
1809
- /** @description Market holders grouped by outcome (sorted by shares DESC) */
1887
+ /** @description Market holders grouped by outcome (sorted by shares DESC). Each holder has `pnl: PositionHolderPnl` with outcome-specific trading stats. */
1810
1888
  200: {
1811
1889
  headers: {
1812
1890
  [name: string]: unknown;
@@ -1827,14 +1905,15 @@ export interface operations {
1827
1905
  get_market_holders_history: {
1828
1906
  parameters: {
1829
1907
  query?: {
1908
+ /** @description Market condition ID (0x-prefixed hex) */
1909
+ condition_id?: string;
1910
+ /** @description Market slug (e.g. `will-trump-win`) */
1911
+ market_slug?: string;
1830
1912
  /** @description Time range in hours (default: 24, max: 336 = 14 days) */
1831
1913
  hours?: number;
1832
1914
  };
1833
1915
  header?: never;
1834
- path: {
1835
- /** @description Market condition ID */
1836
- condition_id: string;
1837
- };
1916
+ path?: never;
1838
1917
  cookie?: never;
1839
1918
  };
1840
1919
  requestBody?: never;
@@ -1878,7 +1957,7 @@ export interface operations {
1878
1957
  };
1879
1958
  requestBody?: never;
1880
1959
  responses: {
1881
- /** @description Position holders (sorted by shares DESC). Response includes `pagination: { has_more, pagination_key }` for cursor-based pagination. */
1960
+ /** @description Position holders (sorted by shares DESC). Each holder has `pnl: PositionHolderPnl` with outcome-specific trading stats. Response includes `pagination: { has_more, pagination_key }` for cursor-based pagination. */
1882
1961
  200: {
1883
1962
  headers: {
1884
1963
  [name: string]: unknown;
@@ -1946,7 +2025,7 @@ export interface operations {
1946
2025
  position_ids?: string;
1947
2026
  /** @description Search in title (3-100 characters) */
1948
2027
  search?: string;
1949
- /** @description Filter by status: open or closed */
2028
+ /** @description Filter by status: open, closed, or all (default: all) */
1950
2029
  status?: components["schemas"]["MarketStatus"];
1951
2030
  /** @description Sort: volume, txns, unique_traders, liquidity, holders, end_time, start_time, created_time, created_at, relevance */
1952
2031
  sort_by?: components["schemas"]["MarketSortBy"];
@@ -2074,7 +2153,44 @@ export interface operations {
2074
2153
  [name: string]: unknown;
2075
2154
  };
2076
2155
  content: {
2077
- "application/json": components["schemas"]["PredictionCandlestickResponseData"];
2156
+ "application/json": components["schemas"]["PredictionCandlestickBar"][];
2157
+ };
2158
+ };
2159
+ };
2160
+ };
2161
+ get_chart: {
2162
+ parameters: {
2163
+ query?: {
2164
+ /** @description Market condition ID or market_slug (one required) */
2165
+ condition_id?: string;
2166
+ /** @description Market slug (alternative to condition_id) */
2167
+ market_slug?: string;
2168
+ /** @description Comma-separated list of position IDs (max 4, optional). Auto-selected if not provided */
2169
+ position_ids?: string;
2170
+ /** @description Time interval: 1, 5, 15, 30, 60, 240, D, 1D (default: 60) */
2171
+ resolution?: components["schemas"]["CandlestickResolution"];
2172
+ /** @description Number of data points (max: 2500) */
2173
+ count_back?: number;
2174
+ /** @description Start timestamp (Unix seconds) */
2175
+ from?: number;
2176
+ /** @description End timestamp (Unix seconds) */
2177
+ to?: number;
2178
+ /** @description Cursor-based pagination key for fetching next page */
2179
+ pagination_key?: string;
2180
+ };
2181
+ header?: never;
2182
+ path?: never;
2183
+ cookie?: never;
2184
+ };
2185
+ requestBody?: never;
2186
+ responses: {
2187
+ /** @description Price data over time for up to 4 market outcomes */
2188
+ 200: {
2189
+ headers: {
2190
+ [name: string]: unknown;
2191
+ };
2192
+ content: {
2193
+ "application/json": components["schemas"]["PositionChartOutcome"][];
2078
2194
  };
2079
2195
  };
2080
2196
  };
@@ -2144,7 +2260,7 @@ export interface operations {
2144
2260
  [name: string]: unknown;
2145
2261
  };
2146
2262
  content: {
2147
- "application/json": components["schemas"]["PredictionCandlestickResponseData"];
2263
+ "application/json": components["schemas"]["PredictionCandlestickBar"][];
2148
2264
  };
2149
2265
  };
2150
2266
  };
@@ -2214,7 +2330,7 @@ export interface operations {
2214
2330
  [name: string]: unknown;
2215
2331
  };
2216
2332
  content: {
2217
- "application/json": components["schemas"]["PositionVolumeChartResponse"];
2333
+ "application/json": components["schemas"]["PositionVolumeDataPoint"][];
2218
2334
  };
2219
2335
  };
2220
2336
  };
@@ -2282,9 +2398,11 @@ export interface operations {
2282
2398
  };
2283
2399
  get_market_volume_chart: {
2284
2400
  parameters: {
2285
- query: {
2286
- /** @description Market condition ID (required) */
2287
- condition_id: string;
2401
+ query?: {
2402
+ /** @description Market condition ID (or use market_slug) */
2403
+ condition_id?: string;
2404
+ /** @description Market slug (alternative to condition_id) */
2405
+ market_slug?: string;
2288
2406
  /** @description Time interval: 1, 5, 15, 30, 60, 240, D, 1D (default: 60) */
2289
2407
  resolution?: components["schemas"]["CandlestickResolution"];
2290
2408
  /** @description Number of data points (max: 2500) */
@@ -2306,7 +2424,7 @@ export interface operations {
2306
2424
  [name: string]: unknown;
2307
2425
  };
2308
2426
  content: {
2309
- "application/json": components["schemas"]["MarketVolumeChartResponse"];
2427
+ "application/json": components["schemas"]["MarketVolumeDataPoint"][];
2310
2428
  };
2311
2429
  };
2312
2430
  };
@@ -2598,8 +2716,8 @@ export interface operations {
2598
2716
  sort_direction?: components["schemas"]["SortDirection"];
2599
2717
  /** @description Results limit (default: 10, max: 200) */
2600
2718
  limit?: number;
2601
- /** @description Offset-based pagination key */
2602
- pagination_key?: number;
2719
+ /** @description Cursor-based pagination key (base64-encoded, from previous response) */
2720
+ pagination_key?: string;
2603
2721
  /** @description Filter by event slug */
2604
2722
  event_slug?: string;
2605
2723
  };
@@ -2612,12 +2730,14 @@ export interface operations {
2612
2730
  };
2613
2731
  requestBody?: never;
2614
2732
  responses: {
2615
- /** @description Event-level PnL entries for this trader. Response includes `pagination: { has_more, pagination_key }` for offset-based pagination. */
2733
+ /** @description Event-level PnL entries for this trader */
2616
2734
  200: {
2617
2735
  headers: {
2618
2736
  [name: string]: unknown;
2619
2737
  };
2620
- content?: never;
2738
+ content: {
2739
+ "application/json": components["schemas"]["TraderEventPnlEntry"][];
2740
+ };
2621
2741
  };
2622
2742
  };
2623
2743
  };
@@ -2632,10 +2752,12 @@ export interface operations {
2632
2752
  sort_direction?: components["schemas"]["SortDirection"];
2633
2753
  /** @description Results limit (default: 10, max: 200) */
2634
2754
  limit?: number;
2635
- /** @description Offset-based pagination key */
2636
- pagination_key?: number;
2637
- /** @description Filter by condition ID */
2755
+ /** @description Cursor-based pagination key (base64-encoded, from previous response) */
2756
+ pagination_key?: string;
2757
+ /** @description Filter by condition ID (or use market_slug) */
2638
2758
  condition_id?: string;
2759
+ /** @description Filter by market slug (alternative to condition_id) */
2760
+ market_slug?: string;
2639
2761
  /** @description Filter by event slug */
2640
2762
  event_slug?: string;
2641
2763
  };
@@ -2648,54 +2770,36 @@ export interface operations {
2648
2770
  };
2649
2771
  requestBody?: never;
2650
2772
  responses: {
2651
- /** @description Market-level PnL entries for this trader. Response includes `pagination: { has_more, pagination_key }` for offset-based pagination. */
2773
+ /** @description Market-level PnL entries for this trader */
2652
2774
  200: {
2653
2775
  headers: {
2654
2776
  [name: string]: unknown;
2655
2777
  };
2656
- content?: never;
2657
- };
2658
- };
2659
- };
2660
- get_portfolio: {
2661
- parameters: {
2662
- query?: {
2663
- /** @description Stats timeframe: 7d, 30d, lifetime */
2664
- timeframe?: components["schemas"]["PnlTimeframe"];
2665
- };
2666
- header?: never;
2667
- path: {
2668
- /** @description Trader wallet address */
2669
- address: string;
2670
- };
2671
- cookie?: never;
2672
- };
2673
- requestBody?: never;
2674
- responses: {
2675
- /** @description Full portfolio with stats, positions, and PnL chart. Positions include `pagination: { has_more, pagination_key }` for offset-based pagination. */
2676
- 200: {
2677
- headers: {
2678
- [name: string]: unknown;
2778
+ content: {
2779
+ "application/json": components["schemas"]["TraderMarketPnlEntry"][];
2679
2780
  };
2680
- content?: never;
2681
2781
  };
2682
2782
  };
2683
2783
  };
2684
- get_portfolio_positions: {
2784
+ get_trader_position_pnl: {
2685
2785
  parameters: {
2686
2786
  query?: {
2687
- /** @description Sort field: shares_usd (default), shares, realized_pnl_usd, price, buy_usd */
2688
- sort_by?: string;
2787
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
2788
+ timeframe?: components["schemas"]["PnlTimeframe"];
2789
+ /** @description Sort: realized_pnl_usd, buy_usd, sell_usd, total_buys, total_sells, total_fees (default: realized_pnl_usd) */
2790
+ sort_by?: components["schemas"]["PositionPnlSortBy"];
2689
2791
  /** @description Sort direction: asc, desc (default: desc) */
2690
2792
  sort_direction?: components["schemas"]["SortDirection"];
2691
- /** @description Filter by condition ID */
2692
- condition_id?: string;
2693
- /** @description Filter by event slug */
2694
- event_slug?: string;
2695
- /** @description Results limit (default: 50, max: 200) */
2793
+ /** @description Results limit (default: 10, max: 200) */
2696
2794
  limit?: number;
2697
- /** @description Offset-based pagination key (integer offset into result set) */
2698
- pagination_key?: number;
2795
+ /** @description Cursor-based pagination key (base64-encoded, from previous response) */
2796
+ pagination_key?: string;
2797
+ /** @description Filter by market condition ID (or use market_slug) */
2798
+ condition_id?: string;
2799
+ /** @description Filter by market slug (alternative to condition_id) */
2800
+ market_slug?: string;
2801
+ /** @description Filter by specific outcome token (position ID) */
2802
+ position_id?: string;
2699
2803
  };
2700
2804
  header?: never;
2701
2805
  path: {
@@ -2706,12 +2810,14 @@ export interface operations {
2706
2810
  };
2707
2811
  requestBody?: never;
2708
2812
  responses: {
2709
- /** @description Trader positions with market metadata and PnL. Response includes `pagination: { has_more, pagination_key }` for offset-based pagination. */
2813
+ /** @description Position-level PnL entries for this trader. Each entry is a specific outcome token with avg_entry_price and avg_exit_price. */
2710
2814
  200: {
2711
2815
  headers: {
2712
2816
  [name: string]: unknown;
2713
2817
  };
2714
- content?: never;
2818
+ content: {
2819
+ "application/json": components["schemas"]["TraderOutcomePnlEntry"][];
2820
+ };
2715
2821
  };
2716
2822
  };
2717
2823
  };
@@ -2757,7 +2863,7 @@ export interface operations {
2757
2863
  };
2758
2864
  requestBody?: never;
2759
2865
  responses: {
2760
- /** @description Map of trader addresses to their profile information */
2866
+ /** @description Array of trader profiles */
2761
2867
  200: {
2762
2868
  headers: {
2763
2869
  [name: string]: unknown;
@@ -2864,7 +2970,7 @@ export interface operations {
2864
2970
  [name: string]: unknown;
2865
2971
  };
2866
2972
  content: {
2867
- "application/json": components["schemas"]["TraderVolumeChartResponse"];
2973
+ "application/json": components["schemas"]["TraderVolumeDataPoint"][];
2868
2974
  };
2869
2975
  };
2870
2976
  };