@structbuild/sdk 0.1.24 → 0.2.0
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.
- package/dist/client.d.ts +2 -1
- package/dist/generated/polymarket.d.ts +554 -12
- package/dist/generated/webhooks.d.ts +4 -4
- package/dist/index.cjs +18 -1
- package/dist/index.cjs.map +5 -4
- package/dist/index.js +18 -1
- package/dist/index.js.map +5 -4
- package/dist/namespaces/index.d.ts +1 -0
- package/dist/namespaces/orderBook.d.ts +10 -0
- package/dist/types/index.d.ts +27 -4
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Venue } from "./types/common.js";
|
|
2
2
|
import type { RetryConfig, RequestHookInfo, ResponseHookInfo } from "./types/index.js";
|
|
3
|
-
import { AssetsNamespace, HoldersNamespace, TagsNamespace, EventsNamespace, MarketsNamespace, SeriesNamespace, TraderNamespace, BondsNamespace, SearchNamespace, WebhooksNamespace } from "./namespaces/index.js";
|
|
3
|
+
import { AssetsNamespace, HoldersNamespace, TagsNamespace, EventsNamespace, MarketsNamespace, SeriesNamespace, TraderNamespace, BondsNamespace, SearchNamespace, OrderBookNamespace, WebhooksNamespace } from "./namespaces/index.js";
|
|
4
4
|
export interface StructClientConfig {
|
|
5
5
|
apiKey: string;
|
|
6
6
|
baseUrl?: string;
|
|
@@ -21,6 +21,7 @@ export declare class StructClient {
|
|
|
21
21
|
readonly trader: TraderNamespace;
|
|
22
22
|
readonly bonds: BondsNamespace;
|
|
23
23
|
readonly search: SearchNamespace;
|
|
24
|
+
readonly orderBook: OrderBookNamespace;
|
|
24
25
|
readonly webhooks: WebhooksNamespace;
|
|
25
26
|
constructor(config: StructClientConfig);
|
|
26
27
|
}
|
|
@@ -483,6 +483,86 @@ export interface paths {
|
|
|
483
483
|
patch?: never;
|
|
484
484
|
trace?: never;
|
|
485
485
|
};
|
|
486
|
+
"/polymarket/order-book": {
|
|
487
|
+
parameters: {
|
|
488
|
+
query?: never;
|
|
489
|
+
header?: never;
|
|
490
|
+
path?: never;
|
|
491
|
+
cookie?: never;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Get order book
|
|
495
|
+
* @description Returns the latest CLOB orderbook snapshot for a position, including derived metrics (best bid/ask, mid price, spread, liquidity depth). Data is sourced from the real-time Polymarket WebSocket feed. `bids` and `asks` are arrays of `{"p": price, "s": size}` objects, sorted best-first.
|
|
496
|
+
*/
|
|
497
|
+
get: operations["get_order_book"];
|
|
498
|
+
put?: never;
|
|
499
|
+
post?: never;
|
|
500
|
+
delete?: never;
|
|
501
|
+
options?: never;
|
|
502
|
+
head?: never;
|
|
503
|
+
patch?: never;
|
|
504
|
+
trace?: never;
|
|
505
|
+
};
|
|
506
|
+
"/polymarket/order-book/history": {
|
|
507
|
+
parameters: {
|
|
508
|
+
query?: never;
|
|
509
|
+
header?: never;
|
|
510
|
+
path?: never;
|
|
511
|
+
cookie?: never;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Get order book history
|
|
515
|
+
* @description Paginated history of raw CLOB orderbook snapshots including full bids/asks levels and derived metrics. Default limit 20, max 200. `bids` and `asks` are arrays of `{"p": price, "s": size}` objects, sorted best-first.
|
|
516
|
+
*/
|
|
517
|
+
get: operations["get_order_book_history"];
|
|
518
|
+
put?: never;
|
|
519
|
+
post?: never;
|
|
520
|
+
delete?: never;
|
|
521
|
+
options?: never;
|
|
522
|
+
head?: never;
|
|
523
|
+
patch?: never;
|
|
524
|
+
trace?: never;
|
|
525
|
+
};
|
|
526
|
+
"/polymarket/order-book/market": {
|
|
527
|
+
parameters: {
|
|
528
|
+
query?: never;
|
|
529
|
+
header?: never;
|
|
530
|
+
path?: never;
|
|
531
|
+
cookie?: never;
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Get order books for a market
|
|
535
|
+
* @description Returns the latest orderbook snapshot for every position (outcome) in a market. Accepts condition_id or market_slug. `bids` and `asks` are arrays of `{"p": price, "s": size}` objects, sorted best-first.
|
|
536
|
+
*/
|
|
537
|
+
get: operations["get_market_order_book"];
|
|
538
|
+
put?: never;
|
|
539
|
+
post?: never;
|
|
540
|
+
delete?: never;
|
|
541
|
+
options?: never;
|
|
542
|
+
head?: never;
|
|
543
|
+
patch?: never;
|
|
544
|
+
trace?: never;
|
|
545
|
+
};
|
|
546
|
+
"/polymarket/order-book/spread": {
|
|
547
|
+
parameters: {
|
|
548
|
+
query?: never;
|
|
549
|
+
header?: never;
|
|
550
|
+
path?: never;
|
|
551
|
+
cookie?: never;
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
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.
|
|
556
|
+
*/
|
|
557
|
+
get: operations["get_spread_history"];
|
|
558
|
+
put?: never;
|
|
559
|
+
post?: never;
|
|
560
|
+
delete?: never;
|
|
561
|
+
options?: never;
|
|
562
|
+
head?: never;
|
|
563
|
+
patch?: never;
|
|
564
|
+
trace?: never;
|
|
565
|
+
};
|
|
486
566
|
"/polymarket/search": {
|
|
487
567
|
parameters: {
|
|
488
568
|
query?: never;
|
|
@@ -492,13 +572,7 @@ export interface paths {
|
|
|
492
572
|
};
|
|
493
573
|
/**
|
|
494
574
|
* Search events, markets, and traders
|
|
495
|
-
* @description Search across
|
|
496
|
-
*
|
|
497
|
-
* All three categories are queried in parallel. Each has independent cursor-based pagination via its own `*_pagination_key`.
|
|
498
|
-
*
|
|
499
|
-
* **Trader search** matches by wallet address (exact, `0x...` 42 chars) or by display name / pseudonym (case-insensitive partial match).
|
|
500
|
-
*
|
|
501
|
-
* **sort_by / timeframe** apply to events and markets. Some sort fields only apply to one category (e.g. `liquidity` and `holders` are markets-only; `title`, `creation_date`, `start_date`, `end_date` are events-only) — unrecognised fields fall back to `volume`.
|
|
575
|
+
* @description Search across markets, events, and traders. Trader search supports wallet address lookup or name search. Results for each category are independently paginated.
|
|
502
576
|
*/
|
|
503
577
|
get: operations["search"];
|
|
504
578
|
put?: never;
|
|
@@ -826,7 +900,7 @@ export interface components {
|
|
|
826
900
|
/** @enum {string} */
|
|
827
901
|
AssetSymbol: "BTC" | "ETH" | "XRP" | "SOL";
|
|
828
902
|
/** @enum {string} */
|
|
829
|
-
AssetVariant: "5m" | "15m" | "1h" | "1d";
|
|
903
|
+
AssetVariant: "5m" | "15m" | "1h" | "4h" | "1d";
|
|
830
904
|
BondMarket: {
|
|
831
905
|
condition_id: string;
|
|
832
906
|
title?: string | null;
|
|
@@ -881,6 +955,31 @@ export interface components {
|
|
|
881
955
|
/** Format: int32 */
|
|
882
956
|
unique_traders: number;
|
|
883
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
|
+
};
|
|
884
983
|
/** @description Enriched market data for event API responses */
|
|
885
984
|
EventMarket: {
|
|
886
985
|
/** @default */
|
|
@@ -1207,6 +1306,8 @@ export interface components {
|
|
|
1207
1306
|
metrics?: {
|
|
1208
1307
|
[key: string]: components["schemas"]["SimpleTimeframeMetrics"];
|
|
1209
1308
|
};
|
|
1309
|
+
/** Format: double */
|
|
1310
|
+
relevance_score?: number | null;
|
|
1210
1311
|
};
|
|
1211
1312
|
/** @description Reward info for market API responses */
|
|
1212
1313
|
MarketReward: {
|
|
@@ -1252,6 +1353,63 @@ export interface components {
|
|
|
1252
1353
|
};
|
|
1253
1354
|
/** @enum {string} */
|
|
1254
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
|
+
};
|
|
1255
1413
|
/** @description Holder data grouped by outcome for market-level queries */
|
|
1256
1414
|
OutcomeHolders: {
|
|
1257
1415
|
/**
|
|
@@ -1750,6 +1908,29 @@ export interface components {
|
|
|
1750
1908
|
* @enum {string}
|
|
1751
1909
|
*/
|
|
1752
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
|
+
};
|
|
1753
1934
|
/** @description Token outcome (position) */
|
|
1754
1935
|
TokenOutcome: {
|
|
1755
1936
|
token_id: string;
|
|
@@ -1923,7 +2104,7 @@ export interface components {
|
|
|
1923
2104
|
* @description Timeframe values accepted by webhook metric, milestone, spike, and asset-price filters.
|
|
1924
2105
|
* @enum {string}
|
|
1925
2106
|
*/
|
|
1926
|
-
WebhookTimeframe: "1m" | "5m" | "15m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
2107
|
+
WebhookTimeframe: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
1927
2108
|
};
|
|
1928
2109
|
responses: never;
|
|
1929
2110
|
parameters: never;
|
|
@@ -1938,7 +2119,7 @@ export interface operations {
|
|
|
1938
2119
|
query: {
|
|
1939
2120
|
/** @description Asset ticker: BTC, ETH, XRP, or SOL */
|
|
1940
2121
|
asset_symbol: components["schemas"]["AssetSymbol"];
|
|
1941
|
-
/** @description Time window: 5m, 15m, 1h, or 1d */
|
|
2122
|
+
/** @description Time window: 5m, 15m, 1h, 4h, or 1d */
|
|
1942
2123
|
variant: components["schemas"]["AssetVariant"];
|
|
1943
2124
|
/** @description Start timestamp (Unix seconds, inclusive) */
|
|
1944
2125
|
from?: number;
|
|
@@ -2753,7 +2934,55 @@ export interface operations {
|
|
|
2753
2934
|
headers: {
|
|
2754
2935
|
[name: string]: unknown;
|
|
2755
2936
|
};
|
|
2756
|
-
content
|
|
2937
|
+
content: {
|
|
2938
|
+
"application/json": {
|
|
2939
|
+
condition_id: string;
|
|
2940
|
+
id?: string | null;
|
|
2941
|
+
market_slug?: string | null;
|
|
2942
|
+
question?: string | null;
|
|
2943
|
+
title?: string | null;
|
|
2944
|
+
description?: string | null;
|
|
2945
|
+
image_url?: string | null;
|
|
2946
|
+
oracle?: string | null;
|
|
2947
|
+
status: string;
|
|
2948
|
+
/** Format: int64 */
|
|
2949
|
+
created_time?: number | null;
|
|
2950
|
+
/** Format: int64 */
|
|
2951
|
+
start_time?: number | null;
|
|
2952
|
+
/** Format: int64 */
|
|
2953
|
+
game_start_time?: number | null;
|
|
2954
|
+
/** Format: int64 */
|
|
2955
|
+
closed_time?: number | null;
|
|
2956
|
+
/** Format: int64 */
|
|
2957
|
+
end_time?: number | null;
|
|
2958
|
+
accepting_orders?: boolean | null;
|
|
2959
|
+
uma_resolution_status?: string | null;
|
|
2960
|
+
is_neg_risk?: boolean | null;
|
|
2961
|
+
market_maker_address?: string | null;
|
|
2962
|
+
creator?: string | null;
|
|
2963
|
+
category?: string | null;
|
|
2964
|
+
/** Format: double */
|
|
2965
|
+
volume_usd?: number | null;
|
|
2966
|
+
/** Format: double */
|
|
2967
|
+
liquidity_usd?: number | null;
|
|
2968
|
+
/** Format: double */
|
|
2969
|
+
highest_probability?: number | null;
|
|
2970
|
+
/** Format: int64 */
|
|
2971
|
+
total_holders?: number | null;
|
|
2972
|
+
winning_outcome?: null | components["schemas"]["MarketOutcome"];
|
|
2973
|
+
outcomes?: components["schemas"]["MarketOutcome"][];
|
|
2974
|
+
rewards?: components["schemas"]["MarketReward"][];
|
|
2975
|
+
clob_rewards?: components["schemas"]["ClobReward"][];
|
|
2976
|
+
tags?: string[];
|
|
2977
|
+
event_slug?: string | null;
|
|
2978
|
+
resolution_source?: string | null;
|
|
2979
|
+
metrics?: {
|
|
2980
|
+
[key: string]: components["schemas"]["SimpleTimeframeMetrics"];
|
|
2981
|
+
};
|
|
2982
|
+
/** Format: double */
|
|
2983
|
+
relevance_score?: number | null;
|
|
2984
|
+
};
|
|
2985
|
+
};
|
|
2757
2986
|
};
|
|
2758
2987
|
/** @description Market not found */
|
|
2759
2988
|
404: {
|
|
@@ -2886,7 +3115,55 @@ export interface operations {
|
|
|
2886
3115
|
headers: {
|
|
2887
3116
|
[name: string]: unknown;
|
|
2888
3117
|
};
|
|
2889
|
-
content
|
|
3118
|
+
content: {
|
|
3119
|
+
"application/json": {
|
|
3120
|
+
condition_id: string;
|
|
3121
|
+
id?: string | null;
|
|
3122
|
+
market_slug?: string | null;
|
|
3123
|
+
question?: string | null;
|
|
3124
|
+
title?: string | null;
|
|
3125
|
+
description?: string | null;
|
|
3126
|
+
image_url?: string | null;
|
|
3127
|
+
oracle?: string | null;
|
|
3128
|
+
status: string;
|
|
3129
|
+
/** Format: int64 */
|
|
3130
|
+
created_time?: number | null;
|
|
3131
|
+
/** Format: int64 */
|
|
3132
|
+
start_time?: number | null;
|
|
3133
|
+
/** Format: int64 */
|
|
3134
|
+
game_start_time?: number | null;
|
|
3135
|
+
/** Format: int64 */
|
|
3136
|
+
closed_time?: number | null;
|
|
3137
|
+
/** Format: int64 */
|
|
3138
|
+
end_time?: number | null;
|
|
3139
|
+
accepting_orders?: boolean | null;
|
|
3140
|
+
uma_resolution_status?: string | null;
|
|
3141
|
+
is_neg_risk?: boolean | null;
|
|
3142
|
+
market_maker_address?: string | null;
|
|
3143
|
+
creator?: string | null;
|
|
3144
|
+
category?: string | null;
|
|
3145
|
+
/** Format: double */
|
|
3146
|
+
volume_usd?: number | null;
|
|
3147
|
+
/** Format: double */
|
|
3148
|
+
liquidity_usd?: number | null;
|
|
3149
|
+
/** Format: double */
|
|
3150
|
+
highest_probability?: number | null;
|
|
3151
|
+
/** Format: int64 */
|
|
3152
|
+
total_holders?: number | null;
|
|
3153
|
+
winning_outcome?: null | components["schemas"]["MarketOutcome"];
|
|
3154
|
+
outcomes?: components["schemas"]["MarketOutcome"][];
|
|
3155
|
+
rewards?: components["schemas"]["MarketReward"][];
|
|
3156
|
+
clob_rewards?: components["schemas"]["ClobReward"][];
|
|
3157
|
+
tags?: string[];
|
|
3158
|
+
event_slug?: string | null;
|
|
3159
|
+
resolution_source?: string | null;
|
|
3160
|
+
metrics?: {
|
|
3161
|
+
[key: string]: components["schemas"]["SimpleTimeframeMetrics"];
|
|
3162
|
+
};
|
|
3163
|
+
/** Format: double */
|
|
3164
|
+
relevance_score?: number | null;
|
|
3165
|
+
};
|
|
3166
|
+
};
|
|
2890
3167
|
};
|
|
2891
3168
|
/** @description Market not found */
|
|
2892
3169
|
404: {
|
|
@@ -2897,6 +3174,271 @@ export interface operations {
|
|
|
2897
3174
|
};
|
|
2898
3175
|
};
|
|
2899
3176
|
};
|
|
3177
|
+
get_order_book: {
|
|
3178
|
+
parameters: {
|
|
3179
|
+
query: {
|
|
3180
|
+
/** @description Token ID (position ID) to query */
|
|
3181
|
+
position_id: string;
|
|
3182
|
+
};
|
|
3183
|
+
header?: never;
|
|
3184
|
+
path?: never;
|
|
3185
|
+
cookie?: never;
|
|
3186
|
+
};
|
|
3187
|
+
requestBody?: never;
|
|
3188
|
+
responses: {
|
|
3189
|
+
/** @description Latest orderbook snapshot. ts is Unix milliseconds. */
|
|
3190
|
+
200: {
|
|
3191
|
+
headers: {
|
|
3192
|
+
[name: string]: unknown;
|
|
3193
|
+
};
|
|
3194
|
+
content: {
|
|
3195
|
+
"application/json": {
|
|
3196
|
+
/** Format: int64 */
|
|
3197
|
+
ts: number;
|
|
3198
|
+
position_id: string;
|
|
3199
|
+
condition_id: string;
|
|
3200
|
+
bids: components["schemas"]["OrderbookLevel"][];
|
|
3201
|
+
asks: components["schemas"]["OrderbookLevel"][];
|
|
3202
|
+
hash: string;
|
|
3203
|
+
/** Format: double */
|
|
3204
|
+
best_bid?: number | null;
|
|
3205
|
+
/** Format: double */
|
|
3206
|
+
best_ask?: number | null;
|
|
3207
|
+
/** Format: double */
|
|
3208
|
+
mid_price?: number | null;
|
|
3209
|
+
/** Format: double */
|
|
3210
|
+
spread?: number | null;
|
|
3211
|
+
/** Format: double */
|
|
3212
|
+
bid_liquidity_usd?: number | null;
|
|
3213
|
+
/** Format: double */
|
|
3214
|
+
ask_liquidity_usd?: number | null;
|
|
3215
|
+
/** Format: int32 */
|
|
3216
|
+
bid_levels?: number | null;
|
|
3217
|
+
/** Format: int32 */
|
|
3218
|
+
ask_levels?: number | null;
|
|
3219
|
+
};
|
|
3220
|
+
};
|
|
3221
|
+
};
|
|
3222
|
+
/** @description Missing or invalid parameters */
|
|
3223
|
+
400: {
|
|
3224
|
+
headers: {
|
|
3225
|
+
[name: string]: unknown;
|
|
3226
|
+
};
|
|
3227
|
+
content?: never;
|
|
3228
|
+
};
|
|
3229
|
+
/** @description No snapshot found for this position */
|
|
3230
|
+
404: {
|
|
3231
|
+
headers: {
|
|
3232
|
+
[name: string]: unknown;
|
|
3233
|
+
};
|
|
3234
|
+
content?: never;
|
|
3235
|
+
};
|
|
3236
|
+
};
|
|
3237
|
+
};
|
|
3238
|
+
get_order_book_history: {
|
|
3239
|
+
parameters: {
|
|
3240
|
+
query?: {
|
|
3241
|
+
/** @description Token ID (required if condition_id / market_slug not set) */
|
|
3242
|
+
position_id?: string;
|
|
3243
|
+
/** @description Condition ID — returns history for all positions in this market */
|
|
3244
|
+
condition_id?: string;
|
|
3245
|
+
/** @description Market slug (alternative to condition_id) */
|
|
3246
|
+
market_slug?: string;
|
|
3247
|
+
/** @description Start timestamp (Unix milliseconds, inclusive) */
|
|
3248
|
+
from?: number;
|
|
3249
|
+
/** @description End timestamp (Unix milliseconds, inclusive) */
|
|
3250
|
+
to?: number;
|
|
3251
|
+
/** @description Only return snapshots with spread >= this value */
|
|
3252
|
+
min_spread?: number;
|
|
3253
|
+
/** @description Only return snapshots with spread <= this value */
|
|
3254
|
+
max_spread?: number;
|
|
3255
|
+
/** @description Only return snapshots where total liquidity (bid + ask) >= this value */
|
|
3256
|
+
min_liquidity?: number;
|
|
3257
|
+
/** @description Number of results (default: 20, max: 200) */
|
|
3258
|
+
limit?: number;
|
|
3259
|
+
/** @description Cursor from previous response's pagination.pagination_key */
|
|
3260
|
+
pagination_key?: string;
|
|
3261
|
+
};
|
|
3262
|
+
header?: never;
|
|
3263
|
+
path?: never;
|
|
3264
|
+
cookie?: never;
|
|
3265
|
+
};
|
|
3266
|
+
requestBody?: never;
|
|
3267
|
+
responses: {
|
|
3268
|
+
/** @description Orderbook snapshot rows, newest first. ts is Unix milliseconds. */
|
|
3269
|
+
200: {
|
|
3270
|
+
headers: {
|
|
3271
|
+
[name: string]: unknown;
|
|
3272
|
+
};
|
|
3273
|
+
content: {
|
|
3274
|
+
"application/json": {
|
|
3275
|
+
/** Format: int64 */
|
|
3276
|
+
ts: number;
|
|
3277
|
+
position_id: string;
|
|
3278
|
+
condition_id: string;
|
|
3279
|
+
bids: components["schemas"]["OrderbookLevel"][];
|
|
3280
|
+
asks: components["schemas"]["OrderbookLevel"][];
|
|
3281
|
+
hash: string;
|
|
3282
|
+
/** Format: double */
|
|
3283
|
+
best_bid?: number | null;
|
|
3284
|
+
/** Format: double */
|
|
3285
|
+
best_ask?: number | null;
|
|
3286
|
+
/** Format: double */
|
|
3287
|
+
mid_price?: number | null;
|
|
3288
|
+
/** Format: double */
|
|
3289
|
+
spread?: number | null;
|
|
3290
|
+
/** Format: double */
|
|
3291
|
+
bid_liquidity_usd?: number | null;
|
|
3292
|
+
/** Format: double */
|
|
3293
|
+
ask_liquidity_usd?: number | null;
|
|
3294
|
+
/** Format: int32 */
|
|
3295
|
+
bid_levels?: number | null;
|
|
3296
|
+
/** Format: int32 */
|
|
3297
|
+
ask_levels?: number | null;
|
|
3298
|
+
}[];
|
|
3299
|
+
};
|
|
3300
|
+
};
|
|
3301
|
+
/** @description Missing or invalid parameters */
|
|
3302
|
+
400: {
|
|
3303
|
+
headers: {
|
|
3304
|
+
[name: string]: unknown;
|
|
3305
|
+
};
|
|
3306
|
+
content?: never;
|
|
3307
|
+
};
|
|
3308
|
+
};
|
|
3309
|
+
};
|
|
3310
|
+
get_market_order_book: {
|
|
3311
|
+
parameters: {
|
|
3312
|
+
query?: {
|
|
3313
|
+
/** @description Condition ID of the market */
|
|
3314
|
+
condition_id?: string;
|
|
3315
|
+
/** @description Market slug (alternative to condition_id) */
|
|
3316
|
+
market_slug?: string;
|
|
3317
|
+
};
|
|
3318
|
+
header?: never;
|
|
3319
|
+
path?: never;
|
|
3320
|
+
cookie?: never;
|
|
3321
|
+
};
|
|
3322
|
+
requestBody?: never;
|
|
3323
|
+
responses: {
|
|
3324
|
+
/** @description Latest orderbook snapshot per position. ts is Unix milliseconds. */
|
|
3325
|
+
200: {
|
|
3326
|
+
headers: {
|
|
3327
|
+
[name: string]: unknown;
|
|
3328
|
+
};
|
|
3329
|
+
content: {
|
|
3330
|
+
"application/json": {
|
|
3331
|
+
/** Format: int64 */
|
|
3332
|
+
ts: number;
|
|
3333
|
+
position_id: string;
|
|
3334
|
+
condition_id: string;
|
|
3335
|
+
bids: components["schemas"]["OrderbookLevel"][];
|
|
3336
|
+
asks: components["schemas"]["OrderbookLevel"][];
|
|
3337
|
+
hash: string;
|
|
3338
|
+
/** Format: double */
|
|
3339
|
+
best_bid?: number | null;
|
|
3340
|
+
/** Format: double */
|
|
3341
|
+
best_ask?: number | null;
|
|
3342
|
+
/** Format: double */
|
|
3343
|
+
mid_price?: number | null;
|
|
3344
|
+
/** Format: double */
|
|
3345
|
+
spread?: number | null;
|
|
3346
|
+
/** Format: double */
|
|
3347
|
+
bid_liquidity_usd?: number | null;
|
|
3348
|
+
/** Format: double */
|
|
3349
|
+
ask_liquidity_usd?: number | null;
|
|
3350
|
+
/** Format: int32 */
|
|
3351
|
+
bid_levels?: number | null;
|
|
3352
|
+
/** Format: int32 */
|
|
3353
|
+
ask_levels?: number | null;
|
|
3354
|
+
}[];
|
|
3355
|
+
};
|
|
3356
|
+
};
|
|
3357
|
+
/** @description Missing or invalid parameters */
|
|
3358
|
+
400: {
|
|
3359
|
+
headers: {
|
|
3360
|
+
[name: string]: unknown;
|
|
3361
|
+
};
|
|
3362
|
+
content?: never;
|
|
3363
|
+
};
|
|
3364
|
+
/** @description Market not found or no snapshots exist */
|
|
3365
|
+
404: {
|
|
3366
|
+
headers: {
|
|
3367
|
+
[name: string]: unknown;
|
|
3368
|
+
};
|
|
3369
|
+
content?: never;
|
|
3370
|
+
};
|
|
3371
|
+
};
|
|
3372
|
+
};
|
|
3373
|
+
get_spread_history: {
|
|
3374
|
+
parameters: {
|
|
3375
|
+
query?: {
|
|
3376
|
+
/** @description Token ID (required if condition_id / market_slug not set) */
|
|
3377
|
+
position_id?: string;
|
|
3378
|
+
/** @description Condition ID — returns spread history for all positions in this market */
|
|
3379
|
+
condition_id?: string;
|
|
3380
|
+
/** @description Market slug (alternative to condition_id) */
|
|
3381
|
+
market_slug?: string;
|
|
3382
|
+
/** @description Start timestamp (Unix milliseconds, inclusive) */
|
|
3383
|
+
from?: number;
|
|
3384
|
+
/** @description End timestamp (Unix milliseconds, inclusive) */
|
|
3385
|
+
to?: number;
|
|
3386
|
+
/** @description Only return rows with spread >= this value */
|
|
3387
|
+
min_spread?: number;
|
|
3388
|
+
/** @description Only return rows with spread <= this value */
|
|
3389
|
+
max_spread?: number;
|
|
3390
|
+
/** @description Only return rows where total liquidity (bid + ask) >= this value */
|
|
3391
|
+
min_liquidity?: number;
|
|
3392
|
+
/** @description Number of results (default: 100, max: 1000) */
|
|
3393
|
+
limit?: number;
|
|
3394
|
+
/** @description Cursor from previous response's pagination.pagination_key */
|
|
3395
|
+
pagination_key?: string;
|
|
3396
|
+
};
|
|
3397
|
+
header?: never;
|
|
3398
|
+
path?: never;
|
|
3399
|
+
cookie?: never;
|
|
3400
|
+
};
|
|
3401
|
+
requestBody?: never;
|
|
3402
|
+
responses: {
|
|
3403
|
+
/** @description Spread time series rows, newest first. ts is Unix milliseconds. */
|
|
3404
|
+
200: {
|
|
3405
|
+
headers: {
|
|
3406
|
+
[name: string]: unknown;
|
|
3407
|
+
};
|
|
3408
|
+
content: {
|
|
3409
|
+
"application/json": {
|
|
3410
|
+
/** Format: int64 */
|
|
3411
|
+
ts: number;
|
|
3412
|
+
position_id: string;
|
|
3413
|
+
condition_id: string;
|
|
3414
|
+
/** Format: double */
|
|
3415
|
+
best_bid?: number | null;
|
|
3416
|
+
/** Format: double */
|
|
3417
|
+
best_ask?: number | null;
|
|
3418
|
+
/** Format: double */
|
|
3419
|
+
mid_price?: number | null;
|
|
3420
|
+
/** Format: double */
|
|
3421
|
+
spread?: number | null;
|
|
3422
|
+
/** Format: double */
|
|
3423
|
+
bid_liquidity_usd?: number | null;
|
|
3424
|
+
/** Format: double */
|
|
3425
|
+
ask_liquidity_usd?: number | null;
|
|
3426
|
+
/** Format: int32 */
|
|
3427
|
+
bid_levels?: number | null;
|
|
3428
|
+
/** Format: int32 */
|
|
3429
|
+
ask_levels?: number | null;
|
|
3430
|
+
}[];
|
|
3431
|
+
};
|
|
3432
|
+
};
|
|
3433
|
+
/** @description Missing or invalid parameters */
|
|
3434
|
+
400: {
|
|
3435
|
+
headers: {
|
|
3436
|
+
[name: string]: unknown;
|
|
3437
|
+
};
|
|
3438
|
+
content?: never;
|
|
3439
|
+
};
|
|
3440
|
+
};
|
|
3441
|
+
};
|
|
2900
3442
|
search: {
|
|
2901
3443
|
parameters: {
|
|
2902
3444
|
query: {
|