@structbuild/sdk 0.2.4 → 0.2.6

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.
@@ -11,8 +11,8 @@ export interface paths {
11
11
  cookie?: never;
12
12
  };
13
13
  /**
14
- * Get asset price history
15
- * @description Retrieve historical OHLC-style price data for a supported crypto asset (BTC, ETH, XRP, SOL, DOGE, BNB, HYPE) over a chosen time window variant. Timestamps are Unix seconds. Response includes `pagination: { has_more, pagination_key }` for cursor-based pagination — pass `pagination_key` from the previous response to fetch the next page.
14
+ * Get Asset Price History
15
+ * @description Returns historical price data for supported crypto assets from Polymarket API
16
16
  */
17
17
  get: operations["get_asset_history"];
18
18
  put?: never;
@@ -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}
@@ -2146,18 +2207,25 @@ export interface operations {
2146
2207
  get_asset_history: {
2147
2208
  parameters: {
2148
2209
  query: {
2149
- /** @description Asset ticker: BTC, ETH, XRP, SOL, DOGE, BNB, or HYPE */
2150
- asset_symbol: components["schemas"]["AssetSymbol"];
2151
- /** @description Time window: 5m, 15m, 1h, 4h, or 1d */
2152
- variant: components["schemas"]["AssetVariant"];
2153
- /** @description Start timestamp (Unix seconds, inclusive) */
2210
+ /**
2211
+ * @description Asset ticker: BTC, ETH, XRP, SOL, DOGE, BNB, HYPE
2212
+ * @example BTC
2213
+ */
2214
+ asset_symbol: string;
2215
+ /**
2216
+ * @description Time window: 5m, 15m, 1h, 4h, 1d
2217
+ * @example 1h
2218
+ */
2219
+ variant: string;
2220
+ /** @description Start timestamp in seconds (Unix epoch, inclusive) */
2154
2221
  from?: number;
2155
- /** @description End timestamp (Unix seconds, inclusive, defaults to now) */
2222
+ /** @description End timestamp in seconds (Unix epoch, inclusive) */
2156
2223
  to?: number;
2157
- /** @description Number of results (default: 10, max: 100) */
2224
+ /**
2225
+ * @description Number of results (default: 10, max: 100)
2226
+ * @example 10
2227
+ */
2158
2228
  limit?: number;
2159
- /** @description Cursor-based pagination key Obtained from previous response's `pagination.pagination_key`. Pass this to fetch the next page of results. */
2160
- pagination_key?: string;
2161
2229
  };
2162
2230
  header?: never;
2163
2231
  path?: never;
@@ -2165,7 +2233,7 @@ export interface operations {
2165
2233
  };
2166
2234
  requestBody?: never;
2167
2235
  responses: {
2168
- /** @description Asset price history records, sorted newest first. Response includes `pagination: { has_more, pagination_key }` for cursor-based pagination. */
2236
+ /** @description Successful response */
2169
2237
  200: {
2170
2238
  headers: {
2171
2239
  [name: string]: unknown;
@@ -2174,13 +2242,20 @@ export interface operations {
2174
2242
  "application/json": components["schemas"]["AssetPriceHistoryRow"][];
2175
2243
  };
2176
2244
  };
2177
- /** @description Missing or invalid asset_symbol / variant */
2245
+ /** @description Bad request - missing or invalid parameters */
2178
2246
  400: {
2179
2247
  headers: {
2180
2248
  [name: string]: unknown;
2181
2249
  };
2182
2250
  content?: never;
2183
2251
  };
2252
+ /** @description Internal server error */
2253
+ 500: {
2254
+ headers: {
2255
+ [name: string]: unknown;
2256
+ };
2257
+ content?: never;
2258
+ };
2184
2259
  };
2185
2260
  };
2186
2261
  get_events: {
@@ -2316,13 +2391,6 @@ export interface operations {
2316
2391
  };
2317
2392
  content?: never;
2318
2393
  };
2319
- /** @description Event metrics not found */
2320
- 404: {
2321
- headers: {
2322
- [name: string]: unknown;
2323
- };
2324
- content?: never;
2325
- };
2326
2394
  };
2327
2395
  };
2328
2396
  get_event_outcomes: {
@@ -2452,7 +2520,7 @@ export interface operations {
2452
2520
  min_shares?: string;
2453
2521
  /** @description Maximum shares held (decimal string) */
2454
2522
  max_shares?: string;
2455
- /** @description Include nested holder PnL data (default: false) */
2523
+ /** @description Include nested holder PnL data (default: false, +1 credit) */
2456
2524
  include_pnl?: boolean;
2457
2525
  /** @description Return truncated response optimized for AI consumers (default: false) */
2458
2526
  ai?: boolean;
@@ -2526,7 +2594,7 @@ export interface operations {
2526
2594
  min_shares?: string;
2527
2595
  /** @description Maximum shares held (decimal string) */
2528
2596
  max_shares?: string;
2529
- /** @description Include nested holder PnL data (default: false) */
2597
+ /** @description Include nested holder PnL data (default: false, +1 credit) */
2530
2598
  include_pnl?: boolean;
2531
2599
  /** @description Return truncated response optimized for AI consumers (default: false) */
2532
2600
  ai?: boolean;
@@ -2804,13 +2872,6 @@ export interface operations {
2804
2872
  };
2805
2873
  content?: never;
2806
2874
  };
2807
- /** @description Market metrics not found */
2808
- 404: {
2809
- headers: {
2810
- [name: string]: unknown;
2811
- };
2812
- content?: never;
2813
- };
2814
2875
  };
2815
2876
  };
2816
2877
  get_position_candlestick: {
@@ -2874,13 +2935,6 @@ export interface operations {
2874
2935
  };
2875
2936
  content?: never;
2876
2937
  };
2877
- /** @description Position metrics not found */
2878
- 404: {
2879
- headers: {
2880
- [name: string]: unknown;
2881
- };
2882
- content?: never;
2883
- };
2884
2938
  };
