@structbuild/sdk 0.1.25 → 0.2.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.
@@ -552,7 +552,7 @@ export interface paths {
552
552
  };
553
553
  /**
554
554
  * Get spread history
555
- * @description Lightweight time series of derived orderbook metrics (best bid/ask, mid price, spread, liquidity depth) without raw bids/asks — ideal for charting. Default limit 100, max 1000.
555
+ * @description Lightweight time series of derived orderbook metrics (best bid/ask, mid price, spread, liquidity depth) without raw bids/asks — ideal for charting. Default limit 20, max 200.
556
556
  */
557
557
  get: operations["get_spread_history"];
558
558
  put?: never;
@@ -955,6 +955,31 @@ export interface components {
955
955
  /** Format: int32 */
956
956
  unique_traders: number;
957
957
  };
958
+ ConditionOrderbookRow: {
959
+ /** Format: int64 */
960
+ ts: number;
961
+ position_id: string;
962
+ condition_id: string;
963
+ bids: components["schemas"]["OrderbookLevel"][];
964
+ asks: components["schemas"]["OrderbookLevel"][];
965
+ hash: string;
966
+ /** Format: double */
967
+ best_bid?: number | null;
968
+ /** Format: double */
969
+ best_ask?: number | null;
970
+ /** Format: double */
971
+ mid_price?: number | null;
972
+ /** Format: double */
973
+ spread?: number | null;
974
+ /** Format: double */
975
+ bid_liquidity_usd?: number | null;
976
+ /** Format: double */
977
+ ask_liquidity_usd?: number | null;
978
+ /** Format: int32 */
979
+ bid_levels?: number | null;
980
+ /** Format: int32 */
981
+ ask_levels?: number | null;
982
+ };
958
983
  /** @description Enriched market data for event API responses */
