@structbuild/sdk 0.2.4 → 0.2.5

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.
@@ -572,7 +572,7 @@ export interface paths {
572
572
  };
573
573
  /**
574
574
  * Search events, markets, and traders
575
- * @description Search across markets, events, and traders. Trader search supports wallet address lookup or name search. Results for each category are independently paginated.
575
+ * @description Search across markets, events, and traders. Use `type` to limit which categories are searched. Trader search supports wallet address lookup or name search. Results for each category are independently paginated. Only requested categories are included in the response.
576
576
  */
577
577
  get: operations["search"];
578
578
  put?: never;
@@ -1545,7 +1545,7 @@ export interface components {
1545
1545
  PnlCandleEntry: {
1546
1546
  /**
1547
1547
  * Format: int64
1548
- * @description Timestamp in epoch milliseconds (start of bucket window)
1548
+ * @description Timestamp in epoch seconds (start of bucket window)
1549
1549
  */
1550
1550
  t: number;
1551
1551
  /**
@@ -1820,12 +1820,13 @@ export interface components {
1820
1820
  confirmed_at: number;
1821
1821
  trader: components["schemas"]["TraderInfo"];
1822
1822
  taker: string;
1823
- side: string;
1823
+ side?: string | null;
1824
1824
  condition_id?: string | null;
1825
1825
  outcome?: string | null;
1826
1826
  /** Format: int32 */
1827
1827
  outcome_index?: number | null;
1828
1828
  question?: string | null;
1829
+ image_url?: string | null;
1829
1830
  slug?: string | null;
1830
1831
  /** Format: double */
1831
1832
  usd_amount: number;
@@ -1863,12 +1864,12 @@ export interface components {
1863
1864
  condition_id: string;
1864
1865
  };
1865
1866
  SearchResponse: {
1866
- events: components["schemas"]["PolymarketEvent"][];
1867
- events_pagination: components["schemas"]["PaginationMeta"];
1868
- markets: components["schemas"]["MarketResponse"][];
1869
- markets_pagination: components["schemas"]["PaginationMeta"];
1870
- traders: components["schemas"]["Trader"][];
1871
- traders_pagination: components["schemas"]["PaginationMeta"];
1867
+ events?: components["schemas"]["PolymarketEvent"][] | null;
1868
+ events_pagination?: null | components["schemas"]["PaginationMeta"];
1869
+ markets?: components["schemas"]["MarketResponse"][] | null;
1870
+ markets_pagination?: null | components["schemas"]["PaginationMeta"];
1871
+ traders?: components["schemas"]["TraderWithPnl"][] | null;
1872
+ traders_pagination?: null | components["schemas"]["PaginationMeta"];
1872
1873
  };
1873
1874
  /**
1874
1875
  * @description Combined sort options valid for both events and markets in search
@@ -2091,6 +2092,11 @@ export interface components {
2091
2092
  * @description Last traded price for this outcome (0–1). NULL if market_outcomes has no price yet.
2092
2093
  */
2093
2094
  current_price?: number | null;
2095
+ /**
2096
+ * Format: double
2097
+ * @description Current shares held: balance / 1e6.
2098
+ */
2099
+ current_shares_balance?: number | null;
2094
2100
  /**
2095
2101
  * Format: double
2096
2102
  * @description Estimated current USD value of held shares: (balance / 1e6) * current_price.
@@ -2104,6 +2110,58 @@ export interface components {
2104
2110
  */
2105
2111
  realized_pnl_pct?: number | null;
2106
2112
  };
2113
+ /** @description Trader's global PnL summary (single trader) */
2114
+ TraderPnlSummary: {
2115
+ trader?: string | null;
2116
+ /** Format: double */
2117
+ realized_pnl_usd?: number | null;
2118
+ /** Format: int64 */
2119
+ events_traded?: number | null;
2120
+ /** Format: int64 */
2121
+ markets_traded?: number | null;
2122
+ /** Format: int64 */
2123
+ total_buys?: number | null;
2124
+ /** Format: int64 */
2125
+ total_sells?: number | null;
2126
+ /** Format: int64 */
2127
+ total_redemptions?: number | null;
2128
+ /** Format: int64 */
2129
+ total_merges?: number | null;
2130
+ /** Format: double */
2131
+ total_volume_usd?: number | null;
2132
+ /** Format: double */
2133
+ buy_volume_usd?: number | null;
2134
+ /** Format: double */
2135
+ sell_volume_usd?: number | null;
2136
+ /** Format: double */
2137
+ redemption_volume_usd?: number | null;
2138
+ /** Format: double */
2139
+ merge_volume_usd?: number | null;
2140
+ /** Format: int64 */
2141
+ markets_won?: number | null;
2142
+ /** Format: int64 */
2143
+ markets_lost?: number | null;
2144
+ /** Format: double */
2145
+ market_win_rate_pct?: number | null;
2146
+ /** Format: double */
2147
+ avg_pnl_per_market?: number | null;
2148
+ /** Format: double */
2149
+ avg_pnl_per_trade?: number | null;
2150
+ /** Format: double */
2151
+ avg_hold_time_seconds?: number | null;
2152
+ /** Format: double */
2153
+ total_fees?: number | null;
2154
+ /** Format: double */
2155
+ best_trade_pnl_usd?: number | null;
2156
+ best_trade_condition_id?: string | null;
2157
+ /** Format: double */
2158
+ worst_trade_pnl_usd?: number | null;
2159
+ worst_trade_condition_id?: string | null;
2160
+ /** Format: int64 */
2161
+ first_trade_at?: number | null;
2162
+ /** Format: int64 */
2163
+ last_trade_at?: number | null;
2164
+ };
2107
2165
  TraderVolumeChartResponse: {
2108
2166
  volumes: components["schemas"]["TraderVolumeDataPoint"][];
2109
2167
  has_more: boolean;
@@ -2124,6 +2182,9 @@ export interface components {
2124
2182
  /** Format: int32 */
2125
2183
  stc: number;
2126
2184
  };
2185
+ TraderWithPnl: components["schemas"]["Trader"] & {
2186
+ pnl?: null | components["schemas"]["TraderPnlSummary"];
2187
+ };
2127
2188
  /**
2128
2189
  * @description Crypto asset symbols accepted by `asset_price_tick` and `asset_price_window_update` filters.
2129
2190
  * @enum {string}
@@ -2316,13 +2377,6 @@ export interface operations {
2316
2377
  };
2317
2378
  content?: never;
2318
2379
  };
2319
- /** @description Event metrics not found */
2320
- 404: {
2321
- headers: {
2322
- [name: string]: unknown;
2323
- };
2324
- content?: never;
2325
- };
2326
2380
  };
2327
2381
  };