2885
2939
  };
2886
2940
  get_position_volume_chart: {
@@ -3265,13 +3319,6 @@ export interface operations {
3265
3319
  };
3266
3320
  content?: never;
3267
3321
  };
3268
- /** @description No snapshot found for this position */
3269
- 404: {
3270
- headers: {
3271
- [name: string]: unknown;
3272
- };
3273
- content?: never;
3274
- };
3275
3322
  };
3276
3323
  };
3277
3324
  get_order_book_history: {
@@ -3400,13 +3447,6 @@ export interface operations {
3400
3447
  };
3401
3448
  content?: never;
3402
3449
  };
3403
- /** @description Market not found or no snapshots exist */
3404
- 404: {
3405
- headers: {
3406
- [name: string]: unknown;
3407
- };
3408
- content?: never;
3409
- };
3410
3450
  };
3411
3451
  };
3412
3452
  get_spread_history: {
@@ -3483,6 +3523,10 @@ export interface operations {
3483
3523
  query: {
3484
3524
  /** @description Search query (min 2 characters). Prefix with 0x for exact wallet address lookup. */
3485
3525
  q: string;
3526
+ /** @description Comma-separated categories to search: events, markets, traders (default: all three, 1 credit per type). Example: type=markets,traders */
3527
+ type?: string;
3528
+ /** @description Include lifetime PnL summary for each trader (default: false, +1 credit) */
3529
+ include_pnl?: boolean;
3486
3530
  /** @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
3531
  sort_by?: components["schemas"]["SearchSortBy"];
3488
3532
  /** @description Sort direction (default: desc) */
@@ -3504,7 +3548,7 @@ export interface operations {
3504
3548
  };
3505
3549
  requestBody?: never;
3506
3550
  responses: {
3507
- /** @description Search results with events, markets, and traders */
3551
+ /** @description Search results. Only requested categories (via `type`) are included in the response. */
3508
3552
  200: {
3509
3553
  headers: {
3510
3554
  [name: string]: unknown;
@@ -3656,7 +3700,7 @@ export interface operations {
3656
3700
  get_global_pnl: {
3657
3701
  parameters: {
3658
3702
  query?: {
3659
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3703
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3660
3704
  timeframe?: components["schemas"]["PnlTimeframe"];
3661
3705
  /** @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
3706
  sort_by?: components["schemas"]["GlobalPnlSortBy"];
@@ -3687,7 +3731,7 @@ export interface operations {
3687
3731
  get_trader_pnl: {
3688
3732
  parameters: {
3689
3733
  query?: {
3690
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3734
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3691
3735
  timeframe?: components["schemas"]["PnlTimeframe"];
3692
3736
  };
3693
3737
  header?: never;
@@ -3705,16 +3749,9 @@ export interface operations {
3705
3749
  [name: string]: unknown;
3706
3750
  };
3707
3751
  content: {
3708
- "application/json": components["schemas"]["GlobalPnlTrader"];
3752
+ "application/json": components["schemas"]["TraderPnlSummary"];
3709
3753
  };
3710
3754
  };
3711
- /** @description Trader not found */
3712
- 404: {
3713
- headers: {
3714
- [name: string]: unknown;
3715
- };
3716
- content?: never;
3717
- };
3718
3755
  };
3719
3756
  };
3720
3757
  get_trader_pnl_calendar: {
@@ -3776,7 +3813,7 @@ export interface operations {
3776
3813
  get_trader_event_pnl: {
3777
3814
  parameters: {
3778
3815
  query?: {
3779
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3816
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3780
3817
  timeframe?: components["schemas"]["PnlTimeframe"];
3781
3818
  /** @description Sort: realized_pnl_usd, total_volume_usd, markets_traded, total_fees (default: realized_pnl_usd) */
3782
3819
  sort_by?: components["schemas"]["EventPnlSortBy"];
@@ -3784,7 +3821,9 @@ export interface operations {
3784
3821
  sort_direction?: components["schemas"]["SortDirection"];
3785
3822
  /** @description Results limit (default: 10, max: 200) */
3786
3823
  limit?: number;
3787
- /** @description Cursor-based pagination key */
3824
+ /** @description Pagination offset (number of results to skip). Takes precedence over pagination_key. */
3825
+ offset?: number;
3826
+ /** @description Cursor-based pagination key obtained from previous response's pagination.pagination_key */
3788
3827
  pagination_key?: string;
3789
3828
  /** @description Filter by event slug */
3790
3829
  event_slug?: string;
@@ -3812,7 +3851,7 @@ export interface operations {
3812
3851
  get_trader_market_pnl: {
3813
3852
  parameters: {
3814
3853
  query?: {
3815
- /** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
3854
+ /** @description Timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
3816
3855
  timeframe?: components["schemas"]["PnlTimeframe"];
3817
3856
  /** @description Sort: realized_pnl_usd, buy_usd, total_buys, total_fees, outcomes_traded (default: realized_pnl_usd) */
3818
3857
  sort_by?: components["schemas"]["MarketPnlSortBy"];
@@ -3820,7 +3859,9 @@ export interface operations {
3820
3859
  sort_direction?: components["schemas"]["SortDirection"];
3821
3860
  /** @description Results limit (default: 10, max: 200) */
3822
3861
  limit?: number;
3823
- /** @description Cursor-based pagination key */
3862
+ /** @description Pagination offset (number of results to skip). Takes precedence over pagination_key. */
3863
+ offset?: number;
3864
+ /** @description Cursor-based pagination key obtained from previous response's pagination.pagination_key */
3824
3865
  pagination_key?: string;
3825
3866
  /** @description Filter by condition ID (or use market_slug) */
3826
3867
  condition_id?: string;
@@ -3914,13 +3955,6 @@ export interface operations {
3914
3955
  "application/json": components["schemas"]["PolymarketUserProfile"];
3915
3956
  };
3916
3957
  };
3917
- /** @description Profile not found */
3918
- 404: {
3919
- headers: {
3920
- [name: string]: unknown;
3921
- };
3922
- content?: never;
3923
- };
3924
3958
  };
3925
3959
  };
3926
3960
  get_trader_profiles_batch: {
@@ -3990,8 +4024,10 @@ export interface operations {
3990
4024
  all?: boolean;
3991
4025
  /** @description Results per page (default: 10, max: 250) */
3992
4026
  limit?: number;
3993
- /** @description Offset-based pagination key (integer offset into result set) */
3994
- pagination_key?: number;
4027
+ /** @description Pagination offset (number of results to skip). Takes precedence over pagination_key. */
4028
+ offset?: number;
4029
+ /** @description Cursor-based pagination key obtained from previous response's pagination.pagination_key */
4030
+ pagination_key?: string;
3995
4031
  /** @description Sort newest first (default: true) */
3996
4032
  sort_desc?: boolean;
3997
4033
  /** @description Return truncated response optimized for AI consumers (default: false) */
@@ -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.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",