parsec-api 0.8.0 → 0.9.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 +23 -0
- package/README.md +12 -0
- package/client.d.mts +3 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -3
- package/client.d.ts.map +1 -1
- package/client.js +3 -3
- package/client.js.map +1 -1
- package/client.mjs +3 -3
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/account.d.mts +29 -8
- package/resources/account.d.mts.map +1 -1
- package/resources/account.d.ts +29 -8
- package/resources/account.d.ts.map +1 -1
- package/resources/account.js +12 -2
- package/resources/account.js.map +1 -1
- package/resources/account.mjs +12 -2
- package/resources/account.mjs.map +1 -1
- package/resources/exchanges.d.mts +1 -0
- package/resources/exchanges.d.mts.map +1 -1
- package/resources/exchanges.d.ts +1 -0
- package/resources/exchanges.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/orderbook.d.mts +17 -1
- package/resources/orderbook.d.mts.map +1 -1
- package/resources/orderbook.d.ts +17 -1
- package/resources/orderbook.d.ts.map +1 -1
- package/resources/orderbook.js +4 -1
- package/resources/orderbook.js.map +1 -1
- package/resources/orderbook.mjs +4 -1
- package/resources/orderbook.mjs.map +1 -1
- package/resources/orders.d.mts +65 -6
- package/resources/orders.d.mts.map +1 -1
- package/resources/orders.d.ts +65 -6
- package/resources/orders.d.ts.map +1 -1
- package/resources/orders.js +48 -8
- package/resources/orders.js.map +1 -1
- package/resources/orders.mjs +48 -8
- package/resources/orders.mjs.map +1 -1
- package/resources/positions.d.mts +9 -3
- package/resources/positions.d.mts.map +1 -1
- package/resources/positions.d.ts +9 -3
- package/resources/positions.d.ts.map +1 -1
- package/resources/positions.js +13 -2
- package/resources/positions.js.map +1 -1
- package/resources/positions.mjs +13 -2
- package/resources/positions.mjs.map +1 -1
- package/resources/{price-history.d.mts → price.d.mts} +18 -13
- package/resources/price.d.mts.map +1 -0
- package/resources/{price-history.d.ts → price.d.ts} +18 -13
- package/resources/price.d.ts.map +1 -0
- package/resources/{price-history.js → price.js} +5 -5
- package/resources/price.js.map +1 -0
- package/resources/{price-history.mjs → price.mjs} +3 -3
- package/resources/price.mjs.map +1 -0
- package/resources/trades.d.mts +32 -0
- package/resources/trades.d.mts.map +1 -1
- package/resources/trades.d.ts +32 -0
- package/resources/trades.d.ts.map +1 -1
- package/src/client.ts +6 -10
- package/src/resources/account.ts +41 -9
- package/src/resources/exchanges.ts +2 -0
- package/src/resources/index.ts +1 -5
- package/src/resources/orderbook.ts +20 -1
- package/src/resources/orders.ts +121 -12
- package/src/resources/positions.ts +22 -4
- package/src/resources/{price-history.ts → price.ts} +20 -17
- package/src/resources/trades.ts +40 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/price-history.d.mts.map +0 -1
- package/resources/price-history.d.ts.map +0 -1
- package/resources/price-history.js.map +0 -1
- package/resources/price-history.mjs.map +0 -1
package/src/resources/account.ts
CHANGED
|
@@ -9,8 +9,18 @@ export class Account extends APIResource {
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns the raw balance payload from the exchange (opaque JSON).
|
|
11
11
|
*/
|
|
12
|
-
balance(
|
|
13
|
-
|
|
12
|
+
balance(params: AccountBalanceParams, options?: RequestOptions): APIPromise<AccountBalanceResponse> {
|
|
13
|
+
const { 'X-Exchange-Credentials': xExchangeCredentials, ...query } = params;
|
|
14
|
+
return this._client.get('/api/v1/balance', {
|
|
15
|
+
query,
|
|
16
|
+
...options,
|
|
17
|
+
headers: buildHeaders([
|
|
18
|
+
{
|
|
19
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
20
|
+
},
|
|
21
|
+
options?.headers,
|
|
22
|
+
]),
|
|
23
|
+
});
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
/**
|
|
@@ -100,14 +110,21 @@ export namespace AccountUserActivityResponse {
|
|
|
100
110
|
|
|
101
111
|
export interface AccountBalanceParams {
|
|
102
112
|
/**
|
|
103
|
-
* Exchange identifier (e.g., kalshi, polymarket).
|
|
113
|
+
* Query param: Exchange identifier (e.g., kalshi, polymarket).
|
|
104
114
|
*/
|
|
105
115
|
exchange: string;
|
|
106
116
|
|
|
107
117
|
/**
|
|
108
|
-
* Refresh balance before returning (default false).
|
|
118
|
+
* Query param: Refresh balance before returning (default false).
|
|
109
119
|
*/
|
|
110
120
|
refresh?: boolean;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
124
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
125
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
126
|
+
*/
|
|
127
|
+
'X-Exchange-Credentials'?: string;
|
|
111
128
|
}
|
|
112
129
|
|
|
113
130
|
export interface AccountPingParams {
|
|
@@ -118,15 +135,30 @@ export interface AccountPingParams {
|
|
|
118
135
|
}
|
|
119
136
|
|
|
120
137
|
export interface AccountUpdateCredentialsParams {
|
|
121
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Kalshi API key ID.
|
|
140
|
+
*/
|
|
141
|
+
api_key_id?: string | null;
|
|
122
142
|
|
|
123
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Polymarket CLOB API key.
|
|
145
|
+
*/
|
|
146
|
+
clob_api_key?: string | null;
|
|
124
147
|
|
|
125
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Polymarket CLOB API passphrase.
|
|
150
|
+
*/
|
|
151
|
+
clob_api_passphrase?: string | null;
|
|
126
152
|
|
|
127
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Polymarket CLOB API secret.
|
|
155
|
+
*/
|
|
156
|
+
clob_api_secret?: string | null;
|
|
128
157
|
|
|
129
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Kalshi RSA private key (PEM format).
|
|
160
|
+
*/
|
|
161
|
+
private_key?: string | null;
|
|
130
162
|
}
|
|
131
163
|
|
|
132
164
|
export interface AccountUserActivityParams {
|
package/src/resources/index.ts
CHANGED
|
@@ -42,11 +42,7 @@ export {
|
|
|
42
42
|
type OrderCancelParams,
|
|
43
43
|
} from './orders';
|
|
44
44
|
export { Positions, type PositionListResponse, type PositionListParams } from './positions';
|
|
45
|
-
export {
|
|
46
|
-
PriceHistory,
|
|
47
|
-
type PriceHistoryRetrieveResponse,
|
|
48
|
-
type PriceHistoryRetrieveParams,
|
|
49
|
-
} from './price-history';
|
|
45
|
+
export { Price, type PriceRetrieveResponse, type PriceRetrieveParams } from './price';
|
|
50
46
|
export { Trades, type TradeListResponse, type TradeListParams } from './trades';
|
|
51
47
|
export {
|
|
52
48
|
Websocket,
|
|
@@ -6,7 +6,10 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
|
|
7
7
|
export class Orderbook extends APIResource {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* When start_ts or end_ts is provided, returns historical orderbook snapshots
|
|
10
|
+
* instead of a live L2 snapshot. Large time ranges are handled via internal
|
|
11
|
+
* chunking and may be slow for very wide windows. In historical mode, limit
|
|
12
|
+
* defaults to 500 (max 1000).
|
|
10
13
|
*/
|
|
11
14
|
retrieve(query: OrderbookRetrieveParams, options?: RequestOptions): APIPromise<OrderbookRetrieveResponse> {
|
|
12
15
|
return this._client.get('/api/v1/orderbook', { query, ...options });
|
|
@@ -55,11 +58,21 @@ export interface OrderbookRetrieveParams {
|
|
|
55
58
|
*/
|
|
56
59
|
parsec_id: string;
|
|
57
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Opaque pagination cursor for historical mode.
|
|
63
|
+
*/
|
|
64
|
+
cursor?: string;
|
|
65
|
+
|
|
58
66
|
/**
|
|
59
67
|
* Alias for `limit` (REST/WS symmetry).
|
|
60
68
|
*/
|
|
61
69
|
depth?: number;
|
|
62
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Unix seconds — end of time range. Defaults to now.
|
|
73
|
+
*/
|
|
74
|
+
end_ts?: number;
|
|
75
|
+
|
|
63
76
|
/**
|
|
64
77
|
* Max depth per side (default 50; server clamps to 1..=100).
|
|
65
78
|
*/
|
|
@@ -71,6 +84,12 @@ export interface OrderbookRetrieveParams {
|
|
|
71
84
|
* outcome label or numeric index.
|
|
72
85
|
*/
|
|
73
86
|
outcome?: string;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Unix seconds — when present, switches to historical mode (returns snapshots
|
|
90
|
+
* instead of live book).
|
|
91
|
+
*/
|
|
92
|
+
start_ts?: number;
|
|
74
93
|
}
|
|
75
94
|
|
|
76
95
|
export declare namespace Orderbook {
|
package/src/resources/orders.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../internal/headers';
|
|
5
6
|
import { RequestOptions } from '../internal/request-options';
|
|
6
7
|
import { path } from '../internal/utils/path';
|
|
7
8
|
|
|
@@ -10,30 +11,69 @@ export class Orders extends APIResource {
|
|
|
10
11
|
* Creates a new order on the selected exchange.
|
|
11
12
|
*/
|
|
12
13
|
create(params: OrderCreateParams, options?: RequestOptions): APIPromise<Order> {
|
|
13
|
-
const { exchange, ...body } = params;
|
|
14
|
-
return this._client.post('/api/v1/orders', {
|
|
14
|
+
const { exchange, 'X-Exchange-Credentials': xExchangeCredentials, ...body } = params;
|
|
15
|
+
return this._client.post('/api/v1/orders', {
|
|
16
|
+
query: { exchange },
|
|
17
|
+
body,
|
|
18
|
+
...options,
|
|
19
|
+
headers: buildHeaders([
|
|
20
|
+
{
|
|
21
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
22
|
+
},
|
|
23
|
+
options?.headers,
|
|
24
|
+
]),
|
|
25
|
+
});
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
/**
|
|
18
29
|
* Fetches a single order by ID from the selected exchange.
|
|
19
30
|
*/
|
|
20
|
-
retrieve(orderID: string,
|
|
21
|
-
|
|
31
|
+
retrieve(orderID: string, params: OrderRetrieveParams, options?: RequestOptions): APIPromise<Order> {
|
|
32
|
+
const { 'X-Exchange-Credentials': xExchangeCredentials, ...query } = params;
|
|
33
|
+
return this._client.get(path`/api/v1/orders/${orderID}`, {
|
|
34
|
+
query,
|
|
35
|
+
...options,
|
|
36
|
+
headers: buildHeaders([
|
|
37
|
+
{
|
|
38
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
39
|
+
},
|
|
40
|
+
options?.headers,
|
|
41
|
+
]),
|
|
42
|
+
});
|
|
22
43
|
}
|
|
23
44
|
|
|
24
45
|
/**
|
|
25
46
|
* Lists open orders on the selected exchange.
|
|
26
47
|
*/
|
|
27
|
-
list(
|
|
28
|
-
|
|
48
|
+
list(params: OrderListParams, options?: RequestOptions): APIPromise<OrderListResponse> {
|
|
49
|
+
const { 'X-Exchange-Credentials': xExchangeCredentials, ...query } = params;
|
|
50
|
+
return this._client.get('/api/v1/orders', {
|
|
51
|
+
query,
|
|
52
|
+
...options,
|
|
53
|
+
headers: buildHeaders([
|
|
54
|
+
{
|
|
55
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
56
|
+
},
|
|
57
|
+
options?.headers,
|
|
58
|
+
]),
|
|
59
|
+
});
|
|
29
60
|
}
|
|
30
61
|
|
|
31
62
|
/**
|
|
32
63
|
* Cancels an order by ID on the selected exchange.
|
|
33
64
|
*/
|
|
34
65
|
cancel(orderID: string, params: OrderCancelParams, options?: RequestOptions): APIPromise<Order> {
|
|
35
|
-
const { exchange } = params;
|
|
36
|
-
return this._client.delete(path`/api/v1/orders/${orderID}`, {
|
|
66
|
+
const { exchange, 'X-Exchange-Credentials': xExchangeCredentials } = params;
|
|
67
|
+
return this._client.delete(path`/api/v1/orders/${orderID}`, {
|
|
68
|
+
query: { exchange },
|
|
69
|
+
...options,
|
|
70
|
+
headers: buildHeaders([
|
|
71
|
+
{
|
|
72
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
73
|
+
},
|
|
74
|
+
options?.headers,
|
|
75
|
+
]),
|
|
76
|
+
});
|
|
37
77
|
}
|
|
38
78
|
}
|
|
39
79
|
|
|
@@ -92,6 +132,13 @@ export interface OrderCreateParams {
|
|
|
92
132
|
*/
|
|
93
133
|
size: number;
|
|
94
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Body param: Per-request exchange credentials (Mode B). When provided, Parsec
|
|
137
|
+
* creates a transient exchange session instead of using stored credentials.
|
|
138
|
+
* Credentials are never persisted.
|
|
139
|
+
*/
|
|
140
|
+
credentials?: OrderCreateParams.Credentials;
|
|
141
|
+
|
|
95
142
|
/**
|
|
96
143
|
* Body param: Optional key-value parameters. Supported keys:
|
|
97
144
|
*
|
|
@@ -99,32 +146,94 @@ export interface OrderCreateParams {
|
|
|
99
146
|
* Unsupported types return 501 per exchange.
|
|
100
147
|
*/
|
|
101
148
|
params?: { [key: string]: string };
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
152
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
153
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
154
|
+
*/
|
|
155
|
+
'X-Exchange-Credentials'?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export namespace OrderCreateParams {
|
|
159
|
+
/**
|
|
160
|
+
* Per-request exchange credentials (Mode B). When provided, Parsec creates a
|
|
161
|
+
* transient exchange session instead of using stored credentials. Credentials are
|
|
162
|
+
* never persisted.
|
|
163
|
+
*/
|
|
164
|
+
export interface Credentials {
|
|
165
|
+
/**
|
|
166
|
+
* Kalshi API key ID.
|
|
167
|
+
*/
|
|
168
|
+
api_key_id?: string;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Polymarket CLOB API key.
|
|
172
|
+
*/
|
|
173
|
+
clob_api_key?: string;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Polymarket CLOB API passphrase.
|
|
177
|
+
*/
|
|
178
|
+
clob_api_passphrase?: string;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Polymarket CLOB API secret.
|
|
182
|
+
*/
|
|
183
|
+
clob_api_secret?: string;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Kalshi RSA private key (PEM format).
|
|
187
|
+
*/
|
|
188
|
+
private_key?: string;
|
|
189
|
+
}
|
|
102
190
|
}
|
|
103
191
|
|
|
104
192
|
export interface OrderRetrieveParams {
|
|
105
193
|
/**
|
|
106
|
-
* Exchange identifier (e.g., kalshi, polymarket).
|
|
194
|
+
* Query param: Exchange identifier (e.g., kalshi, polymarket).
|
|
107
195
|
*/
|
|
108
196
|
exchange: string;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
200
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
201
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
202
|
+
*/
|
|
203
|
+
'X-Exchange-Credentials'?: string;
|
|
109
204
|
}
|
|
110
205
|
|
|
111
206
|
export interface OrderListParams {
|
|
112
207
|
/**
|
|
113
|
-
* Exchange identifier (e.g., kalshi, polymarket).
|
|
208
|
+
* Query param: Exchange identifier (e.g., kalshi, polymarket).
|
|
114
209
|
*/
|
|
115
210
|
exchange: string;
|
|
116
211
|
|
|
117
212
|
/**
|
|
118
|
-
* Optional market ID filter (exchange-native).
|
|
213
|
+
* Query param: Optional market ID filter (exchange-native).
|
|
119
214
|
*/
|
|
120
215
|
market_id?: string;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
219
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
220
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
221
|
+
*/
|
|
222
|
+
'X-Exchange-Credentials'?: string;
|
|
121
223
|
}
|
|
122
224
|
|
|
123
225
|
export interface OrderCancelParams {
|
|
124
226
|
/**
|
|
125
|
-
* Exchange identifier (e.g., kalshi, polymarket).
|
|
227
|
+
* Query param: Exchange identifier (e.g., kalshi, polymarket).
|
|
126
228
|
*/
|
|
127
229
|
exchange: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
233
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
234
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
235
|
+
*/
|
|
236
|
+
'X-Exchange-Credentials'?: string;
|
|
128
237
|
}
|
|
129
238
|
|
|
130
239
|
export declare namespace Orders {
|
|
@@ -2,14 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../internal/headers';
|
|
5
6
|
import { RequestOptions } from '../internal/request-options';
|
|
6
7
|
|
|
7
8
|
export class Positions extends APIResource {
|
|
8
9
|
/**
|
|
9
10
|
* Lists positions for the authenticated customer on the selected exchange.
|
|
10
11
|
*/
|
|
11
|
-
list(
|
|
12
|
-
|
|
12
|
+
list(params: PositionListParams, options?: RequestOptions): APIPromise<PositionListResponse> {
|
|
13
|
+
const { 'X-Exchange-Credentials': xExchangeCredentials, ...query } = params;
|
|
14
|
+
return this._client.get('/api/v1/positions', {
|
|
15
|
+
query,
|
|
16
|
+
...options,
|
|
17
|
+
headers: buildHeaders([
|
|
18
|
+
{
|
|
19
|
+
...(xExchangeCredentials != null ? { 'X-Exchange-Credentials': xExchangeCredentials } : undefined),
|
|
20
|
+
},
|
|
21
|
+
options?.headers,
|
|
22
|
+
]),
|
|
23
|
+
});
|
|
13
24
|
}
|
|
14
25
|
}
|
|
15
26
|
|
|
@@ -31,14 +42,21 @@ export namespace PositionListResponse {
|
|
|
31
42
|
|
|
32
43
|
export interface PositionListParams {
|
|
33
44
|
/**
|
|
34
|
-
* Exchange identifier (e.g., kalshi, polymarket).
|
|
45
|
+
* Query param: Exchange identifier (e.g., kalshi, polymarket).
|
|
35
46
|
*/
|
|
36
47
|
exchange: string;
|
|
37
48
|
|
|
38
49
|
/**
|
|
39
|
-
* Optional market ID filter (exchange-native).
|
|
50
|
+
* Query param: Optional market ID filter (exchange-native).
|
|
40
51
|
*/
|
|
41
52
|
market_id?: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Header param: Base64-encoded JSON of per-request exchange credentials (Mode B).
|
|
56
|
+
* When provided, Parsec creates a transient exchange session instead of using
|
|
57
|
+
* stored credentials. The JSON shape matches the RequestCredentials schema.
|
|
58
|
+
*/
|
|
59
|
+
'X-Exchange-Credentials'?: string;
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
export declare namespace Positions {
|
|
@@ -4,20 +4,17 @@ import { APIResource } from '../core/resource';
|
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
6
|
|
|
7
|
-
export class
|
|
7
|
+
export class Price extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* Returns an array of candlesticks with timestamps at period start (UTC).
|
|
10
10
|
*/
|
|
11
|
-
retrieve(
|
|
12
|
-
query
|
|
13
|
-
options?: RequestOptions,
|
|
14
|
-
): APIPromise<PriceHistoryRetrieveResponse> {
|
|
15
|
-
return this._client.get('/api/v1/price-history', { query, ...options });
|
|
11
|
+
retrieve(query: PriceRetrieveParams, options?: RequestOptions): APIPromise<PriceRetrieveResponse> {
|
|
12
|
+
return this._client.get('/api/v1/price', { query, ...options });
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
export interface
|
|
20
|
-
candles: Array<
|
|
16
|
+
export interface PriceRetrieveResponse {
|
|
17
|
+
candles: Array<PriceRetrieveResponse.Candle>;
|
|
21
18
|
|
|
22
19
|
exchange: string;
|
|
23
20
|
|
|
@@ -28,7 +25,7 @@ export interface PriceHistoryRetrieveResponse {
|
|
|
28
25
|
parsec_id: string;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
export namespace
|
|
28
|
+
export namespace PriceRetrieveResponse {
|
|
32
29
|
export interface Candle {
|
|
33
30
|
/**
|
|
34
31
|
* Close price (normalized 0.0-1.0).
|
|
@@ -67,22 +64,28 @@ export namespace PriceHistoryRetrieveResponse {
|
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
export interface
|
|
67
|
+
export interface PriceRetrieveParams {
|
|
71
68
|
/**
|
|
72
|
-
*
|
|
69
|
+
* Unified market ID in format `{exchange}:{native_id}`.
|
|
73
70
|
*/
|
|
74
|
-
|
|
71
|
+
parsec_id: string;
|
|
75
72
|
|
|
76
73
|
/**
|
|
77
|
-
*
|
|
74
|
+
* Point-in-time lookup (Unix seconds). Returns the single closest candle. Cannot
|
|
75
|
+
* be combined with start_ts/end_ts.
|
|
78
76
|
*/
|
|
79
|
-
|
|
77
|
+
at_ts?: number;
|
|
80
78
|
|
|
81
79
|
/**
|
|
82
80
|
* Unix seconds end timestamp (inclusive). Defaults to now.
|
|
83
81
|
*/
|
|
84
82
|
end_ts?: number;
|
|
85
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Defaults to 1h for point-in-time (at_ts)
|
|
86
|
+
*/
|
|
87
|
+
interval?: '1m' | '1h' | '6h' | '1d' | '1w' | 'max';
|
|
88
|
+
|
|
86
89
|
/**
|
|
87
90
|
* Outcome selector. For binary markets this is typically "yes" or "no"
|
|
88
91
|
* (case-insensitive). For categorical markets, this is required and may be an
|
|
@@ -97,9 +100,9 @@ export interface PriceHistoryRetrieveParams {
|
|
|
97
100
|
start_ts?: number;
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
export declare namespace
|
|
103
|
+
export declare namespace Price {
|
|
101
104
|
export {
|
|
102
|
-
type
|
|
103
|
-
type
|
|
105
|
+
type PriceRetrieveResponse as PriceRetrieveResponse,
|
|
106
|
+
type PriceRetrieveParams as PriceRetrieveParams,
|
|
104
107
|
};
|
|
105
108
|
}
|
package/src/resources/trades.ts
CHANGED
|
@@ -26,6 +26,13 @@ export interface TradeListResponse {
|
|
|
26
26
|
token_id: string;
|
|
27
27
|
|
|
28
28
|
trades: Array<TradeListResponse.Trade>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* True if there are more results available
|
|
32
|
+
*/
|
|
33
|
+
has_more?: boolean;
|
|
34
|
+
|
|
35
|
+
next_cursor?: string | null;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
export namespace TradeListResponse {
|
|
@@ -51,10 +58,38 @@ export namespace TradeListResponse {
|
|
|
51
58
|
*/
|
|
52
59
|
aggressor_side?: string;
|
|
53
60
|
|
|
61
|
+
/**
|
|
62
|
+
* NO-side price from exchange data (never derived). May be null if the trade was
|
|
63
|
+
* on the YES side.
|
|
64
|
+
*/
|
|
65
|
+
no_price?: number | null;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Trade outcome side (e.g. "Yes", "No", "yes", "no").
|
|
69
|
+
*/
|
|
70
|
+
outcome?: string | null;
|
|
71
|
+
|
|
54
72
|
/**
|
|
55
73
|
* Trade side (typically "buy" or "sell").
|
|
56
74
|
*/
|
|
57
75
|
side?: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Taker wallet address (Polymarket proxy_wallet). Null for exchanges that don't
|
|
79
|
+
* expose this.
|
|
80
|
+
*/
|
|
81
|
+
taker_address?: string | null;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Transaction hash (Polymarket only).
|
|
85
|
+
*/
|
|
86
|
+
tx_hash?: string | null;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* YES-side price from exchange data (never derived). May be null if the trade was
|
|
90
|
+
* on the NO side.
|
|
91
|
+
*/
|
|
92
|
+
yes_price?: number | null;
|
|
58
93
|
}
|
|
59
94
|
}
|
|
60
95
|
|
|
@@ -64,6 +99,11 @@ export interface TradeListParams {
|
|
|
64
99
|
*/
|
|
65
100
|
parsec_id: string;
|
|
66
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Opaque pagination cursor from a previous response.
|
|
104
|
+
*/
|
|
105
|
+
cursor?: string;
|
|
106
|
+
|
|
67
107
|
/**
|
|
68
108
|
* Unix seconds end timestamp (inclusive).
|
|
69
109
|
*/
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.9.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.9.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.9.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.9.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"price-history.d.mts","sourceRoot":"","sources":["../src/resources/price-history.ts"],"names":[],"mappings":"OAEO,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AE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"price-history.js","sourceRoot":"","sources":["../src/resources/price-history.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;OAEG;IACH,QAAQ,CACN,KAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAVD,oCAUC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"price-history.mjs","sourceRoot":"","sources":["../src/resources/price-history.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;OAEG;IACH,QAAQ,CACN,KAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF"}
|