959
984
  EventMarket: {
960
985
  /** @default */
@@ -1015,9 +1040,9 @@ export interface components {
1015
1040
  };
1016
1041
  EventMarketChartDataPoint: {
1017
1042
  /** Format: double */
1018
- value: number;
1043
+ v: number;
1019
1044
  /** Format: int64 */
1020
- timestamp: number;
1045
+ t: number;
1021
1046
  };
1022
1047
  EventMarketChartOutcome: {
1023
1048
  condition_id: string;
@@ -1328,6 +1353,63 @@ export interface components {
1328
1353
  };
1329
1354
  /** @enum {string} */
1330
1355
  MetricsTimeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
1356
+ OrderbookHistoryRow: {
1357
+ /** Format: int64 */
1358
+ ts: number;
1359
+ position_id: string;
1360
+ condition_id: string;
1361
+ bids: components["schemas"]["OrderbookLevel"][];
1362
+ asks: components["schemas"]["OrderbookLevel"][];
1363
+ hash: string;
1364
+ /** Format: double */
1365
+ best_bid?: number | null;
1366
+ /** Format: double */
1367
+ best_ask?: number | null;
1368
+ /** Format: double */
1369
+ mid_price?: number | null;
1370
+ /** Format: double */
1371
+ spread?: number | null;
1372
+ /** Format: double */
1373
+ bid_liquidity_usd?: number | null;
1374
+ /** Format: double */
1375
+ ask_liquidity_usd?: number | null;
1376
+ /** Format: int32 */
1377
+ bid_levels?: number | null;
1378
+ /** Format: int32 */
1379
+ ask_levels?: number | null;
1380
+ };
1381
+ /** @description A single price level in a bids/asks array. */
1382
+ OrderbookLevel: {
1383
+ /** @description Price as a decimal string */
1384
+ p: string;
1385
+ /** @description Size as a decimal string */
1386
+ s: string;
1387
+ };
1388
+ OrderbookSnapshotRow: {
1389
+ /** Format: int64 */
1390
+ ts: number;
1391
+ position_id: string;
1392
+ condition_id: string;
1393
+ bids: components["schemas"]["OrderbookLevel"][];
1394
+ asks: components["schemas"]["OrderbookLevel"][];
1395
+ hash: string;
1396
+ /** Format: double */
1397
+ best_bid?: number | null;
1398
+ /** Format: double */
1399
+ best_ask?: number | null;
1400
+ /** Format: double */
1401
+ mid_price?: number | null;
1402
+ /** Format: double */
1403
+ spread?: number | null;
1404
+ /** Format: double */
1405
+ bid_liquidity_usd?: number | null;
1406
+ /** Format: double */
1407
+ ask_liquidity_usd?: number | null;
1408
+ /** Format: int32 */
1409
+ bid_levels?: number | null;
1410
+ /** Format: int32 */
1411
+ ask_levels?: number | null;
1412
+ };
1331
1413
  /** @description Holder data grouped by outcome for market-level queries */
1332
1414
  OutcomeHolders: {
1333
1415
  /**
@@ -1598,9 +1680,9 @@ export interface components {
1598
1680
  };
1599
1681
  PositionChartDataPoint: {
1600
1682
  /** Format: double */
1601
- value: number;
1683
+ v: number;
1602
1684
  /** Format: int64 */
1603
- timestamp: number;
1685
+ t: number;
1604
1686
  };
1605
1687
  PositionChartOutcome: {
1606
1688
  position_id: string;
@@ -1826,6 +1908,29 @@ export interface components {
1826
1908
  * @enum {string}
1827
1909
  */
1828
1910
  SpikeDirection: "up" | "down" | "both";
1911
+ /** @description Lightweight row — derived metrics only, no bids/asks JSONB. */
1912
+ SpreadRow: {
1913
+ /** Format: int64 */
1914
+ ts: number;
1915
+ position_id: string;
1916
+ condition_id: string;
1917
+ /** Format: double */
1918
+ best_bid?: number | null;
1919
+ /** Format: double */
1920
+ best_ask?: number | null;
1921
+ /** Format: double */
1922
+ mid_price?: number | null;
1923
+ /** Format: double */
1924
+ spread?: number | null;
1925
+ /** Format: double */
1926
+ bid_liquidity_usd?: number | null;
1927
+ /** Format: double */
1928
+ ask_liquidity_usd?: number | null;
1929
+ /** Format: int32 */
1930
+ bid_levels?: number | null;
1931
+ /** Format: int32 */
1932
+ ask_levels?: number | null;
1933
+ };
1829
1934
  /** @description Token outcome (position) */
1830
1935
  TokenOutcome: {
1831
1936
  token_id: string;
@@ -1953,6 +2058,8 @@ export interface components {
1953
2058
  buy_usd?: number | null;
1954
2059
  /** Format: double */
1955
2060
  sell_usd?: number | null;
2061
+ /** Format: double */
2062
+ realized_pnl_usd?: number | null;
1956
2063
  /**
1957
2064
  * Format: double
1958
2065
  * @description VWAP price paid per share across all buys (0–1)
@@ -2829,7 +2936,55 @@ export interface operations {
2829
2936
  headers: {
2830
2937
  [name: string]: unknown;
2831
2938
  };
2832
- content?: never;
2939
+ content: {
2940
+ "application/json": {
2941
+ condition_id: string;
2942
+ id?: string | null;
2943
+ market_slug?: string | null;
2944
+ question?: string | null;
2945
+ title?: string | null;
2946
+ description?: string | null;
2947
+ image_url?: string | null;
2948
+ oracle?: string | null;
2949
+ status: string;
2950
+ /** Format: int64 */
2951
+ created_time?: number | null;
2952
+ /** Format: int64 */
2953
+ start_time?: number | null;
2954
+ /** Format: int64 */
2955
+ game_start_time?: number | null;
2956
+ /** Format: int64 */
2957
+ closed_time?: number | null;
2958
+ /** Format: int64 */
2959
+ end_time?: number | null;
2960
+ accepting_orders?: boolean | null;
2961
+ uma_resolution_status?: string | null;
2962
+ is_neg_risk?: boolean | null;
2963
+ market_maker_address?: string | null;
2964
+ creator?: string | null;
2965
+ category?: string | null;
2966
+ /** Format: double */
2967
+ volume_usd?: number | null;
2968
+ /** Format: double */
2969
+ liquidity_usd?: number | null;
2970
+ /** Format: double */
2971
+ highest_probability?: number | null;
2972
+ /** Format: int64 */
2973
+ total_holders?: number | null;
2974
+ winning_outcome?: null | components["schemas"]["MarketOutcome"];
2975
+ outcomes?: components["schemas"]["MarketOutcome"][];
2976
+ rewards?: components["schemas"]["MarketReward"][];
2977
+ clob_rewards?: components["schemas"]["ClobReward"][];
2978
+ tags?: string[];
2979
+ event_slug?: string | null;
2980
+ resolution_source?: string | null;
2981
+ metrics?: {
2982
+ [key: string]: components["schemas"]["SimpleTimeframeMetrics"];
2983
+ };
2984
+ /** Format: double */
2985
+ relevance_score?: number | null;
2986
+ };
2987
+ };
2833
2988
  };
2834
2989
  /** @description Market not found */
2835
2990
  404: {
@@ -2962,7 +3117,55 @@ export interface operations {
2962
3117
  headers: {
2963
3118
  [name: string]: unknown;
2964
3119
  };
2965
- content?: never;
3120
+ content: {
3121
+ "application/json": {
3122
+ condition_id: string;
3123
+ id?: string | null;
3124
+ market_slug?: string | null;
3125
+ question?: string | null;
3126
+ title?: string | null;
3127
+ description?: string | null;
3128
+ image_url?: string | null;
3129
+ oracle?: string | null;
3130
+ status: string;
3131
+ /** Format: int64 */
3132
+ created_time?: number | null;
3133
+ /** Format: int64 */
3134
+ start_time?: number | null;
3135
+ /** Format: int64 */
3136
+ game_start_time?: number | null;
3137
+ /** Format: int64 */
3138
+ closed_time?: number | null;
3139
+ /** Format: int64 */
3140
+ end_time?: number | null;
3141
+ accepting_orders?: boolean | null;
3142
+ uma_resolution_status?: string | null;
3143
+ is_neg_risk?: boolean | null;
3144
+ market_maker_address?: string | null;
3145
+ creator?: string | null;
3146
+ category?: string | null;
3147
+ /** Format: double */
3148
+ volume_usd?: number | null;
3149
+ /** Format: double */
3150
+ liquidity_usd?: number | null;
3151
+ /** Format: double */
3152
+ highest_probability?: number | null;
3153
+ /** Format: int64 */
3154
+ total_holders?: number | null;
3155
+ winning_outcome?: null | components["schemas"]["MarketOutcome"];
3156
+ outcomes?: components["schemas"]["MarketOutcome"][];
3157
+ rewards?: components["schemas"]["MarketReward"][];
3158
+ clob_rewards?: components["schemas"]["ClobReward"][];
3159
+ tags?: string[];
3160
+ event_slug?: string | null;
3161
+ resolution_source?: string | null;
3162
+ metrics?: {
3163
+ [key: string]: components["schemas"]["SimpleTimeframeMetrics"];
3164
+ };
3165
+ /** Format: double */
3166
+ relevance_score?: number | null;
3167
+ };
3168
+ };
2966
3169
  };
2967
3170
  /** @description Market not found */
2968
3171
  404: {
@@ -2990,7 +3193,33 @@ export interface operations {
2990
3193
  headers: {
2991
3194
  [name: string]: unknown;
2992
3195
  };
2993
- content?: never;
3196
+ content: {
3197
+ "application/json": {
3198
+ /** Format: int64 */
3199
+ ts: number;
3200
+ position_id: string;
3201
+ condition_id: string;
3202
+ bids: components["schemas"]["OrderbookLevel"][];
3203
+ asks: components["schemas"]["OrderbookLevel"][];
3204
+ hash: string;
3205
+ /** Format: double */
3206
+ best_bid?: number | null;
3207
+ /** Format: double */
3208
+ best_ask?: number | null;
3209
+ /** Format: double */
3210
+ mid_price?: number | null;
3211
+ /** Format: double */
3212
+ spread?: number | null;
3213
+ /** Format: double */
3214
+ bid_liquidity_usd?: number | null;
3215
+ /** Format: double */
3216
+ ask_liquidity_usd?: number | null;
3217
+ /** Format: int32 */
3218
+ bid_levels?: number | null;
3219
+ /** Format: int32 */
3220
+ ask_levels?: number | null;
3221
+ };
3222
+ };
2994
3223
  };
2995
3224
  /** @description Missing or invalid parameters */
2996
3225
  400: {
@@ -3043,7 +3272,33 @@ export interface operations {
3043
3272
  headers: {
3044
3273
  [name: string]: unknown;
3045
3274
  };
3046
- content?: never;
3275
+ content: {
3276
+ "application/json": {
3277
+ /** Format: int64 */
3278
+ ts: number;
3279
+ position_id: string;
3280
+ condition_id: string;
3281
+ bids: components["schemas"]["OrderbookLevel"][];
3282
+ asks: components["schemas"]["OrderbookLevel"][];
3283
+ hash: string;
3284
+ /** Format: double */
3285
+ best_bid?: number | null;
3286
+ /** Format: double */
3287
+ best_ask?: number | null;
3288
+ /** Format: double */
3289
+ mid_price?: number | null;
3290
+ /** Format: double */
3291
+ spread?: number | null;
3292
+ /** Format: double */
3293
+ bid_liquidity_usd?: number | null;
3294
+ /** Format: double */
3295
+ ask_liquidity_usd?: number | null;
3296
+ /** Format: int32 */
3297
+ bid_levels?: number | null;
3298
+ /** Format: int32 */
3299
+ ask_levels?: number | null;
3300
+ }[];
3301
+ };
3047
3302
  };
3048
3303
  /** @description Missing or invalid parameters */
3049
3304
  400: {
@@ -3073,7 +3328,33 @@ export interface operations {
3073
3328
  headers: {
3074
3329
  [name: string]: unknown;
3075
3330
  };
3076
- content?: never;
3331
+ content: {
3332
+ "application/json": {
3333
+ /** Format: int64 */
3334
+ ts: number;
3335
+ position_id: string;
3336
+ condition_id: string;
3337
+ bids: components["schemas"]["OrderbookLevel"][];
3338
+ asks: components["schemas"]["OrderbookLevel"][];
3339
+ hash: string;
3340
+ /** Format: double */
3341
+ best_bid?: number | null;
3342
+ /** Format: double */
3343
+ best_ask?: number | null;
3344
+ /** Format: double */
3345
+ mid_price?: number | null;
3346
+ /** Format: double */
3347
+ spread?: number | null;
3348
+ /** Format: double */
3349
+ bid_liquidity_usd?: number | null;
3350
+ /** Format: double */
3351
+ ask_liquidity_usd?: number | null;
3352
+ /** Format: int32 */
3353
+ bid_levels?: number | null;
3354
+ /** Format: int32 */
3355
+ ask_levels?: number | null;
3356
+ }[];
3357
+ };
3077
3358
  };
3078
3359
  /** @description Missing or invalid parameters */
3079
3360
  400: {
@@ -3126,7 +3407,30 @@ export interface operations {
3126
3407
  headers: {
3127
3408
  [name: string]: unknown;
3128
3409
  };
3129
- content?: never;
3410
+ content: {
3411
+ "application/json": {
3412
+ /** Format: int64 */
3413
+ ts: number;
3414
+ position_id: string;
3415
+ condition_id: string;
3416
+ /** Format: double */
3417
+ best_bid?: number | null;
3418
+ /** Format: double */
3419
+ best_ask?: number | null;
3420
+ /** Format: double */
3421
+ mid_price?: number | null;
3422
+ /** Format: double */
3423
+ spread?: number | null;
3424
+ /** Format: double */
3425
+ bid_liquidity_usd?: number | null;
3426
+ /** Format: double */
3427
+ ask_liquidity_usd?: number | null;
3428
+ /** Format: int32 */
3429
+ bid_levels?: number | null;
3430
+ /** Format: int32 */
3431
+ ask_levels?: number | null;
3432
+ }[];
3433
+ };
3130
3434
  };
3131
3435
  /** @description Missing or invalid parameters */
3132
3436
  400: {
@@ -81,6 +81,11 @@ export type PositionChartDataPoint = Schemas["PositionChartDataPoint"];
81
81
  export type TradeType = Schemas["TradeType"];
82
82
  export type WebhookAssetSymbol = Schemas["WebhookAssetSymbol"];
83
83
  export type WebhookTimeframe = Schemas["WebhookTimeframe"];
84
+ export type ConditionOrderbookRow = Schemas["ConditionOrderbookRow"];
85
+ export type OrderbookHistoryRow = Schemas["OrderbookHistoryRow"];
86
+ export type OrderbookLevel = Schemas["OrderbookLevel"];
87
+ export type OrderbookSnapshotRow = Schemas["OrderbookSnapshotRow"];
88
+ export type SpreadRow = Schemas["SpreadRow"];
84
89
  export type Series = Schemas["PolymarketSeries"];
85
90
  export type Trade = Schemas["PredictionTradeResponse"];
86
91
  export type Candlestick = Schemas["PredictionCandlestickBar"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structbuild/sdk",
3
- "version": "0.1.25",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",