2328
2382
  get_event_outcomes: {
@@ -2452,7 +2506,7 @@ export interface operations {
2452
2506
  min_shares?: string;
2453
2507
  /** @description Maximum shares held (decimal string) */
2454
2508
  max_shares?: string;
2455
- /** @description Include nested holder PnL data (default: false) */
2509
+ /** @description Include nested holder PnL data (default: false, +1 credit) */
2456
2510
  include_pnl?: boolean;
2457
2511
  /** @description Return truncated response optimized for AI consumers (default: false) */
2458
2512
  ai?: boolean;
@@ -2526,7 +2580,7 @@ export interface operations {
2526
2580
  min_shares?: string;
2527
2581
  /** @description Maximum shares held (decimal string) */
2528
2582
  max_shares?: string;
2529
- /** @description Include nested holder PnL data (default: false) */
2583
+ /** @description Include nested holder PnL data (default: false, +1 credit) */
2530
2584
  include_pnl?: boolean;
2531
2585
  /** @description Return truncated response optimized for AI consumers (default: false) */
2532
2586
  ai?: boolean;
@@ -2804,13 +2858,6 @@ export interface operations {
2804
2858
  };
2805
2859
  content?: never;
2806
2860
  };
2807
- /** @description Market metrics not found */
2808
- 404: {
2809
- headers: {
2810
- [name: string]: unknown;
2811
- };
2812
- content?: never;
2813
- };
2814
2861
  };
2815
2862
  };
2816
2863
  get_position_candlestick: {
@@ -2874,13 +2921,6 @@ export interface operations {
2874
2921
  };
2875
2922
  content?: never;
2876
2923
  };
2877
- /** @description Position metrics not found */
2878
- 404: {
2879
- headers: {
2880
- [name: string]: unknown;
2881
- };
2882
- content?: never;
2883
- };
2884
2924
  };
2885
2925
  };
2886
2926
  get_position_volume_chart: {
@@ -3265,13 +3305,6 @@ export interface operations {
3265
3305
  };
3266
3306
  content?: never;
3267
3307
  };
3268
- /** @description No snapshot found for this position */
3269
- 404: {
3270
- headers: {
3271
- [name: string]: unknown;
3272
- };
3273
- content?: never;
3274
- };
3275
3308
  };
3276
3309
  };
3277
3310
  get_order_book_history: {
@@ -3400,13 +3433,6 @@ export interface operations {
3400
3433
  };
3401
3434
  content?: never;
3402
3435
  };
3403
- /** @description Market not found or no snapshots exist */
3404
- 404: {
3405
- headers: {
3406
- [name: string]: unknown;
3407
- };
3408
- content?: never;
3409
- };
3410
3436
  };
3411
3437
  };
