@structbuild/sdk 0.3.4 → 0.3.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.
- package/dist/generated/polymarket.d.ts +135 -0
- package/dist/generated/ws.d.ts +248 -87
- package/dist/index.cjs +16 -5
- package/dist/index.cjs.map +7 -7
- package/dist/index.js +16 -5
- package/dist/index.js.map +7 -7
- package/dist/namespaces/base.d.ts +1 -0
- package/dist/namespaces/trader.d.ts +2 -1
- package/dist/types/index.d.ts +6 -1
- package/dist/types/ws.d.ts +14 -2
- package/package.json +1 -1
|
@@ -703,6 +703,26 @@ export interface paths {
|
|
|
703
703
|
patch?: never;
|
|
704
704
|
trace?: never;
|
|
705
705
|
};
|
|
706
|
+
"/polymarket/trader/leaderboard": {
|
|
707
|
+
parameters: {
|
|
708
|
+
query?: never;
|
|
709
|
+
header?: never;
|
|
710
|
+
path?: never;
|
|
711
|
+
cookie?: never;
|
|
712
|
+
};
|
|
713
|
+
/**
|
|
714
|
+
* Get trader leaderboard
|
|
715
|
+
* @description Global trader leaderboard ranked by PnL or volume over the selected timeframe. Each entry carries the trader's identity, ranking score (`pnl`), and the full set of Struct trading metrics (volumes split by side, markets_won / markets_lost, win rate, average PnL per market and per trade, average hold time, best trade, fees, and first / last trade timestamps). Enrichment fields are `null` when we don't yet have a row for that address in the selected timeframe.
|
|
716
|
+
*/
|
|
717
|
+
get: operations["get_polymarket_leaderboard"];
|
|
718
|
+
put?: never;
|
|
719
|
+
post?: never;
|
|
720
|
+
delete?: never;
|
|
721
|
+
options?: never;
|
|
722
|
+
head?: never;
|
|
723
|
+
patch?: never;
|
|
724
|
+
trace?: never;
|
|
725
|
+
};
|
|
706
726
|
"/polymarket/trader/pnl/{address}": {
|
|
707
727
|
parameters: {
|
|
708
728
|
query?: never;
|
|
@@ -1380,6 +1400,76 @@ export interface components {
|
|
|
1380
1400
|
/** Format: int64 */
|
|
1381
1401
|
last_trade_at?: number | null;
|
|
1382
1402
|
};
|
|
1403
|
+
/**
|
|
1404
|
+
* @description Market category filter for the trader leaderboard.
|
|
1405
|
+
* Mirrors `common::gamma::categories::Category` plus `overall` (= all).
|
|
1406
|
+
* @enum {string}
|
|
1407
|
+
*/
|
|
1408
|
+
LeaderboardCategory: "overall" | "politics" | "sports" | "crypto" | "finance" | "culture" | "mentions" | "weather" | "economics" | "tech";
|
|
1409
|
+
/**
|
|
1410
|
+
* @description Flat response row. `trader` is the canonical `TraderInfo` used across all
|
|
1411
|
+
* our other endpoints; all enrichment fields sit at the top level. Fields
|
|
1412
|
+
* other than `trader`, `rank`, `pnl`, and `timeframe` are sourced from our
|
|
1413
|
+
* `prediction_trader_pnl_*_v2` tables and are `null` when we don't yet have
|
|
1414
|
+
* a row for that address in the selected timeframe.
|
|
1415
|
+
*/
|
|
1416
|
+
LeaderboardEntry: {
|
|
1417
|
+
/** Format: int64 */
|
|
1418
|
+
rank?: number | null;
|
|
1419
|
+
trader: components["schemas"]["TraderInfo"];
|
|
1420
|
+
/** Format: double */
|
|
1421
|
+
pnl?: number | null;
|
|
1422
|
+
/** Format: int64 */
|
|
1423
|
+
events_traded?: number | null;
|
|
1424
|
+
/** Format: int64 */
|
|
1425
|
+
markets_traded?: number | null;
|
|
1426
|
+
/** Format: int64 */
|
|
1427
|
+
markets_won?: number | null;
|
|
1428
|
+
/** Format: int64 */
|
|
1429
|
+
markets_lost?: number | null;
|
|
1430
|
+
/** Format: double */
|
|
1431
|
+
market_win_rate_pct?: number | null;
|
|
1432
|
+
/** Format: double */
|
|
1433
|
+
total_volume_usd?: number | null;
|
|
1434
|
+
/** Format: double */
|
|
1435
|
+
buy_volume_usd?: number | null;
|
|
1436
|
+
/** Format: double */
|
|
1437
|
+
sell_volume_usd?: number | null;
|
|
1438
|
+
/** Format: double */
|
|
1439
|
+
redemption_volume_usd?: number | null;
|
|
1440
|
+
/** Format: double */
|
|
1441
|
+
merge_volume_usd?: number | null;
|
|
1442
|
+
/** Format: int64 */
|
|
1443
|
+
total_buys?: number | null;
|
|
1444
|
+
/** Format: int64 */
|
|
1445
|
+
total_sells?: number | null;
|
|
1446
|
+
/** Format: int64 */
|
|
1447
|
+
total_redemptions?: number | null;
|
|
1448
|
+
/** Format: int64 */
|
|
1449
|
+
total_merges?: number | null;
|
|
1450
|
+
/** Format: int64 */
|
|
1451
|
+
total_trades?: number | null;
|
|
1452
|
+
/** Format: double */
|
|
1453
|
+
total_fees?: number | null;
|
|
1454
|
+
/** Format: double */
|
|
1455
|
+
avg_pnl_per_market?: number | null;
|
|
1456
|
+
/** Format: double */
|
|
1457
|
+
avg_pnl_per_trade?: number | null;
|
|
1458
|
+
/** Format: double */
|
|
1459
|
+
avg_hold_time_seconds?: number | null;
|
|
1460
|
+
/** Format: double */
|
|
1461
|
+
best_trade_pnl_usd?: number | null;
|
|
1462
|
+
best_trade_condition_id?: string | null;
|
|
1463
|
+
/** Format: int64 */
|
|
1464
|
+
first_trade_at?: number | null;
|
|
1465
|
+
/** Format: int64 */
|
|
1466
|
+
last_trade_at?: number | null;
|
|
1467
|
+
};
|
|
1468
|
+
/**
|
|
1469
|
+
* @description Sort key for the trader leaderboard (`GET /polymarket/trader/leaderboard`).
|
|
1470
|
+
* @enum {string}
|
|
1471
|
+
*/
|
|
1472
|
+
LeaderboardSortBy: "pnl" | "volume";
|
|
1383
1473
|
/** @description Response for market (condition_id) holders endpoint */
|
|
1384
1474
|
MarketHoldersResponse: {
|
|
1385
1475
|
/** @description Market condition ID */
|
|
@@ -4420,6 +4510,51 @@ export interface operations {
|
|
|
4420
4510
|
};
|
|
4421
4511
|
};
|
|
4422
4512
|
};
|
|
4513
|
+
get_polymarket_leaderboard: {
|
|
4514
|
+
parameters: {
|
|
4515
|
+
query?: {
|
|
4516
|
+
/** @description Aggregation window (default: lifetime) */
|
|
4517
|
+
timeframe?: components["schemas"]["PnlTimeframe"];
|
|
4518
|
+
/** @description Order by: pnl or volume (default: pnl). Case-insensitive. */
|
|
4519
|
+
sort_by?: components["schemas"]["LeaderboardSortBy"];
|
|
4520
|
+
/** @description Rows per page, 1..=50 (default: 20) */
|
|
4521
|
+
limit?: number;
|
|
4522
|
+
/** @description Offset for pagination (default: 0) */
|
|
4523
|
+
offset?: number;
|
|
4524
|
+
/** @description Market category filter. Case-insensitive. Default: overall. */
|
|
4525
|
+
category?: components["schemas"]["LeaderboardCategory"];
|
|
4526
|
+
};
|
|
4527
|
+
header?: never;
|
|
4528
|
+
path?: never;
|
|
4529
|
+
cookie?: never;
|
|
4530
|
+
};
|
|
4531
|
+
requestBody?: never;
|
|
4532
|
+
responses: {
|
|
4533
|
+
/** @description Leaderboard rows with full trader metrics. */
|
|
4534
|
+
200: {
|
|
4535
|
+
headers: {
|
|
4536
|
+
[name: string]: unknown;
|
|
4537
|
+
};
|
|
4538
|
+
content: {
|
|
4539
|
+
"application/json": components["schemas"]["LeaderboardEntry"][];
|
|
4540
|
+
};
|
|
4541
|
+
};
|
|
4542
|
+
/** @description Bad request — invalid timeframe, sort_by, or category */
|
|
4543
|
+
400: {
|
|
4544
|
+
headers: {
|
|
4545
|
+
[name: string]: unknown;
|
|
4546
|
+
};
|
|
4547
|
+
content?: never;
|
|
4548
|
+
};
|
|
4549
|
+
/** @description Leaderboard unavailable */
|
|
4550
|
+
500: {
|
|
4551
|
+
headers: {
|
|
4552
|
+
[name: string]: unknown;
|
|
4553
|
+
};
|
|
4554
|
+
content?: never;
|
|
4555
|
+
};
|
|
4556
|
+
};
|
|
4557
|
+
};
|
|
4423
4558
|
get_trader_pnl: {
|
|
4424
4559
|
parameters: {
|
|
4425
4560
|
query?: {
|
package/dist/generated/ws.d.ts
CHANGED
|
@@ -2,101 +2,110 @@ export type paths = Record<string, never>;
|
|
|
2
2
|
export type webhooks = Record<string, never>;
|
|
3
3
|
export interface components {
|
|
4
4
|
schemas: {
|
|
5
|
-
/** @description Server-pushed
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
rewards_config?: {
|
|
18
|
-
id?: number;
|
|
19
|
-
/** @description Reward token address (e.g. USDC) */
|
|
20
|
-
asset_address?: string;
|
|
21
|
-
/** Format: date */
|
|
22
|
-
start_date?: string;
|
|
23
|
-
/** Format: date */
|
|
24
|
-
end_date?: string;
|
|
25
|
-
/** @description Daily reward rate in USDC */
|
|
26
|
-
rate_per_day?: number;
|
|
27
|
-
/** @description Cumulative rewards distributed */
|
|
28
|
-
total_rewards?: number;
|
|
29
|
-
}[];
|
|
30
|
-
/** @description Max spread to qualify for rewards */
|
|
31
|
-
rewards_max_spread?: number | null;
|
|
32
|
-
/** @description Min order size to qualify for rewards */
|
|
33
|
-
rewards_min_size?: number | null;
|
|
34
|
-
/** @description Native (non-sponsored) daily rate */
|
|
35
|
-
native_daily_rate?: number | null;
|
|
36
|
-
/** @description Sponsored daily rate */
|
|
37
|
-
sponsored_daily_rate?: number | null;
|
|
38
|
-
/** @description Combined daily rate (native + sponsored) */
|
|
39
|
-
total_daily_rate?: number | null;
|
|
40
|
-
/** @description Number of sponsors */
|
|
41
|
-
sponsors_count?: number | null;
|
|
42
|
-
} | null;
|
|
43
|
-
/** @description Unix timestamp in milliseconds */
|
|
44
|
-
timestamp_ms?: number;
|
|
45
|
-
};
|
|
46
|
-
/** @description Server acknowledgement for a CLOB rewards subscription. Envelope type: "clob_rewards_stream_subscribe_response". */
|
|
47
|
-
ClobRewardsSubscribeResponse: {
|
|
48
|
-
/** @description Accepted condition IDs */
|
|
49
|
-
condition_ids?: string[];
|
|
50
|
-
/** @description Whether subscribed to all changes */
|
|
51
|
-
subscribe_all?: boolean;
|
|
52
|
-
/** @description Filter values that were rejected */
|
|
53
|
-
rejected?: string[];
|
|
5
|
+
/** @description Server-pushed event: one or more open markets matching this subscription had a field change since the last tick. Envelope type: "markets_stream_update". Only rows that changed AND matched are in `data`. Client merges by `condition_id`. Each outcome in `data[i].outcomes` carries `latest_block` + `latest_confirmed_at` price-update watermarks. */
|
|
6
|
+
MarketsStreamUpdateEvent: {
|
|
7
|
+
/** @enum {string} */
|
|
8
|
+
type: "markets_stream_update";
|
|
9
|
+
/** @enum {string} */
|
|
10
|
+
room_id: "polymarket_markets_stream";
|
|
11
|
+
/** @enum {string} */
|
|
12
|
+
mode: "filter" | "ids";
|
|
13
|
+
/** @enum {integer} */
|
|
14
|
+
interval_ms: 500 | 1000 | 3000 | 10000;
|
|
15
|
+
/** @description Full market rows (same shape as `GET /polymarket/market`). Not a delta — each element is a complete row replacement. */
|
|
16
|
+
data: Record<string, never>[];
|
|
54
17
|
};
|
|
55
|
-
/** @description
|
|
56
|
-
|
|
18
|
+
/** @description Server acknowledgement for a markets_stream subscribe/unsubscribe. Envelope type: "markets_stream_subscribe_response". */
|
|
19
|
+
MarketsStreamSubscribeResponse: {
|
|
57
20
|
/** @enum {string} */
|
|
58
|
-
|
|
59
|
-
|
|
21
|
+
mode?: "filter" | "ids" | "";
|
|
22
|
+
interval_ms?: number;
|
|
23
|
+
/** @description Accepted condition_ids (ids mode). */
|
|
60
24
|
condition_ids?: string[];
|
|
61
|
-
|
|
62
|
-
|
|
25
|
+
market_slugs?: string[];
|
|
26
|
+
event_slugs?: string[];
|
|
27
|
+
/** @description Ids that failed normalization or exceeded the per-sub cap. */
|
|
28
|
+
rejected?: string[];
|
|
29
|
+
/** @description Non-null when the subscribe was rejected. */
|
|
30
|
+
error?: string | null;
|
|
63
31
|
};
|
|
64
|
-
/** @description
|
|
65
|
-
|
|
66
|
-
/** @description
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
/** @description List-API-shaped filter evaluated in-memory against changed rows. `status` is NOT accepted — the cache only holds open markets. */
|
|
33
|
+
MarketsStreamFilter: {
|
|
34
|
+
/** @description Case-insensitive substring match on `title`. 3–100 chars. */
|
|
35
|
+
search?: string;
|
|
36
|
+
categories?: string[];
|
|
37
|
+
exclude_categories?: string[];
|
|
38
|
+
tags?: string[];
|
|
39
|
+
exclude_tags?: string[];
|
|
40
|
+
min_volume?: number;
|
|
41
|
+
max_volume?: number;
|
|
42
|
+
min_txns?: number;
|
|
43
|
+
max_txns?: number;
|
|
44
|
+
min_unique_traders?: number;
|
|
45
|
+
max_unique_traders?: number;
|
|
46
|
+
min_liquidity?: number;
|
|
47
|
+
max_liquidity?: number;
|
|
48
|
+
/** Format: int64 */
|
|
49
|
+
min_holders?: number;
|
|
50
|
+
/** Format: int64 */
|
|
51
|
+
max_holders?: number;
|
|
74
52
|
/**
|
|
75
53
|
* Format: int64
|
|
76
|
-
* @description
|
|
54
|
+
* @description Filter markets with `end_time >= start_time` (Unix seconds).
|
|
77
55
|
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
56
|
+
start_time?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Format: int64
|
|
59
|
+
* @description Filter markets with `end_time <= end_time` (Unix seconds).
|
|
60
|
+
*/
|
|
61
|
+
end_time?: number;
|
|
62
|
+
/** @description When true, only markets with at least one CLOB reward. */
|
|
63
|
+
has_rewards?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @description Timeframe that `volume`/`txns`/`unique_traders` thresholds are evaluated against. Default `24h`.
|
|
66
|
+
* @enum {string}
|
|
67
|
+
*/
|
|
68
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
69
|
+
};
|
|
70
|
+
/** @description Subscribe / unsubscribe message for polymarket_markets_stream. */
|
|
71
|
+
MarketsStreamSubscribeMessage: {
|
|
72
|
+
/**
|
|
73
|
+
* @description `subscribe` creates/replaces a slot. `unsubscribe` removes one slot (needs `mode` + `interval_ms`). `unsubscribe_all` removes every slot this client holds in the room.
|
|
74
|
+
* @enum {string}
|
|
75
|
+
*/
|
|
76
|
+
action: "subscribe" | "unsubscribe" | "unsubscribe_all";
|
|
77
|
+
/**
|
|
78
|
+
* @description Flush cadence. Required for subscribe / unsubscribe. Default 1000 if omitted.
|
|
79
|
+
* @enum {integer}
|
|
80
|
+
*/
|
|
81
|
+
interval_ms?: 500 | 1000 | 3000 | 10000;
|
|
82
|
+
/**
|
|
83
|
+
* @description Subscription mode. Default `filter`.
|
|
84
|
+
* @enum {string}
|
|
85
|
+
*/
|
|
86
|
+
mode?: "filter" | "ids";
|
|
87
|
+
/** @description Filter body (only used when `mode=filter`). All fields optional. */
|
|
88
|
+
filter?: components["schemas"]["MarketsStreamFilter"];
|
|
89
|
+
/** @description Ids mode: 0x-prefixed lowercase 32-byte hex. Counts toward the 500-id cap. */
|
|
90
|
+
condition_ids?: string[];
|
|
91
|
+
/** @description Ids mode: market slug strings. */
|
|
92
|
+
market_slugs?: string[];
|
|
93
|
+
/** @description Ids mode: event slug strings — matches every child market of each event. */
|
|
94
|
+
event_slugs?: string[];
|
|
95
|
+
};
|
|
96
|
+
/** @description Server-pushed event: one or more open events matching this subscription had a field change since the last tick. Envelope type: "events_stream_update". Only rows that changed AND matched are in `data`. Client merges into its local state by `id`. */
|
|
97
|
+
EventsStreamUpdateEvent: {
|
|
98
|
+
/** @enum {string} */
|
|
99
|
+
type: "events_stream_update";
|
|
100
|
+
/** @enum {string} */
|
|
101
|
+
room_id: "polymarket_events_stream";
|
|
102
|
+
/** @enum {string} */
|
|
103
|
+
mode: "filter" | "ids";
|
|
104
|
+
/** @enum {integer} */
|
|
105
|
+
interval_ms: 500 | 1000 | 3000 | 10000;
|
|
106
|
+
/** @description Full `PolymarketEvent` rows (same shape as `GET /polymarket/events`). Not a delta — each array element is a complete row replacement. */
|
|
107
|
+
data: Record<string, never>[];
|
|
97
108
|
};
|
|
98
|
-
/** @description A single price level: [price_string, size_string] */
|
|
99
|
-
OrderBookLevel: string[];
|
|
100
109
|
/** @description Subscribe to the trades stream. No filters = subscribe to all trades. */
|
|
101
110
|
TradesStreamSubscribeMessage: {
|
|
102
111
|
/** @enum {string} */
|
|
@@ -914,6 +923,158 @@ export interface components {
|
|
|
914
923
|
/** @description Filter values that were rejected (invalid format or limit exceeded) */
|
|
915
924
|
rejected?: string[];
|
|
916
925
|
};
|
|
926
|
+
/** @description A single price level: [price_string, size_string] */
|
|
927
|
+
OrderBookLevel: string[];
|
|
928
|
+
/** @description Server-pushed event: full CLOB orderbook snapshot for an outcome token. Envelope type: "order_book_update". Delivered whenever the book changes for a subscribed condition or position. */
|
|
929
|
+
OrderBookUpdateEvent: {
|
|
930
|
+
/** @description Hex token ID (position / outcome token) */
|
|
931
|
+
asset_id: string;
|
|
932
|
+
/** @description Condition ID (hex) */
|
|
933
|
+
market: string;
|
|
934
|
+
/** @description Bid levels sorted best-first (highest price first) */
|
|
935
|
+
bids: components["schemas"]["OrderBookLevel"][];
|
|
936
|
+
/** @description Ask levels sorted best-first (lowest price first) */
|
|
937
|
+
asks: components["schemas"]["OrderBookLevel"][];
|
|
938
|
+
/**
|
|
939
|
+
* Format: int64
|
|
940
|
+
* @description Unix milliseconds from CLOB message
|
|
941
|
+
*/
|
|
942
|
+
timestamp: number;
|
|
943
|
+
/** @description Orderbook content hash — identical hash means no change */
|
|
944
|
+
hash: string;
|
|
945
|
+
/** @description Best bid price (0–1) */
|
|
946
|
+
best_bid?: number | null;
|
|
947
|
+
/** @description Best ask price (0–1) */
|
|
948
|
+
best_ask?: number | null;
|
|
949
|
+
/** @description (best_bid + best_ask) / 2 */
|
|
950
|
+
mid_price?: number | null;
|
|
951
|
+
/** @description best_ask − best_bid */
|
|
952
|
+
spread?: number | null;
|
|
953
|
+
/** @description Total USD value of all bid levels */
|
|
954
|
+
bid_liquidity_usd?: number | null;
|
|
955
|
+
/** @description Total USD value of all ask levels */
|
|
956
|
+
ask_liquidity_usd?: number | null;
|
|
957
|
+
/** @description Number of bid price levels */
|
|
958
|
+
bid_levels?: number | null;
|
|
959
|
+
/** @description Number of ask price levels */
|
|
960
|
+
ask_levels?: number | null;
|
|
961
|
+
};
|
|
962
|
+
/** @description Subscribe to CLOB reward changes. Either provide specific condition_ids or set subscribe_all to true. */
|
|
963
|
+
ClobRewardsSubscribeMessage: {
|
|
964
|
+
/** @enum {string} */
|
|
965
|
+
action: "subscribe" | "unsubscribe_all";
|
|
966
|
+
/** @description Condition IDs to watch for reward changes. */
|
|
967
|
+
condition_ids?: string[];
|
|
968
|
+
/** @description If true, receive ALL reward changes across all markets. Overrides condition_ids. */
|
|
969
|
+
subscribe_all?: boolean;
|
|
970
|
+
};
|
|
971
|
+
/** @description Server acknowledgement for a CLOB rewards subscription. Envelope type: "clob_rewards_stream_subscribe_response". */
|
|
972
|
+
ClobRewardsSubscribeResponse: {
|
|
973
|
+
/** @description Accepted condition IDs */
|
|
974
|
+
condition_ids?: string[];
|
|
975
|
+
/** @description Whether subscribed to all changes */
|
|
976
|
+
subscribe_all?: boolean;
|
|
977
|
+
/** @description Filter values that were rejected */
|
|
978
|
+
rejected?: string[];
|
|
979
|
+
};
|
|
980
|
+
/** @description Server-pushed CLOB reward change event. Envelope type: "clob_rewards_update". */
|
|
981
|
+
ClobRewardsUpdateEvent: {
|
|
982
|
+
/**
|
|
983
|
+
* @description Type of change
|
|
984
|
+
* @enum {string}
|
|
985
|
+
*/
|
|
986
|
+
event_type?: "added" | "removed" | "updated";
|
|
987
|
+
/** @description Affected market condition ID */
|
|
988
|
+
condition_id?: string;
|
|
989
|
+
/** @description Full reward state (null for 'removed' events) */
|
|
990
|
+
reward?: {
|
|
991
|
+
condition_id?: string;
|
|
992
|
+
rewards_config?: {
|
|
993
|
+
id?: number;
|
|
994
|
+
/** @description Reward token address (e.g. USDC) */
|
|
995
|
+
asset_address?: string;
|
|
996
|
+
/** Format: date */
|
|
997
|
+
start_date?: string;
|
|
998
|
+
/** Format: date */
|
|
999
|
+
end_date?: string;
|
|
1000
|
+
/** @description Daily reward rate in USDC */
|
|
1001
|
+
rate_per_day?: number;
|
|
1002
|
+
/** @description Cumulative rewards distributed */
|
|
1003
|
+
total_rewards?: number;
|
|
1004
|
+
}[];
|
|
1005
|
+
/** @description Max spread to qualify for rewards */
|
|
1006
|
+
rewards_max_spread?: number | null;
|
|
1007
|
+
/** @description Min order size to qualify for rewards */
|
|
1008
|
+
rewards_min_size?: number | null;
|
|
1009
|
+
/** @description Native (non-sponsored) daily rate */
|
|
1010
|
+
native_daily_rate?: number | null;
|
|
1011
|
+
/** @description Sponsored daily rate */
|
|
1012
|
+
sponsored_daily_rate?: number | null;
|
|
1013
|
+
/** @description Combined daily rate (native + sponsored) */
|
|
1014
|
+
total_daily_rate?: number | null;
|
|
1015
|
+
/** @description Number of sponsors */
|
|
1016
|
+
sponsors_count?: number | null;
|
|
1017
|
+
} | null;
|
|
1018
|
+
/** @description Unix timestamp in milliseconds */
|
|
1019
|
+
timestamp_ms?: number;
|
|
1020
|
+
};
|
|
1021
|
+
/** @description Subscribe / unsubscribe message for polymarket_events_stream. */
|
|
1022
|
+
EventsStreamSubscribeMessage: {
|
|
1023
|
+
/**
|
|
1024
|
+
* @description `subscribe` creates/replaces a slot. `unsubscribe` removes one slot (needs `mode` + `interval_ms`). `unsubscribe_all` removes every slot this client holds in the room.
|
|
1025
|
+
* @enum {string}
|
|
1026
|
+
*/
|
|
1027
|
+
action: "subscribe" | "unsubscribe" | "unsubscribe_all";
|
|
1028
|
+
/**
|
|
1029
|
+
* @description Flush cadence. Required for subscribe / unsubscribe. Default 1000 if omitted.
|
|
1030
|
+
* @enum {integer}
|
|
1031
|
+
*/
|
|
1032
|
+
interval_ms?: 500 | 1000 | 3000 | 10000;
|
|
1033
|
+
/**
|
|
1034
|
+
* @description Subscription mode. Default `filter`.
|
|
1035
|
+
* @enum {string}
|
|
1036
|
+
*/
|
|
1037
|
+
mode?: "filter" | "ids";
|
|
1038
|
+
/** @description Filter body (only used when `mode=filter`). All fields optional; omitted fields are unconstrained. */
|
|
1039
|
+
filter?: components["schemas"]["EventsStreamFilter"];
|
|
1040
|
+
/** @description Ids mode: event slugs to watch. Combined with `event_ids` up to 500 total. */
|
|
1041
|
+
event_slugs?: string[];
|
|
1042
|
+
/** @description Ids mode: event ids to watch. Combined with `event_slugs` up to 500 total. */
|
|
1043
|
+
event_ids?: string[];
|
|
1044
|
+
};
|
|
1045
|
+
/** @description List-API-shaped filter evaluated in-memory against changed rows. `status` is NOT an accepted field — the cache only holds open events. */
|
|
1046
|
+
EventsStreamFilter: {
|
|
1047
|
+
/** @description Case-insensitive substring match on `title`. 3–100 chars. */
|
|
1048
|
+
search?: string;
|
|
1049
|
+
categories?: string[];
|
|
1050
|
+
exclude_categories?: string[];
|
|
1051
|
+
/** @description Match by tag slug OR label (case-insensitive). */
|
|
1052
|
+
tags?: string[];
|
|
1053
|
+
exclude_tags?: string[];
|
|
1054
|
+
min_volume?: number;
|
|
1055
|
+
max_volume?: number;
|
|
1056
|
+
min_txns?: number;
|
|
1057
|
+
max_txns?: number;
|
|
1058
|
+
min_unique_traders?: number;
|
|
1059
|
+
max_unique_traders?: number;
|
|
1060
|
+
/**
|
|
1061
|
+
* @description Timeframe that `volume`/`txns`/`unique_traders` thresholds are evaluated against. Default `24h`.
|
|
1062
|
+
* @enum {string}
|
|
1063
|
+
*/
|
|
1064
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
1065
|
+
};
|
|
1066
|
+
/** @description Server acknowledgement for an events_stream subscribe/unsubscribe. Envelope type: "events_stream_subscribe_response". */
|
|
1067
|
+
EventsStreamSubscribeResponse: {
|
|
1068
|
+
/** @enum {string} */
|
|
1069
|
+
mode?: "filter" | "ids" | "";
|
|
1070
|
+
interval_ms?: number;
|
|
1071
|
+
/** @description Accepted ids (ids mode only). Empty in filter mode. */
|
|
1072
|
+
event_slugs?: string[];
|
|
1073
|
+
/** @description Ids that failed normalization (ids mode). */
|
|
1074
|
+
rejected?: string[];
|
|
1075
|
+
/** @description Non-null when the subscribe was rejected (invalid cadence, bad filter, too many subs, …). */
|
|
1076
|
+
error?: string | null;
|
|
1077
|
+
};
|
|
917
1078
|
/**
|
|
918
1079
|
* OrderFilled / OrdersMatched
|
|
919
1080
|
* @description A buy/sell trade was matched on the exchange.
|
package/dist/index.cjs
CHANGED
|
@@ -289,6 +289,14 @@ class HttpClient {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/namespaces/base.ts
|
|
292
|
+
function encodePathParam(value) {
|
|
293
|
+
try {
|
|
294
|
+
return encodeURIComponent(decodeURIComponent(value));
|
|
295
|
+
} catch {
|
|
296
|
+
return encodeURIComponent(value);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
292
300
|
class Namespace {
|
|
293
301
|
http;
|
|
294
302
|
defaultVenue;
|
|
@@ -357,7 +365,7 @@ class TagsNamespace extends Namespace {
|
|
|
357
365
|
return this.get(venue, "/tags", { params: { ...params } });
|
|
358
366
|
}
|
|
359
367
|
async getTag(params, venue) {
|
|
360
|
-
return this.get(venue, `/tags/${
|
|
368
|
+
return this.get(venue, `/tags/${encodePathParam(params.identifier)}`);
|
|
361
369
|
}
|
|
362
370
|
}
|
|
363
371
|
// src/namespaces/events.ts
|
|
@@ -367,11 +375,11 @@ class EventsNamespace extends Namespace {
|
|
|
367
375
|
}
|
|
368
376
|
async getEvent(params, venue) {
|
|
369
377
|
const { identifier, ...query } = params;
|
|
370
|
-
return this.get(venue, `/events/${
|
|
378
|
+
return this.get(venue, `/events/${encodePathParam(identifier)}`, { params: { ...query } });
|
|
371
379
|
}
|
|
372
380
|
async getEventBySlug(params, venue) {
|
|
373
381
|
const { slug, ...query } = params;
|
|
374
|
-
return this.get(venue, `/events/slug/${
|
|
382
|
+
return this.get(venue, `/events/slug/${encodePathParam(slug)}`, { params: { ...query } });
|
|
375
383
|
}
|
|
376
384
|
async getEventChart(params, venue) {
|
|
377
385
|
return this.get(venue, "/events/chart", { params: { ...params } });
|
|
@@ -436,7 +444,7 @@ class SeriesNamespace extends Namespace {
|
|
|
436
444
|
}
|
|
437
445
|
async getSeriesEvents(params, venue) {
|
|
438
446
|
const { identifier, ...query } = params;
|
|
439
|
-
return this.get(venue, `/series/${
|
|
447
|
+
return this.get(venue, `/series/${encodePathParam(identifier)}/events`, { params: { ...query } });
|
|
440
448
|
}
|
|
441
449
|
}
|
|
442
450
|
// src/namespaces/trader.ts
|
|
@@ -482,6 +490,9 @@ class TraderNamespace extends Namespace {
|
|
|
482
490
|
async getGlobalPnl(params, venue) {
|
|
483
491
|
return this.get(venue, "/trader/global_pnl", { params: { ...params } });
|
|
484
492
|
}
|
|
493
|
+
async getLeaderboard(params, venue) {
|
|
494
|
+
return this.get(venue, "/trader/leaderboard", { params: { ...params } });
|
|
495
|
+
}
|
|
485
496
|
}
|
|
486
497
|
// src/namespaces/bonds.ts
|
|
487
498
|
class BondsNamespace extends Namespace {
|
|
@@ -1356,5 +1367,5 @@ async function* paginate(fetcher, params, pageSize = DEFAULT_PAGE_SIZE) {
|
|
|
1356
1367
|
}
|
|
1357
1368
|
}
|
|
1358
1369
|
|
|
1359
|
-
//# debugId=
|
|
1370
|
+
//# debugId=106A97244964134B64756E2164756E21
|
|
1360
1371
|
//# sourceMappingURL=index.js.map
|