parsec-api 0.9.0 → 0.12.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/CHANGELOG.md +56 -0
- package/README.md +0 -117
- package/client.d.mts +22 -23
- package/client.d.mts.map +1 -1
- package/client.d.ts +22 -23
- package/client.d.ts.map +1 -1
- package/client.js +24 -35
- package/client.js.map +1 -1
- package/client.mjs +24 -35
- package/client.mjs.map +1 -1
- package/core/error.d.mts +0 -12
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +0 -12
- package/core/error.d.ts.map +1 -1
- package/core/error.js +0 -24
- package/core/error.js.map +1 -1
- package/core/error.mjs +0 -24
- package/core/error.mjs.map +1 -1
- package/index.d.mts +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/tslib.js +21 -21
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +2 -3
- package/resources/account.d.mts +63 -39
- package/resources/account.d.mts.map +1 -1
- package/resources/account.d.ts +63 -39
- package/resources/account.d.ts.map +1 -1
- package/resources/account.js +5 -13
- package/resources/account.js.map +1 -1
- package/resources/account.mjs +5 -13
- package/resources/account.mjs.map +1 -1
- package/resources/builder/builder.d.mts +40 -0
- package/resources/builder/builder.d.mts.map +1 -0
- package/resources/builder/builder.d.ts +40 -0
- package/resources/builder/builder.d.ts.map +1 -0
- package/resources/builder/builder.js +32 -0
- package/resources/builder/builder.js.map +1 -0
- package/resources/builder/builder.mjs +27 -0
- package/resources/builder/builder.mjs.map +1 -0
- package/resources/builder/escrow.d.mts +49 -0
- package/resources/builder/escrow.d.mts.map +1 -0
- package/resources/builder/escrow.d.ts +49 -0
- package/resources/builder/escrow.d.ts.map +1 -0
- package/resources/builder/escrow.js +17 -0
- package/resources/builder/escrow.js.map +1 -0
- package/resources/builder/escrow.mjs +13 -0
- package/resources/builder/escrow.mjs.map +1 -0
- package/resources/builder/index.d.mts +5 -0
- package/resources/builder/index.d.mts.map +1 -0
- package/resources/builder/index.d.ts +5 -0
- package/resources/builder/index.d.ts.map +1 -0
- package/resources/builder/index.js +13 -0
- package/resources/builder/index.js.map +1 -0
- package/resources/builder/index.mjs +6 -0
- package/resources/builder/index.mjs.map +1 -0
- package/resources/builder/onboard.d.mts +163 -0
- package/resources/builder/onboard.d.mts.map +1 -0
- package/resources/builder/onboard.d.ts +163 -0
- package/resources/builder/onboard.d.ts.map +1 -0
- package/resources/builder/onboard.js +16 -0
- package/resources/builder/onboard.js.map +1 -0
- package/resources/builder/onboard.mjs +12 -0
- package/resources/builder/onboard.mjs.map +1 -0
- package/resources/builder/users.d.mts +469 -0
- package/resources/builder/users.d.mts.map +1 -0
- package/resources/builder/users.d.ts +469 -0
- package/resources/builder/users.d.ts.map +1 -0
- package/resources/builder/users.js +46 -0
- package/resources/builder/users.js.map +1 -0
- package/resources/builder/users.mjs +42 -0
- package/resources/builder/users.mjs.map +1 -0
- package/resources/builder.d.mts +2 -0
- package/resources/builder.d.mts.map +1 -0
- package/resources/builder.d.ts +2 -0
- package/resources/builder.d.ts.map +1 -0
- package/resources/builder.js +6 -0
- package/resources/builder.js.map +1 -0
- package/resources/builder.mjs +3 -0
- package/resources/builder.mjs.map +1 -0
- package/resources/ctf.d.mts +97 -0
- package/resources/ctf.d.mts.map +1 -0
- package/resources/ctf.d.ts +97 -0
- package/resources/ctf.d.ts.map +1 -0
- package/resources/ctf.js +59 -0
- package/resources/ctf.js.map +1 -0
- package/resources/ctf.mjs +55 -0
- package/resources/ctf.mjs.map +1 -0
- package/resources/events.d.mts +84 -12
- package/resources/events.d.mts.map +1 -1
- package/resources/events.d.ts +84 -12
- package/resources/events.d.ts.map +1 -1
- package/resources/events.js +4 -15
- package/resources/events.js.map +1 -1
- package/resources/events.mjs +4 -15
- package/resources/events.mjs.map +1 -1
- package/resources/exchanges.d.mts +1 -1
- package/resources/exchanges.d.mts.map +1 -1
- package/resources/exchanges.d.ts +1 -1
- package/resources/exchanges.d.ts.map +1 -1
- package/resources/fills.d.mts +76 -0
- package/resources/fills.d.mts.map +1 -0
- package/resources/fills.d.ts +76 -0
- package/resources/fills.d.ts.map +1 -0
- package/resources/fills.js +27 -0
- package/resources/fills.js.map +1 -0
- package/resources/fills.mjs +23 -0
- package/resources/fills.mjs.map +1 -0
- package/resources/index.d.mts +7 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +7 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +6 -2
- package/resources/index.mjs.map +1 -1
- package/resources/markets.d.mts +92 -19
- package/resources/markets.d.mts.map +1 -1
- package/resources/markets.d.ts +92 -19
- package/resources/markets.d.ts.map +1 -1
- package/resources/markets.js +1 -30
- package/resources/markets.js.map +1 -1
- package/resources/markets.mjs +1 -29
- package/resources/markets.mjs.map +1 -1
- package/resources/onboard.d.mts +91 -0
- package/resources/onboard.d.mts.map +1 -0
- package/resources/onboard.d.ts +91 -0
- package/resources/onboard.d.ts.map +1 -0
- package/resources/onboard.js +17 -0
- package/resources/onboard.js.map +1 -0
- package/resources/onboard.mjs +13 -0
- package/resources/onboard.mjs.map +1 -0
- package/resources/orderbook.d.mts +5 -11
- package/resources/orderbook.d.mts.map +1 -1
- package/resources/orderbook.d.ts +5 -11
- package/resources/orderbook.d.ts.map +1 -1
- package/resources/orderbook.js +2 -1
- package/resources/orderbook.js.map +1 -1
- package/resources/orderbook.mjs +2 -1
- package/resources/orderbook.mjs.map +1 -1
- package/resources/price.d.mts +1 -0
- package/resources/price.d.mts.map +1 -1
- package/resources/price.d.ts +1 -0
- package/resources/price.d.ts.map +1 -1
- package/resources/price.js +1 -0
- package/resources/price.js.map +1 -1
- package/resources/price.mjs +1 -0
- package/resources/price.mjs.map +1 -1
- package/resources/trades.d.mts +12 -2
- package/resources/trades.d.mts.map +1 -1
- package/resources/trades.d.ts +12 -2
- package/resources/trades.d.ts.map +1 -1
- package/resources/trades.js +2 -1
- package/resources/trades.js.map +1 -1
- package/resources/trades.mjs +2 -1
- package/resources/trades.mjs.map +1 -1
- package/resources/wallet.d.mts +177 -0
- package/resources/wallet.d.mts.map +1 -0
- package/resources/wallet.d.ts +177 -0
- package/resources/wallet.d.ts.map +1 -0
- package/resources/wallet.js +26 -0
- package/resources/wallet.js.map +1 -0
- package/resources/wallet.mjs +22 -0
- package/resources/wallet.mjs.map +1 -0
- package/src/client.ts +55 -59
- package/src/core/error.ts +0 -29
- package/src/index.ts +3 -4
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/account.ts +78 -55
- package/src/resources/builder/builder.ts +78 -0
- package/src/resources/builder/escrow.ts +62 -0
- package/src/resources/builder/index.ts +15 -0
- package/src/resources/builder/onboard.ts +206 -0
- package/src/resources/builder/users.ts +606 -0
- package/src/resources/builder.ts +3 -0
- package/src/resources/ctf.ts +122 -0
- package/src/resources/events.ts +104 -26
- package/src/resources/exchanges.ts +2 -2
- package/src/resources/fills.ts +107 -0
- package/src/resources/index.ts +12 -15
- package/src/resources/markets.ts +114 -49
- package/src/resources/onboard.ts +116 -0
- package/src/resources/orderbook.ts +4 -12
- package/src/resources/price.ts +1 -0
- package/src/resources/trades.ts +14 -3
- package/src/resources/wallet.ts +224 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/approvals.d.mts +0 -74
- package/resources/approvals.d.mts.map +0 -1
- package/resources/approvals.d.ts +0 -74
- package/resources/approvals.d.ts.map +0 -1
- package/resources/approvals.js +0 -22
- package/resources/approvals.js.map +0 -1
- package/resources/approvals.mjs +0 -18
- package/resources/approvals.mjs.map +0 -1
- package/src/resources/approvals.ts +0 -107
package/src/resources/events.ts
CHANGED
|
@@ -3,28 +3,18 @@
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
|
-
import { attachBinaryOutcomeGetters } from './markets';
|
|
7
6
|
|
|
8
7
|
export class Events extends APIResource {
|
|
9
8
|
/**
|
|
10
|
-
* Aggregates markets by event ID from the
|
|
11
|
-
* sorted by total volume (descending). Markets without an event_id are
|
|
9
|
+
* Aggregates markets by event ID from the DuckDB gold layer. Returns event
|
|
10
|
+
* summaries sorted by total volume (descending). Markets without an event_id are
|
|
11
|
+
* excluded.
|
|
12
12
|
*/
|
|
13
13
|
list(
|
|
14
14
|
query: EventListParams | null | undefined = {},
|
|
15
15
|
options?: RequestOptions,
|
|
16
16
|
): APIPromise<EventListResponse> {
|
|
17
|
-
|
|
18
|
-
query,
|
|
19
|
-
...options,
|
|
20
|
-
}) as APIPromise<EventListResponse>;
|
|
21
|
-
return request._thenUnwrap((data: EventListResponse) => {
|
|
22
|
-
data.events.forEach((event) => {
|
|
23
|
-
if (!event.markets) return;
|
|
24
|
-
event.markets = event.markets.map((market) => attachBinaryOutcomeGetters(market));
|
|
25
|
-
});
|
|
26
|
-
return data;
|
|
27
|
-
});
|
|
17
|
+
return this._client.get('/api/v1/events', { query, ...options });
|
|
28
18
|
}
|
|
29
19
|
}
|
|
30
20
|
|
|
@@ -106,18 +96,6 @@ export namespace EventListResponse {
|
|
|
106
96
|
*/
|
|
107
97
|
outcomes: Array<Market.Outcome>;
|
|
108
98
|
|
|
109
|
-
/**
|
|
110
|
-
* Convenience getter for binary markets: outcome where `name` is "Yes"
|
|
111
|
-
* (case-insensitive).
|
|
112
|
-
*/
|
|
113
|
-
readonly yes?: Market.Outcome;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Convenience getter for binary markets: outcome where `name` is "No"
|
|
117
|
-
* (case-insensitive).
|
|
118
|
-
*/
|
|
119
|
-
readonly no?: Market.Outcome;
|
|
120
|
-
|
|
121
99
|
/**
|
|
122
100
|
* Parsec group ID for cross-exchange event grouping.
|
|
123
101
|
*/
|
|
@@ -180,6 +158,16 @@ export namespace EventListResponse {
|
|
|
180
158
|
*/
|
|
181
159
|
event_start_time?: string;
|
|
182
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Market icon URL.
|
|
163
|
+
*/
|
|
164
|
+
icon_url?: string | null;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Market image URL.
|
|
168
|
+
*/
|
|
169
|
+
image_url?: string | null;
|
|
170
|
+
|
|
183
171
|
/**
|
|
184
172
|
* Date of last data collection.
|
|
185
173
|
*/
|
|
@@ -195,6 +183,11 @@ export namespace EventListResponse {
|
|
|
195
183
|
*/
|
|
196
184
|
liquidity?: number;
|
|
197
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Cross-exchange same-market relations. Only included when `include_matches=true`.
|
|
188
|
+
*/
|
|
189
|
+
matched_markets?: Array<Market.MatchedMarket>;
|
|
190
|
+
|
|
198
191
|
/**
|
|
199
192
|
* Minimum order size in contracts. Varies per market on Polymarket (e.g. 5, 15);
|
|
200
193
|
* typically 1 on Kalshi.
|
|
@@ -211,6 +204,17 @@ export namespace EventListResponse {
|
|
|
211
204
|
*/
|
|
212
205
|
outcome_count?: number;
|
|
213
206
|
|
|
207
|
+
/**
|
|
208
|
+
* When bid/ask/last_price was last refreshed (upgraded to now when live WS data
|
|
209
|
+
* overlays the snapshot).
|
|
210
|
+
*/
|
|
211
|
+
price_updated_at?: string | null;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Co-dependent market relations. Only included when `include_related=true`.
|
|
215
|
+
*/
|
|
216
|
+
related_markets?: Array<Market.RelatedMarket>;
|
|
217
|
+
|
|
214
218
|
/**
|
|
215
219
|
* Market resolution rules.
|
|
216
220
|
*/
|
|
@@ -258,6 +262,80 @@ export namespace EventListResponse {
|
|
|
258
262
|
*/
|
|
259
263
|
token_id?: string;
|
|
260
264
|
}
|
|
265
|
+
|
|
266
|
+
export interface MatchedMarket {
|
|
267
|
+
/**
|
|
268
|
+
* Match confidence score (0.0–1.0).
|
|
269
|
+
*/
|
|
270
|
+
confidence: number;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Confidence tier: HIGH, MEDIUM, or LOW.
|
|
274
|
+
*/
|
|
275
|
+
confidence_tier: string;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Exchange of the related market.
|
|
279
|
+
*/
|
|
280
|
+
exchange: string;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Parsec ID of the related market.
|
|
284
|
+
*/
|
|
285
|
+
parsec_id: string;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Source of the match (e.g., embedding, llm).
|
|
289
|
+
*/
|
|
290
|
+
source: string;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Direction of dependency (for related markets only).
|
|
294
|
+
*/
|
|
295
|
+
dependency_direction?: string | null;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Type of dependency (for related markets only).
|
|
299
|
+
*/
|
|
300
|
+
dependency_type?: string | null;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface RelatedMarket {
|
|
304
|
+
/**
|
|
305
|
+
* Match confidence score (0.0–1.0).
|
|
306
|
+
*/
|
|
307
|
+
confidence: number;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Confidence tier: HIGH, MEDIUM, or LOW.
|
|
311
|
+
*/
|
|
312
|
+
confidence_tier: string;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Exchange of the related market.
|
|
316
|
+
*/
|
|
317
|
+
exchange: string;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Parsec ID of the related market.
|
|
321
|
+
*/
|
|
322
|
+
parsec_id: string;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Source of the match (e.g., embedding, llm).
|
|
326
|
+
*/
|
|
327
|
+
source: string;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Direction of dependency (for related markets only).
|
|
331
|
+
*/
|
|
332
|
+
dependency_direction?: string | null;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Type of dependency (for related markets only).
|
|
336
|
+
*/
|
|
337
|
+
dependency_type?: string | null;
|
|
338
|
+
}
|
|
261
339
|
}
|
|
262
340
|
}
|
|
263
341
|
|
|
@@ -32,8 +32,6 @@ export namespace ExchangeListResponse {
|
|
|
32
32
|
|
|
33
33
|
export namespace ExchangeListResponseItem {
|
|
34
34
|
export interface Has {
|
|
35
|
-
approvals: boolean;
|
|
36
|
-
|
|
37
35
|
cancel_order: boolean;
|
|
38
36
|
|
|
39
37
|
create_order: boolean;
|
|
@@ -42,6 +40,8 @@ export namespace ExchangeListResponse {
|
|
|
42
40
|
|
|
43
41
|
fetch_events: boolean;
|
|
44
42
|
|
|
43
|
+
fetch_fills: boolean;
|
|
44
|
+
|
|
45
45
|
fetch_markets: boolean;
|
|
46
46
|
|
|
47
47
|
fetch_orderbook: boolean;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
|
|
8
|
+
export class Fills extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Returns fills (individual trade executions) for the authenticated customer on
|
|
11
|
+
* the specified exchange. A single order can produce multiple fills.
|
|
12
|
+
*/
|
|
13
|
+
list(params: FillListParams, options?: RequestOptions): APIPromise<FillListResponse> {
|
|
14
|
+
const { 'X-Exchange-Credentials': xExchangeCredentials, ...query } = params;
|
|
15
|
+
return this._client.get('/api/v1/fills', {
|
|
16
|
+
query,
|
|
17
|
+
...options,
|
|
18
|
+
headers: buildHeaders([
|
|
19
|
+
{
|
|
20
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
21
|
+
},
|
|
22
|
+
options?.headers,
|
|
23
|
+
]),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type FillListResponse = Array<FillListResponse.FillListResponseItem>;
|
|
29
|
+
|
|
30
|
+
export namespace FillListResponse {
|
|
31
|
+
export interface FillListResponseItem {
|
|
32
|
+
/**
|
|
33
|
+
* Timestamp of the fill (ISO 8601).
|
|
34
|
+
*/
|
|
35
|
+
created_at: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Fee charged for this fill.
|
|
39
|
+
*/
|
|
40
|
+
fee: number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Unique fill identifier.
|
|
44
|
+
*/
|
|
45
|
+
fill_id: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Whether this fill was a taker (market order hitting resting liquidity).
|
|
49
|
+
*/
|
|
50
|
+
is_taker: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Market the fill occurred on (exchange-native ID).
|
|
54
|
+
*/
|
|
55
|
+
market_id: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* ID of the order that was filled.
|
|
59
|
+
*/
|
|
60
|
+
order_id: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The outcome traded (e.g., "Yes" or "No").
|
|
64
|
+
*/
|
|
65
|
+
outcome: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Execution price.
|
|
69
|
+
*/
|
|
70
|
+
price: number;
|
|
71
|
+
|
|
72
|
+
side: 'buy' | 'sell';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Number of contracts filled.
|
|
76
|
+
*/
|
|
77
|
+
size: number;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface FillListParams {
|
|
82
|
+
/**
|
|
83
|
+
* Query param: Exchange identifier (e.g., kalshi, polymarket).
|
|
84
|
+
*/
|
|
85
|
+
exchange: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Query param: Maximum number of fills to return.
|
|
89
|
+
*/
|
|
90
|
+
limit?: number;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Query param: Filter fills by a specific market ID (exchange-native).
|
|
94
|
+
*/
|
|
95
|
+
market_id?: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
99
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
100
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
101
|
+
*/
|
|
102
|
+
'X-Exchange-Credentials'?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export declare namespace Fills {
|
|
106
|
+
export { type FillListResponse as FillListResponse, type FillListParams as FillListParams };
|
|
107
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -3,21 +3,15 @@
|
|
|
3
3
|
export {
|
|
4
4
|
Account,
|
|
5
5
|
type AccountBalanceResponse,
|
|
6
|
-
type AccountCapabilitiesResponse,
|
|
7
6
|
type AccountPingResponse,
|
|
7
|
+
type AccountUsageResponse,
|
|
8
8
|
type AccountUserActivityResponse,
|
|
9
9
|
type AccountBalanceParams,
|
|
10
10
|
type AccountPingParams,
|
|
11
|
-
type AccountUpdateCredentialsParams,
|
|
12
11
|
type AccountUserActivityParams,
|
|
13
12
|
} from './account';
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
type ApprovalListResponse,
|
|
17
|
-
type ApprovalSetResponse,
|
|
18
|
-
type ApprovalListParams,
|
|
19
|
-
type ApprovalSetParams,
|
|
20
|
-
} from './approvals';
|
|
13
|
+
export { Builder, type BuilderPoolResponse } from './builder/builder';
|
|
14
|
+
export { Ctf, type CtfResponse, type CtfMergeParams, type CtfRedeemParams, type CtfSplitParams } from './ctf';
|
|
21
15
|
export { Events, type EventListResponse, type EventListParams } from './events';
|
|
22
16
|
export { Exchanges, type ExchangeListResponse } from './exchanges';
|
|
23
17
|
export {
|
|
@@ -25,13 +19,10 @@ export {
|
|
|
25
19
|
type ExecutionPriceRetrieveResponse,
|
|
26
20
|
type ExecutionPriceRetrieveParams,
|
|
27
21
|
} from './execution-price';
|
|
22
|
+
export { Fills, type FillListResponse, type FillListParams } from './fills';
|
|
28
23
|
export { Markets, type MarketListResponse, type MarketListParams } from './markets';
|
|
29
|
-
export {
|
|
30
|
-
|
|
31
|
-
type OrderbookRetrieveResponse,
|
|
32
|
-
type OrderbookRetrieveParams,
|
|
33
|
-
type OrderbookLevel,
|
|
34
|
-
} from './orderbook';
|
|
24
|
+
export { Onboard, type OnboardCreateResponse, type OnboardCreateParams } from './onboard';
|
|
25
|
+
export { Orderbook, type OrderbookRetrieveResponse, type OrderbookRetrieveParams } from './orderbook';
|
|
35
26
|
export {
|
|
36
27
|
Orders,
|
|
37
28
|
type Order,
|
|
@@ -44,6 +35,12 @@ export {
|
|
|
44
35
|
export { Positions, type PositionListResponse, type PositionListParams } from './positions';
|
|
45
36
|
export { Price, type PriceRetrieveResponse, type PriceRetrieveParams } from './price';
|
|
46
37
|
export { Trades, type TradeListResponse, type TradeListParams } from './trades';
|
|
38
|
+
export {
|
|
39
|
+
Wallet,
|
|
40
|
+
type WalletRetrieveResponse,
|
|
41
|
+
type WalletExportKeyResponse,
|
|
42
|
+
type WalletExportKeyParams,
|
|
43
|
+
} from './wallet';
|
|
47
44
|
export {
|
|
48
45
|
Websocket,
|
|
49
46
|
type CustomerUsage,
|
package/src/resources/markets.ts
CHANGED
|
@@ -4,34 +4,6 @@ import { APIResource } from '../core/resource';
|
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
6
|
|
|
7
|
-
function findOutcomeByName<T extends { name: string }>(outcomes: Array<T>, target: string): T | undefined {
|
|
8
|
-
const normalized = target.toLowerCase();
|
|
9
|
-
return outcomes.find((outcome) => outcome.name.toLowerCase() === normalized);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function attachBinaryOutcomeGetters<
|
|
13
|
-
TOutcome extends { name: string },
|
|
14
|
-
TMarket extends { outcomes: Array<TOutcome> },
|
|
15
|
-
>(market: TMarket): TMarket & { readonly yes?: TOutcome; readonly no?: TOutcome } {
|
|
16
|
-
if (!Object.prototype.hasOwnProperty.call(market, 'yes')) {
|
|
17
|
-
Object.defineProperty(market, 'yes', {
|
|
18
|
-
configurable: false,
|
|
19
|
-
enumerable: false,
|
|
20
|
-
get: () => findOutcomeByName(market.outcomes, 'yes'),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!Object.prototype.hasOwnProperty.call(market, 'no')) {
|
|
25
|
-
Object.defineProperty(market, 'no', {
|
|
26
|
-
configurable: false,
|
|
27
|
-
enumerable: false,
|
|
28
|
-
get: () => findOutcomeByName(market.outcomes, 'no'),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return market as TMarket & { readonly yes?: TOutcome; readonly no?: TOutcome };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
7
|
export class Markets extends APIResource {
|
|
36
8
|
/**
|
|
37
9
|
* Provide either `exchanges` (CSV) or `parsec_ids` (CSV). When `parsec_ids` is
|
|
@@ -41,14 +13,7 @@ export class Markets extends APIResource {
|
|
|
41
13
|
query: MarketListParams | null | undefined = {},
|
|
42
14
|
options?: RequestOptions,
|
|
43
15
|
): APIPromise<MarketListResponse> {
|
|
44
|
-
|
|
45
|
-
query,
|
|
46
|
-
...options,
|
|
47
|
-
}) as APIPromise<MarketListResponse>;
|
|
48
|
-
return request._thenUnwrap((data: MarketListResponse) => {
|
|
49
|
-
data.markets = data.markets.map((market) => attachBinaryOutcomeGetters(market));
|
|
50
|
-
return data;
|
|
51
|
-
});
|
|
16
|
+
return this._client.get('/api/v1/markets', { query, ...options });
|
|
52
17
|
}
|
|
53
18
|
}
|
|
54
19
|
|
|
@@ -87,18 +52,6 @@ export namespace MarketListResponse {
|
|
|
87
52
|
*/
|
|
88
53
|
outcomes: Array<Market.Outcome>;
|
|
89
54
|
|
|
90
|
-
/**
|
|
91
|
-
* Convenience getter for binary markets: outcome where `name` is "Yes"
|
|
92
|
-
* (case-insensitive).
|
|
93
|
-
*/
|
|
94
|
-
readonly yes?: Market.Outcome;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Convenience getter for binary markets: outcome where `name` is "No"
|
|
98
|
-
* (case-insensitive).
|
|
99
|
-
*/
|
|
100
|
-
readonly no?: Market.Outcome;
|
|
101
|
-
|
|
102
55
|
/**
|
|
103
56
|
* Parsec group ID for cross-exchange event grouping.
|
|
104
57
|
*/
|
|
@@ -161,6 +114,16 @@ export namespace MarketListResponse {
|
|
|
161
114
|
*/
|
|
162
115
|
event_start_time?: string;
|
|
163
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Market icon URL.
|
|
119
|
+
*/
|
|
120
|
+
icon_url?: string | null;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Market image URL.
|
|
124
|
+
*/
|
|
125
|
+
image_url?: string | null;
|
|
126
|
+
|
|
164
127
|
/**
|
|
165
128
|
* Date of last data collection.
|
|
166
129
|
*/
|
|
@@ -176,6 +139,11 @@ export namespace MarketListResponse {
|
|
|
176
139
|
*/
|
|
177
140
|
liquidity?: number;
|
|
178
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Cross-exchange same-market relations. Only included when `include_matches=true`.
|
|
144
|
+
*/
|
|
145
|
+
matched_markets?: Array<Market.MatchedMarket>;
|
|
146
|
+
|
|
179
147
|
/**
|
|
180
148
|
* Minimum order size in contracts. Varies per market on Polymarket (e.g. 5, 15);
|
|
181
149
|
* typically 1 on Kalshi.
|
|
@@ -192,6 +160,17 @@ export namespace MarketListResponse {
|
|
|
192
160
|
*/
|
|
193
161
|
outcome_count?: number;
|
|
194
162
|
|
|
163
|
+
/**
|
|
164
|
+
* When bid/ask/last_price was last refreshed (upgraded to now when live WS data
|
|
165
|
+
* overlays the snapshot).
|
|
166
|
+
*/
|
|
167
|
+
price_updated_at?: string | null;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Co-dependent market relations. Only included when `include_related=true`.
|
|
171
|
+
*/
|
|
172
|
+
related_markets?: Array<Market.RelatedMarket>;
|
|
173
|
+
|
|
195
174
|
/**
|
|
196
175
|
* Market resolution rules.
|
|
197
176
|
*/
|
|
@@ -239,6 +218,80 @@ export namespace MarketListResponse {
|
|
|
239
218
|
*/
|
|
240
219
|
token_id?: string;
|
|
241
220
|
}
|
|
221
|
+
|
|
222
|
+
export interface MatchedMarket {
|
|
223
|
+
/**
|
|
224
|
+
* Match confidence score (0.0–1.0).
|
|
225
|
+
*/
|
|
226
|
+
confidence: number;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Confidence tier: HIGH, MEDIUM, or LOW.
|
|
230
|
+
*/
|
|
231
|
+
confidence_tier: string;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Exchange of the related market.
|
|
235
|
+
*/
|
|
236
|
+
exchange: string;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Parsec ID of the related market.
|
|
240
|
+
*/
|
|
241
|
+
parsec_id: string;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Source of the match (e.g., embedding, llm).
|
|
245
|
+
*/
|
|
246
|
+
source: string;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Direction of dependency (for related markets only).
|
|
250
|
+
*/
|
|
251
|
+
dependency_direction?: string | null;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Type of dependency (for related markets only).
|
|
255
|
+
*/
|
|
256
|
+
dependency_type?: string | null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface RelatedMarket {
|
|
260
|
+
/**
|
|
261
|
+
* Match confidence score (0.0–1.0).
|
|
262
|
+
*/
|
|
263
|
+
confidence: number;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Confidence tier: HIGH, MEDIUM, or LOW.
|
|
267
|
+
*/
|
|
268
|
+
confidence_tier: string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Exchange of the related market.
|
|
272
|
+
*/
|
|
273
|
+
exchange: string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Parsec ID of the related market.
|
|
277
|
+
*/
|
|
278
|
+
parsec_id: string;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Source of the match (e.g., embedding, llm).
|
|
282
|
+
*/
|
|
283
|
+
source: string;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Direction of dependency (for related markets only).
|
|
287
|
+
*/
|
|
288
|
+
dependency_direction?: string | null;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Type of dependency (for related markets only).
|
|
292
|
+
*/
|
|
293
|
+
dependency_type?: string | null;
|
|
294
|
+
}
|
|
242
295
|
}
|
|
243
296
|
|
|
244
297
|
export interface Pagination {
|
|
@@ -287,7 +340,19 @@ export interface MarketListParams {
|
|
|
287
340
|
group_id?: string;
|
|
288
341
|
|
|
289
342
|
/**
|
|
290
|
-
*
|
|
343
|
+
* When true, each market includes a `matched_markets` array with cross-exchange
|
|
344
|
+
* same-market relations.
|
|
345
|
+
*/
|
|
346
|
+
include_matches?: boolean;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* When true, each market includes a `related_markets` array with co-dependent
|
|
350
|
+
* market relations.
|
|
351
|
+
*/
|
|
352
|
+
include_related?: boolean;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Results per page (default 100, max 100).
|
|
291
356
|
*/
|
|
292
357
|
limit?: number;
|
|
293
358
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
export class Onboard extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Unified onboarding endpoint. Managed mode creates wallet + exchange credentials
|
|
10
|
+
* (Polymarket only). Self mode stores user-provided credentials (Polymarket or
|
|
11
|
+
* Kalshi). Idempotent and resumable.
|
|
12
|
+
*/
|
|
13
|
+
create(body: OnboardCreateParams, options?: RequestOptions): APIPromise<OnboardCreateResponse> {
|
|
14
|
+
return this._client.post('/api/v1/onboard', { body, ...options });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface OnboardCreateResponse {
|
|
19
|
+
/**
|
|
20
|
+
* Exchange that was onboarded.
|
|
21
|
+
*/
|
|
22
|
+
exchange: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* All exchanges linked to this account.
|
|
26
|
+
*/
|
|
27
|
+
linked_exchanges: Array<string>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Onboard mode used ("managed" or "self").
|
|
31
|
+
*/
|
|
32
|
+
mode: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Onboard status ("complete").
|
|
36
|
+
*/
|
|
37
|
+
status: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Steps completed during this call.
|
|
41
|
+
*/
|
|
42
|
+
steps_completed: Array<string>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* EOA wallet address (managed mode only).
|
|
46
|
+
*/
|
|
47
|
+
eoa_address?: string | null;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Safe wallet address (present when wallet_type is "safe").
|
|
51
|
+
*/
|
|
52
|
+
safe_address?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface OnboardCreateParams {
|
|
56
|
+
/**
|
|
57
|
+
* Exchange to onboard ("polymarket" or "kalshi").
|
|
58
|
+
*/
|
|
59
|
+
exchange: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Managed = Parsec creates wallet + credentials. Self = you provide credentials.
|
|
63
|
+
*/
|
|
64
|
+
mode: 'managed' | 'self';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Kalshi API key ID (self mode).
|
|
68
|
+
*/
|
|
69
|
+
api_key_id?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Chain ID for Safe wallet creation. Only used with wallet_type "safe".
|
|
73
|
+
*/
|
|
74
|
+
chain_id?: number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Polymarket CLOB API key (self mode).
|
|
78
|
+
*/
|
|
79
|
+
clob_api_key?: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Polymarket CLOB API passphrase (self mode).
|
|
83
|
+
*/
|
|
84
|
+
clob_api_passphrase?: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Polymarket CLOB API secret (self mode).
|
|
88
|
+
*/
|
|
89
|
+
clob_api_secret?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* External wallet address (42-char hex, 0x-prefixed). Required when wallet_type is
|
|
93
|
+
* "safe". Parsec skips embedded EOA creation and uses this address as the Safe
|
|
94
|
+
* owner. Must not be provided when wallet_type is "eoa".
|
|
95
|
+
*/
|
|
96
|
+
eoa_address?: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Kalshi RSA private key in PEM format (self mode).
|
|
100
|
+
*/
|
|
101
|
+
private_key?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Wallet type for managed mode. "eoa" (default) creates an embedded EOA wallet.
|
|
105
|
+
* "safe" creates a Safe wallet owned by the external address in eoa_address.
|
|
106
|
+
* "safe" requires eoa_address. Providing eoa_address with "eoa" returns 400.
|
|
107
|
+
*/
|
|
108
|
+
wallet_type?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export declare namespace Onboard {
|
|
112
|
+
export {
|
|
113
|
+
type OnboardCreateResponse as OnboardCreateResponse,
|
|
114
|
+
type OnboardCreateParams as OnboardCreateParams,
|
|
115
|
+
};
|
|
116
|
+
}
|