3412
3438
  get_spread_history: {
@@ -3483,6 +3509,10 @@ export interface operations {
3483
3509
  query: {
3484
3510
  /** @description Search query (min 2 characters). Prefix with 0x for exact wallet address lookup. */
3485
3511
  q: string;
3512
+ /** @description Comma-separated categories to search: events, markets, traders (default: all three). Example: type=markets,traders */
3513
+ type?: string;
3514
+ /** @description Include lifetime PnL summary for each trader (default: false, +1 credit) */
3515
+ include_pnl?: boolean;
3486
3516
  /** @description Sort field applied to both events and markets (default: volume). Fields marked events-only or markets-only fall back to volume on the other category. */
3487
3517
  sort_by?: components["schemas"]["SearchSortBy"];
3488
3518
  /** @description Sort direction (default: desc) */
@@ -3504,7 +3534,7 @@ export interface operations {
3504
3534
  };
3505
3535
  requestBody?: never;
3506
3536
  responses: {
3507
- /** @description Search results with events, markets, and traders */
3537
+ /** @description Search results. Only requested categories (via `type`) are included in the response. */
3508
3538
  200: {
3509
3539
  headers: {
3510
3540
  [name: string]: unknown;
@@ -3656,7 +3686,7 @@ export interface operations {
3656
3686
  get_global_pnl: {
3657
3687
  parameters: {
3658
3688
  query?: {
3659
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3689
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3660
3690
  timeframe?: components["schemas"]["PnlTimeframe"];
3661
3691
  /** @description Sort: pnl_usd, buys, sells, redemptions, merges, avg_hold_time, markets_traded, events_traded, markets_won, volume_usd, fees, best_trade, worst_trade (default: pnl_usd) */
3662
3692
  sort_by?: components["schemas"]["GlobalPnlSortBy"];
@@ -3687,7 +3717,7 @@ export interface operations {
3687
3717
  get_trader_pnl: {
3688
3718
  parameters: {
3689
3719
  query?: {
3690
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3720
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3691
3721
  timeframe?: components["schemas"]["PnlTimeframe"];
3692
3722
  };
3693
3723
  header?: never;
@@ -3705,16 +3735,9 @@ export interface operations {
3705
3735
  [name: string]: unknown;
3706
3736
  };
3707
3737
  content: {
3708
- "application/json": components["schemas"]["GlobalPnlTrader"];
3738
+ "application/json": components["schemas"]["TraderPnlSummary"];
3709
3739
  };
3710
3740
  };
3711
- /** @description Trader not found */
3712
- 404: {
3713
- headers: {
3714
- [name: string]: unknown;
3715
- };
3716
- content?: never;
3717
- };
3718
3741
  };
3719
3742
  };
3720
3743
  get_trader_pnl_calendar: {
@@ -3776,7 +3799,7 @@ export interface operations {
3776
3799
  get_trader_event_pnl: {
3777
3800
  parameters: {
3778
3801
  query?: {
3779
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3802
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3780
3803
  timeframe?: components["schemas"]["PnlTimeframe"];
3781
3804
  /** @description Sort: realized_pnl_usd, total_volume_usd, markets_traded, total_fees (default: realized_pnl_usd) */
3782
3805
  sort_by?: components["schemas"]["EventPnlSortBy"];
@@ -3812,7 +3835,7 @@ export interface operations {
3812
3835
  get_trader_market_pnl: {
3813
3836
  parameters: {
3814
3837
  query?: {
3815
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3838
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3816
3839
  timeframe?: components["schemas"]["PnlTimeframe"];
3817
3840
  /** @description Sort: realized_pnl_usd, buy_usd, total_buys, total_fees, outcomes_traded (default: realized_pnl_usd) */
3818
3841
  sort_by?: components["schemas"]["MarketPnlSortBy"];
@@ -3914,13 +3937,6 @@ export interface operations {
3914
3937
  "application/json": components["schemas"]["PolymarketUserProfile"];
3915
3938
  };
3916
3939
  };
3917
- /** @description Profile not found */
3918
- 404: {
3919
- headers: {
3920
- [name: string]: unknown;
3921
- };
3922
- content?: never;
3923
- };
3924
3940
  };
3925
3941
  };
3926
3942
  get_trader_profiles_batch: {
@@ -62,6 +62,8 @@ export type TraderInfo = Schemas["TraderInfo"];
62
62
  export type TraderVolumeChartResponse = Schemas["TraderVolumeChartResponse"];
63
63
  export type TraderOutcomePnlEntry = Schemas["TraderOutcomePnlEntry"];
64
64
  export type TraderVolumeDataPoint = Schemas["TraderVolumeDataPoint"];
65
+ export type TraderPnlSummary = Schemas["TraderPnlSummary"];
66
+ export type TraderWithPnl = Schemas["TraderWithPnl"];
65
67
  export type PositionPnlSortBy = Schemas["PositionPnlSortBy"];
66
68
  export type EventMarketChartOutcome = Schemas["EventMarketChartOutcome"];
67
69
  export type PositionChartOutcome = Schemas["PositionChartOutcome"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structbuild/sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",