@clear-street/clearstreet 0.99.0 → 0.101.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/package.json +1 -1
- package/resources/v1/index.d.mts +3 -3
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +3 -3
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/instrument-data/market-data.d.mts +90 -20
- package/resources/v1/instrument-data/market-data.d.mts.map +1 -1
- package/resources/v1/instrument-data/market-data.d.ts +90 -20
- package/resources/v1/instrument-data/market-data.d.ts.map +1 -1
- package/resources/v1/instrument-data/market-data.js +5 -7
- package/resources/v1/instrument-data/market-data.js.map +1 -1
- package/resources/v1/instrument-data/market-data.mjs +5 -7
- package/resources/v1/instrument-data/market-data.mjs.map +1 -1
- package/resources/v1/instruments.d.mts +45 -3
- package/resources/v1/instruments.d.mts.map +1 -1
- package/resources/v1/instruments.d.ts +45 -3
- package/resources/v1/instruments.d.ts.map +1 -1
- package/resources/v1/omni-ai/index.d.mts +1 -1
- package/resources/v1/omni-ai/index.d.mts.map +1 -1
- package/resources/v1/omni-ai/index.d.ts +1 -1
- package/resources/v1/omni-ai/index.d.ts.map +1 -1
- package/resources/v1/omni-ai/index.js.map +1 -1
- package/resources/v1/omni-ai/index.mjs.map +1 -1
- package/resources/v1/omni-ai/messages.d.mts +17 -17
- package/resources/v1/omni-ai/messages.d.mts.map +1 -1
- package/resources/v1/omni-ai/messages.d.ts +17 -17
- package/resources/v1/omni-ai/messages.d.ts.map +1 -1
- package/resources/v1/omni-ai/messages.js +9 -11
- package/resources/v1/omni-ai/messages.js.map +1 -1
- package/resources/v1/omni-ai/messages.mjs +9 -11
- package/resources/v1/omni-ai/messages.mjs.map +1 -1
- package/resources/v1/omni-ai/omni-ai.d.mts +9 -3
- package/resources/v1/omni-ai/omni-ai.d.mts.map +1 -1
- package/resources/v1/omni-ai/omni-ai.d.ts +9 -3
- package/resources/v1/omni-ai/omni-ai.d.ts.map +1 -1
- package/resources/v1/omni-ai/omni-ai.js.map +1 -1
- package/resources/v1/omni-ai/omni-ai.mjs.map +1 -1
- package/resources/v1/omni-ai/responses.d.mts +21 -21
- package/resources/v1/omni-ai/responses.d.mts.map +1 -1
- package/resources/v1/omni-ai/responses.d.ts +21 -21
- package/resources/v1/omni-ai/responses.d.ts.map +1 -1
- package/resources/v1/omni-ai/responses.js +14 -18
- package/resources/v1/omni-ai/responses.js.map +1 -1
- package/resources/v1/omni-ai/responses.mjs +14 -18
- package/resources/v1/omni-ai/responses.mjs.map +1 -1
- package/resources/v1/omni-ai/threads.d.mts +124 -64
- package/resources/v1/omni-ai/threads.d.mts.map +1 -1
- package/resources/v1/omni-ai/threads.d.ts +124 -64
- package/resources/v1/omni-ai/threads.d.ts.map +1 -1
- package/resources/v1/omni-ai/threads.js +41 -51
- package/resources/v1/omni-ai/threads.js.map +1 -1
- package/resources/v1/omni-ai/threads.mjs +41 -51
- package/resources/v1/omni-ai/threads.mjs.map +1 -1
- package/resources/v1/orders.d.mts +107 -8
- package/resources/v1/orders.d.mts.map +1 -1
- package/resources/v1/orders.d.ts +107 -8
- package/resources/v1/orders.d.ts.map +1 -1
- package/resources/v1/positions.d.mts +52 -1
- package/resources/v1/positions.d.mts.map +1 -1
- package/resources/v1/positions.d.ts +52 -1
- package/resources/v1/positions.d.ts.map +1 -1
- package/resources/v1/screener.d.mts +3 -3
- package/resources/v1/screener.d.ts +3 -3
- package/resources/v1/screener.js +2 -2
- package/resources/v1/screener.mjs +2 -2
- package/resources/v1/v1.d.mts +7 -7
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +7 -7
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs.map +1 -1
- package/resources/v1/watchlist.d.mts +3 -3
- package/resources/v1/watchlist.d.ts +3 -3
- package/src/resources/v1/index.ts +3 -0
- package/src/resources/v1/instrument-data/market-data.ts +98 -20
- package/src/resources/v1/instruments.ts +51 -2
- package/src/resources/v1/omni-ai/index.ts +2 -0
- package/src/resources/v1/omni-ai/messages.ts +17 -17
- package/src/resources/v1/omni-ai/omni-ai.ts +12 -1
- package/src/resources/v1/omni-ai/responses.ts +22 -22
- package/src/resources/v1/omni-ai/threads.ts +136 -65
- package/src/resources/v1/orders.ts +123 -7
- package/src/resources/v1/positions.ts +55 -0
- package/src/resources/v1/screener.ts +3 -3
- package/src/resources/v1/v1.ts +7 -1
- package/src/resources/v1/watchlist.ts +3 -3
- 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
|
@@ -13,22 +13,23 @@ import { path } from '../../../internal/utils/path';
|
|
|
13
13
|
*/
|
|
14
14
|
export class Threads extends APIResource {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Appends a new user message to the thread and starts an assistant response. Only
|
|
19
|
-
* one response may be active per thread at a time — if the previous turn is still
|
|
20
|
-
* in progress, this endpoint returns **409 Conflict**. Wait for the active
|
|
21
|
-
* response to reach a terminal status before submitting the next turn.
|
|
22
|
-
*
|
|
16
|
+
* Append a user message to an existing thread and start an assistant response.
|
|
23
17
|
* Poll the returned `response_id` via `GET /omni-ai/responses/{response_id}` for
|
|
24
18
|
* assistant output.
|
|
25
19
|
*
|
|
20
|
+
* Only one response may be active per thread. Wait for it to reach a terminal
|
|
21
|
+
* status before submitting another turn; otherwise this endpoint returns 409.
|
|
22
|
+
*
|
|
23
|
+
* The first accepted selected-account message links an unlinked thread. A linked
|
|
24
|
+
* thread keeps its account regardless of omission or another selection. A changed
|
|
25
|
+
* scope also returns 409 without accepting a turn.
|
|
26
|
+
*
|
|
26
27
|
* @example
|
|
27
28
|
* ```ts
|
|
28
29
|
* const response =
|
|
29
30
|
* await client.v1.omniAI.threads.createMessage(
|
|
30
31
|
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
31
|
-
* {
|
|
32
|
+
* { text: 'Compare that to AMD.' },
|
|
32
33
|
* );
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
@@ -41,23 +42,21 @@ export class Threads extends APIResource {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* Atomically create a conversation and submit its first user turn. Use `instant`
|
|
46
|
+
* with `text` for a prompt, or `deep_insights` with a ticker `target` and optional
|
|
47
|
+
* `thesis` for long-form research.
|
|
45
48
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* `GET /omni-ai/responses/{response_id}` for assistant output.
|
|
49
|
-
*
|
|
50
|
-
* Two creation modes are supported:
|
|
49
|
+
* Poll the returned `response_id` via `GET /omni-ai/responses/{response_id}` for
|
|
50
|
+
* assistant output.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* Omit `account_id` to start without an account. The first accepted turn with a
|
|
53
|
+
* selected account links that account permanently. Reuse `Idempotency-Key` only
|
|
54
|
+
* for an identical request.
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts
|
|
58
58
|
* const response =
|
|
59
59
|
* await client.v1.omniAI.threads.createThread({
|
|
60
|
-
* account_id: 19816,
|
|
61
60
|
* type: 'instant',
|
|
62
61
|
* });
|
|
63
62
|
* ```
|
|
@@ -70,102 +69,122 @@ export class Threads extends APIResource {
|
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|
|
73
|
-
* List finalized messages
|
|
72
|
+
* List finalized messages, including messages created before the account link.
|
|
73
|
+
* Return the latest page by default, in chronological order within each page. Use
|
|
74
|
+
* the returned page token to navigate history.
|
|
74
75
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* `GET /omni-ai/responses/{response_id}` for live output.
|
|
79
|
-
*
|
|
80
|
-
* If the last finalized message has role `USER`, an active response likely exists
|
|
81
|
-
* and should be polled separately.
|
|
76
|
+
* In-progress assistant output is not included. Poll
|
|
77
|
+
* `GET /omni-ai/responses/{response_id}` until the response reaches a terminal
|
|
78
|
+
* status, then read its finalized message here.
|
|
82
79
|
*
|
|
83
80
|
* @example
|
|
84
81
|
* ```ts
|
|
85
82
|
* const response = await client.v1.omniAI.threads.getMessages(
|
|
86
83
|
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
87
|
-
* { account_id: 0 },
|
|
88
84
|
* );
|
|
89
85
|
* ```
|
|
90
86
|
*/
|
|
91
87
|
getMessages(
|
|
92
88
|
threadID: string,
|
|
93
|
-
query: ThreadGetMessagesParams,
|
|
89
|
+
query: ThreadGetMessagesParams | null | undefined = {},
|
|
94
90
|
options?: RequestOptions,
|
|
95
91
|
): APIPromise<ThreadGetMessagesResponse> {
|
|
96
92
|
return this._client.get(path`/v1/omni-ai/threads/${threadID}/messages`, { query, ...options });
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
/**
|
|
100
|
-
*
|
|
96
|
+
* Read an owned thread's metadata. Use `GET /omni-ai/threads/{thread_id}/messages`
|
|
97
|
+
* for conversation history.
|
|
101
98
|
*
|
|
102
|
-
*
|
|
103
|
-
* messages — use `GET /omni-ai/threads/{thread_id}/messages` for conversation
|
|
104
|
-
* history.
|
|
99
|
+
* Omission or another account selection does not change authorization.
|
|
105
100
|
*
|
|
106
101
|
* @example
|
|
107
102
|
* ```ts
|
|
108
103
|
* const response =
|
|
109
104
|
* await client.v1.omniAI.threads.getThreadByID(
|
|
110
105
|
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
111
|
-
* { account_id: 0 },
|
|
112
106
|
* );
|
|
113
107
|
* ```
|
|
114
108
|
*/
|
|
115
109
|
getThreadByID(
|
|
116
110
|
threadID: string,
|
|
117
|
-
query: ThreadGetThreadByIDParams,
|
|
111
|
+
query: ThreadGetThreadByIDParams | null | undefined = {},
|
|
118
112
|
options?: RequestOptions,
|
|
119
113
|
): APIPromise<ThreadGetThreadByIDResponse> {
|
|
120
114
|
return this._client.get(path`/v1/omni-ai/threads/${threadID}`, { query, ...options });
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* without knowing the `response_id`. Useful when reloading a thread whose last
|
|
128
|
-
* finalized message is a `USER` message — this indicates an assistant turn is
|
|
129
|
-
* likely in progress.
|
|
118
|
+
* Look up the currently active response without knowing its `response_id`. Use
|
|
119
|
+
* this endpoint when reopening a thread whose assistant turn may still be in
|
|
120
|
+
* progress.
|
|
130
121
|
*
|
|
131
|
-
*
|
|
122
|
+
* An idle owned thread returns HTTP 200 with `data: null`.
|
|
132
123
|
*
|
|
133
124
|
* @example
|
|
134
125
|
* ```ts
|
|
135
126
|
* const response =
|
|
136
127
|
* await client.v1.omniAI.threads.getThreadResponse(
|
|
137
128
|
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
138
|
-
* { account_id: 0 },
|
|
139
129
|
* );
|
|
140
130
|
* ```
|
|
141
131
|
*/
|
|
142
132
|
getThreadResponse(
|
|
143
133
|
threadID: string,
|
|
144
|
-
query: ThreadGetThreadResponseParams,
|
|
134
|
+
query: ThreadGetThreadResponseParams | null | undefined = {},
|
|
145
135
|
options?: RequestOptions,
|
|
146
136
|
): APIPromise<ThreadGetThreadResponseResponse> {
|
|
147
137
|
return this._client.get(path`/v1/omni-ai/threads/${threadID}/response`, { query, ...options });
|
|
148
138
|
}
|
|
149
139
|
|
|
150
140
|
/**
|
|
151
|
-
* List conversation
|
|
141
|
+
* List authorized conversation metadata, newest first. Use `page_size` and
|
|
142
|
+
* `page_token` for pagination, and the messages endpoint for conversation history.
|
|
152
143
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
144
|
+
* With `account_id`, list only conversations linked to that account and require
|
|
145
|
+
* current account access. Without it, list only conversations with no linked
|
|
146
|
+
* account.
|
|
156
147
|
*
|
|
157
148
|
* @example
|
|
158
149
|
* ```ts
|
|
159
|
-
* const response =
|
|
160
|
-
*
|
|
161
|
-
* });
|
|
150
|
+
* const response =
|
|
151
|
+
* await client.v1.omniAI.threads.getThreads();
|
|
162
152
|
* ```
|
|
163
153
|
*/
|
|
164
|
-
getThreads(
|
|
154
|
+
getThreads(
|
|
155
|
+
query: ThreadGetThreadsParams | null | undefined = {},
|
|
156
|
+
options?: RequestOptions,
|
|
157
|
+
): APIPromise<ThreadGetThreadsResponse> {
|
|
165
158
|
return this._client.get('/v1/omni-ai/threads', { query, ...options });
|
|
166
159
|
}
|
|
167
160
|
}
|
|
168
161
|
|
|
162
|
+
/**
|
|
163
|
+
* A snapshot of the widget the user asks about.
|
|
164
|
+
*/
|
|
165
|
+
export interface ContextItem {
|
|
166
|
+
/**
|
|
167
|
+
* Relevant widget data, selections, and units. Use strings for exact decimals and
|
|
168
|
+
* large IDs.
|
|
169
|
+
*/
|
|
170
|
+
data: { [key: string]: unknown };
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Nonblank descriptive kind. New kinds do not require a backend release.
|
|
174
|
+
*/
|
|
175
|
+
kind: string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Nonblank attachment label for conversation rendering.
|
|
179
|
+
*/
|
|
180
|
+
label: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Client-reported snapshot time. Omit when unknown.
|
|
184
|
+
*/
|
|
185
|
+
captured_at?: string | null;
|
|
186
|
+
}
|
|
187
|
+
|
|
169
188
|
/**
|
|
170
189
|
* Response payload for continuing a thread with a new message.
|
|
171
190
|
*/
|
|
@@ -215,6 +234,13 @@ export interface Message {
|
|
|
215
234
|
|
|
216
235
|
thread_id: string;
|
|
217
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Immutable snapshots attached to this user message. Omitted when none were
|
|
239
|
+
* supplied. When a null/undefined value is observed, it indicates that there is no
|
|
240
|
+
* available data.
|
|
241
|
+
*/
|
|
242
|
+
context?: TurnContext | null;
|
|
243
|
+
|
|
218
244
|
/**
|
|
219
245
|
* When a null/undefined value is observed, it indicates it does not apply.
|
|
220
246
|
*/
|
|
@@ -288,7 +314,7 @@ export type MessageOutcome = 'completed' | 'errored' | 'canceled';
|
|
|
288
314
|
export type MessageRole = 'USER' | 'ASSISTANT';
|
|
289
315
|
|
|
290
316
|
/**
|
|
291
|
-
* Thread metadata
|
|
317
|
+
* Thread metadata.
|
|
292
318
|
*/
|
|
293
319
|
export interface Thread {
|
|
294
320
|
id: string;
|
|
@@ -302,6 +328,20 @@ export interface Thread {
|
|
|
302
328
|
|
|
303
329
|
export type ThreadList = Array<Thread>;
|
|
304
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Client snapshots attached to one instant-chat user message.
|
|
333
|
+
*
|
|
334
|
+
* Context is separate from visible message text and does not grant account access.
|
|
335
|
+
* The compact JSON representation must not exceed 64 KiB.
|
|
336
|
+
*/
|
|
337
|
+
export interface TurnContext {
|
|
338
|
+
/**
|
|
339
|
+
* One to four snapshots. Each snapshot's data may contain at most 32 levels of
|
|
340
|
+
* nesting.
|
|
341
|
+
*/
|
|
342
|
+
items: Array<ContextItem>;
|
|
343
|
+
}
|
|
344
|
+
|
|
305
345
|
export interface ThreadCreateMessageResponse extends Shared.BaseResponse {
|
|
306
346
|
/**
|
|
307
347
|
* Response payload for continuing a thread with a new message.
|
|
@@ -322,7 +362,7 @@ export interface ThreadGetMessagesResponse extends Shared.BaseResponse {
|
|
|
322
362
|
|
|
323
363
|
export interface ThreadGetThreadByIDResponse extends Shared.BaseResponse {
|
|
324
364
|
/**
|
|
325
|
-
* Thread metadata
|
|
365
|
+
* Thread metadata.
|
|
326
366
|
*/
|
|
327
367
|
data: Thread;
|
|
328
368
|
}
|
|
@@ -339,23 +379,44 @@ export interface ThreadGetThreadsResponse extends Shared.BaseResponse {
|
|
|
339
379
|
}
|
|
340
380
|
|
|
341
381
|
export interface ThreadCreateMessageParams {
|
|
342
|
-
account_id: number;
|
|
343
|
-
|
|
344
382
|
text: string;
|
|
345
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Selected account for creation or the first account-linked turn. Omit for an
|
|
386
|
+
* unlinked conversation. An existing account link remains authoritative even when
|
|
387
|
+
* another account is selected.
|
|
388
|
+
*/
|
|
389
|
+
account_id?: number | null;
|
|
390
|
+
|
|
346
391
|
capabilities?: Array<'PREFILL_ORDER' | 'OPEN_CHART' | 'OPEN_SCREENER' | 'OPEN_ENTITLEMENT_CONSENT'>;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Snapshots for this instant-chat message. Omission does not remove earlier
|
|
395
|
+
* attachments.
|
|
396
|
+
*/
|
|
397
|
+
context?: TurnContext | null;
|
|
347
398
|
}
|
|
348
399
|
|
|
349
400
|
export interface ThreadCreateThreadParams {
|
|
350
|
-
account_id: number;
|
|
351
|
-
|
|
352
401
|
/**
|
|
353
402
|
* Thread creation mode.
|
|
354
403
|
*/
|
|
355
404
|
type: 'instant' | 'deep_insights';
|
|
356
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Selected account for creation or the first account-linked turn. Omit for an
|
|
408
|
+
* unlinked conversation. An existing account link remains authoritative even when
|
|
409
|
+
* another account is selected.
|
|
410
|
+
*/
|
|
411
|
+
account_id?: number | null;
|
|
412
|
+
|
|
357
413
|
capabilities?: Array<'PREFILL_ORDER' | 'OPEN_CHART' | 'OPEN_SCREENER' | 'OPEN_ENTITLEMENT_CONSENT'>;
|
|
358
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Snapshots for the first instant-chat message. Omit to attach no new context.
|
|
417
|
+
*/
|
|
418
|
+
context?: TurnContext | null;
|
|
419
|
+
|
|
359
420
|
/**
|
|
360
421
|
* Deep-insights target payload.
|
|
361
422
|
*/
|
|
@@ -382,9 +443,11 @@ export namespace ThreadCreateThreadParams {
|
|
|
382
443
|
|
|
383
444
|
export interface ThreadGetMessagesParams {
|
|
384
445
|
/**
|
|
385
|
-
*
|
|
446
|
+
* Lists only conversations for this account, or unlinked conversations when
|
|
447
|
+
* omitted. Other reads authorize the resource's linked account. Omit when no
|
|
448
|
+
* account is selected; empty values and the string null are invalid.
|
|
386
449
|
*/
|
|
387
|
-
account_id
|
|
450
|
+
account_id?: number;
|
|
388
451
|
|
|
389
452
|
/**
|
|
390
453
|
* The number of items to return per page. Only used when page_token is not
|
|
@@ -401,23 +464,29 @@ export interface ThreadGetMessagesParams {
|
|
|
401
464
|
|
|
402
465
|
export interface ThreadGetThreadByIDParams {
|
|
403
466
|
/**
|
|
404
|
-
*
|
|
467
|
+
* Lists only conversations for this account, or unlinked conversations when
|
|
468
|
+
* omitted. Other reads authorize the resource's linked account. Omit when no
|
|
469
|
+
* account is selected; empty values and the string null are invalid.
|
|
405
470
|
*/
|
|
406
|
-
account_id
|
|
471
|
+
account_id?: number;
|
|
407
472
|
}
|
|
408
473
|
|
|
409
474
|
export interface ThreadGetThreadResponseParams {
|
|
410
475
|
/**
|
|
411
|
-
*
|
|
476
|
+
* Lists only conversations for this account, or unlinked conversations when
|
|
477
|
+
* omitted. Other reads authorize the resource's linked account. Omit when no
|
|
478
|
+
* account is selected; empty values and the string null are invalid.
|
|
412
479
|
*/
|
|
413
|
-
account_id
|
|
480
|
+
account_id?: number;
|
|
414
481
|
}
|
|
415
482
|
|
|
416
483
|
export interface ThreadGetThreadsParams {
|
|
417
484
|
/**
|
|
418
|
-
*
|
|
485
|
+
* Lists only conversations for this account, or unlinked conversations when
|
|
486
|
+
* omitted. Other reads authorize the resource's linked account. Omit when no
|
|
487
|
+
* account is selected; empty values and the string null are invalid.
|
|
419
488
|
*/
|
|
420
|
-
account_id
|
|
489
|
+
account_id?: number;
|
|
421
490
|
|
|
422
491
|
/**
|
|
423
492
|
* The number of items to return per page. Only used when page_token is not
|
|
@@ -434,6 +503,7 @@ export interface ThreadGetThreadsParams {
|
|
|
434
503
|
|
|
435
504
|
export declare namespace Threads {
|
|
436
505
|
export {
|
|
506
|
+
type ContextItem as ContextItem,
|
|
437
507
|
type CreateMessageResponse as CreateMessageResponse,
|
|
438
508
|
type CreateThreadResponse as CreateThreadResponse,
|
|
439
509
|
type Message as Message,
|
|
@@ -444,6 +514,7 @@ export declare namespace Threads {
|
|
|
444
514
|
type MessageRole as MessageRole,
|
|
445
515
|
type Thread as Thread,
|
|
446
516
|
type ThreadList as ThreadList,
|
|
517
|
+
type TurnContext as TurnContext,
|
|
447
518
|
type ThreadCreateMessageResponse as ThreadCreateMessageResponse,
|
|
448
519
|
type ThreadCreateThreadResponse as ThreadCreateThreadResponse,
|
|
449
520
|
type ThreadGetMessagesResponse as ThreadGetMessagesResponse,
|
|
@@ -213,6 +213,12 @@ export interface Execution {
|
|
|
213
213
|
*/
|
|
214
214
|
underlying_instrument_id?: string | null;
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Type of the underlying instrument, alongside `underlying_instrument_id`. When a
|
|
218
|
+
* null/undefined value is observed, it indicates it does not apply.
|
|
219
|
+
*/
|
|
220
|
+
underlying_instrument_type?: V1API.SecurityType | null;
|
|
221
|
+
|
|
216
222
|
/**
|
|
217
223
|
* Venue where this fill occurred, as reported by that venue. Distinct from an
|
|
218
224
|
* order's `venue`, which is the routing destination. Codes are not normalized, so
|
|
@@ -231,7 +237,7 @@ export type ExecutionList = Array<Execution>;
|
|
|
231
237
|
export type InstrumentIDOrSymbol = string;
|
|
232
238
|
|
|
233
239
|
/**
|
|
234
|
-
* Request to submit a new order
|
|
240
|
+
* Request to submit a new order
|
|
235
241
|
*/
|
|
236
242
|
export interface NewOrderRequest {
|
|
237
243
|
/**
|
|
@@ -300,6 +306,13 @@ export interface NewOrderRequest {
|
|
|
300
306
|
*/
|
|
301
307
|
stop_price?: string | null;
|
|
302
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Optional execution strategy. Omit to use standard routing. One of `SOR`, `VWAP`,
|
|
311
|
+
* or `TWAP`. Supported only on `MARKET` and `LIMIT` orders with `DAY`
|
|
312
|
+
* time-in-force, and not supported on OTC common-stock orders.
|
|
313
|
+
*/
|
|
314
|
+
strategy?: OrderStrategy | null;
|
|
315
|
+
|
|
303
316
|
/**
|
|
304
317
|
* Trading symbol. For equities, use the ticker symbol (e.g., "TSLA"). For options,
|
|
305
318
|
* use the OSI symbol (e.g., "TSLA 250117C00190000"). Either `symbol` or
|
|
@@ -461,6 +474,11 @@ export interface Order {
|
|
|
461
474
|
*/
|
|
462
475
|
stop_price?: string | null;
|
|
463
476
|
|
|
477
|
+
/**
|
|
478
|
+
* The execution strategy the order was submitted with, if any.
|
|
479
|
+
*/
|
|
480
|
+
strategy?: Order.Strategy;
|
|
481
|
+
|
|
464
482
|
/**
|
|
465
483
|
* Trading symbol. `null` when the order has no single resolvable instrument. When
|
|
466
484
|
* a null/undefined value is observed, it indicates it does not apply.
|
|
@@ -492,14 +510,18 @@ export interface Order {
|
|
|
492
510
|
trailing_stop_px?: string | null;
|
|
493
511
|
|
|
494
512
|
/**
|
|
495
|
-
* Trailing watermark price for trailing orders
|
|
496
|
-
*
|
|
513
|
+
* Trailing watermark price for trailing orders. Strategy-computed, so it is absent
|
|
514
|
+
* on the order-submission acknowledgement and only appears once fetched via the
|
|
515
|
+
* order fetch or list endpoints. When a null/undefined value is observed, it
|
|
516
|
+
* indicates it does not apply.
|
|
497
517
|
*/
|
|
498
518
|
trailing_watermark_px?: string | null;
|
|
499
519
|
|
|
500
520
|
/**
|
|
501
|
-
* Trailing watermark timestamp for trailing orders
|
|
502
|
-
*
|
|
521
|
+
* Trailing watermark timestamp for trailing orders. Strategy-computed, so it is
|
|
522
|
+
* absent on the order-submission acknowledgement and only appears once fetched via
|
|
523
|
+
* the order fetch or list endpoints. When a null/undefined value is observed, it
|
|
524
|
+
* indicates it does not apply.
|
|
503
525
|
*/
|
|
504
526
|
trailing_watermark_ts?: string | null;
|
|
505
527
|
|
|
@@ -511,6 +533,36 @@ export interface Order {
|
|
|
511
533
|
* apply.
|
|
512
534
|
*/
|
|
513
535
|
underlying_instrument_id?: string | null;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Type of the underlying instrument, alongside `underlying_instrument_id`. When a
|
|
539
|
+
* null/undefined value is observed, it indicates it does not apply.
|
|
540
|
+
*/
|
|
541
|
+
underlying_instrument_type?: V1API.SecurityType | null;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export namespace Order {
|
|
545
|
+
/**
|
|
546
|
+
* The execution strategy the order was submitted with, if any.
|
|
547
|
+
*/
|
|
548
|
+
export interface Strategy {
|
|
549
|
+
/**
|
|
550
|
+
* Execution strategy type.
|
|
551
|
+
*/
|
|
552
|
+
type: string;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* UTC timestamp (RFC 3339) at which execution ends.
|
|
556
|
+
*/
|
|
557
|
+
end_at?: string;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* UTC timestamp (RFC 3339) at which execution begins.
|
|
561
|
+
*/
|
|
562
|
+
start_at?: string;
|
|
563
|
+
|
|
564
|
+
[k: string]: unknown;
|
|
565
|
+
}
|
|
514
566
|
}
|
|
515
567
|
|
|
516
568
|
export type OrderList = Array<Order>;
|
|
@@ -537,6 +589,70 @@ export type OrderStatus =
|
|
|
537
589
|
| 'CALCULATED'
|
|
538
590
|
| 'OTHER';
|
|
539
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Optional execution strategy controlling how the order is worked in the market.
|
|
594
|
+
* Omit to use standard routing. One of `SOR`, `VWAP`, or `TWAP`.
|
|
595
|
+
*/
|
|
596
|
+
export type OrderStrategy = OrderStrategy.Type | OrderStrategy.UnionMember1 | OrderStrategy.UnionMember2;
|
|
597
|
+
|
|
598
|
+
export namespace OrderStrategy {
|
|
599
|
+
/**
|
|
600
|
+
* Smart Order Router. Routes the order to the best available venue(s).
|
|
601
|
+
*/
|
|
602
|
+
export interface Type {
|
|
603
|
+
/**
|
|
604
|
+
* Execution strategy type.
|
|
605
|
+
*/
|
|
606
|
+
type: 'SOR';
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Volume-Weighted Average Price. Works the order to track the volume-weighted
|
|
611
|
+
* average price over the execution window.
|
|
612
|
+
*/
|
|
613
|
+
export interface UnionMember1 {
|
|
614
|
+
/**
|
|
615
|
+
* Execution strategy type.
|
|
616
|
+
*/
|
|
617
|
+
type: 'VWAP';
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* UTC timestamp (RFC 3339) by which to finish working the order. Defaults to
|
|
621
|
+
* market close.
|
|
622
|
+
*/
|
|
623
|
+
end_at?: string;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* UTC timestamp (RFC 3339) at which to begin working the order. Defaults to the
|
|
627
|
+
* time the order is received.
|
|
628
|
+
*/
|
|
629
|
+
start_at?: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Time-Weighted Average Price. Spreads execution evenly across the execution
|
|
634
|
+
* window.
|
|
635
|
+
*/
|
|
636
|
+
export interface UnionMember2 {
|
|
637
|
+
/**
|
|
638
|
+
* Execution strategy type.
|
|
639
|
+
*/
|
|
640
|
+
type: 'TWAP';
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* UTC timestamp (RFC 3339) by which to finish working the order. Defaults to
|
|
644
|
+
* market close.
|
|
645
|
+
*/
|
|
646
|
+
end_at?: string;
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* UTC timestamp (RFC 3339) at which to begin working the order. Defaults to the
|
|
650
|
+
* time the order is received.
|
|
651
|
+
*/
|
|
652
|
+
start_at?: string;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
540
656
|
/**
|
|
541
657
|
* Order type
|
|
542
658
|
*/
|
|
@@ -603,8 +719,7 @@ export type RequestOrderType =
|
|
|
603
719
|
| 'TRAILING_STOP_LIMIT';
|
|
604
720
|
|
|
605
721
|
/**
|
|
606
|
-
*
|
|
607
|
-
* Required on every leg of a multileg order submission.
|
|
722
|
+
* Client-attested open/close intent for an order.
|
|
608
723
|
*/
|
|
609
724
|
export type RequestPositionEffect = 'OPEN' | 'CLOSE';
|
|
610
725
|
|
|
@@ -930,6 +1045,7 @@ export declare namespace Orders {
|
|
|
930
1045
|
type Order as Order,
|
|
931
1046
|
type OrderList as OrderList,
|
|
932
1047
|
type OrderStatus as OrderStatus,
|
|
1048
|
+
type OrderStrategy as OrderStrategy,
|
|
933
1049
|
type OrderType as OrderType,
|
|
934
1050
|
type QueueState as QueueState,
|
|
935
1051
|
type ReplaceOrderRequest as ReplaceOrderRequest,
|
|
@@ -270,6 +270,12 @@ export interface Position {
|
|
|
270
270
|
*/
|
|
271
271
|
underlying_instrument_id?: string | null;
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Type of the underlying instrument, alongside `underlying_instrument_id` When a
|
|
275
|
+
* null/undefined value is observed, it indicates it does not apply.
|
|
276
|
+
*/
|
|
277
|
+
underlying_instrument_type?: V1API.SecurityType | null;
|
|
278
|
+
|
|
273
279
|
/**
|
|
274
280
|
* The total unrealized profit or loss for this position based on current market
|
|
275
281
|
* value When a null/undefined value is observed, it indicates that there is no
|
|
@@ -343,6 +349,16 @@ export interface PositionInstruction {
|
|
|
343
349
|
*/
|
|
344
350
|
created_at?: string | null;
|
|
345
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Machine-readable counterpart to `rejection_reason`: a stable reason code plus
|
|
354
|
+
* params, present on every rejected row that has a `rejection_reason` — on submit,
|
|
355
|
+
* cancel, get, and list alike. Branch on `rejection.reason` instead of parsing
|
|
356
|
+
* `rejection_reason`. Forward-only: instructions rejected before this field
|
|
357
|
+
* shipped may carry only `rejection_reason`. When a null/undefined value is
|
|
358
|
+
* observed, it indicates it does not apply.
|
|
359
|
+
*/
|
|
360
|
+
rejection?: PositionInstructionRejection | null;
|
|
361
|
+
|
|
346
362
|
/**
|
|
347
363
|
* Human-readable explanation populated on any non-success terminal status —
|
|
348
364
|
* `REJECTED` or `CANCEL_FAILED`. On a `207 Multi-Status` batch submit the
|
|
@@ -366,6 +382,44 @@ export interface PositionInstruction {
|
|
|
366
382
|
|
|
367
383
|
export type PositionInstructionList = Array<PositionInstruction>;
|
|
368
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Machine-readable detail for a rejected position instruction.
|
|
387
|
+
*
|
|
388
|
+
* Present on every rejected row that carries a `rejection_reason`, across the full
|
|
389
|
+
* lifecycle — submit, cancel, get, and list. Branch on `reason` for programmatic
|
|
390
|
+
* handling and template your own copy from `metadata`; `rejection_reason` remains
|
|
391
|
+
* the human-readable fallback. Forward-only: instructions rejected before this
|
|
392
|
+
* field shipped may carry only `rejection_reason`.
|
|
393
|
+
*/
|
|
394
|
+
export interface PositionInstructionRejection {
|
|
395
|
+
/**
|
|
396
|
+
* Namespacing domain of the `reason` code — `com.clearstreet.oems.exercise` for
|
|
397
|
+
* reasons OEMS validates, `com.clearstreet.oems.clearing` for clearing-owned
|
|
398
|
+
* reasons.
|
|
399
|
+
*/
|
|
400
|
+
domain: string;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Reason-specific parameters as a string→string map. Which keys are present
|
|
404
|
+
* depends on `reason`:
|
|
405
|
+
*
|
|
406
|
+
* - `INSUFFICIENT_POSITION` → `available`, `requested`
|
|
407
|
+
* - `DNE_NOT_ON_EXPIRY` / `CEA_NOT_ON_EXPIRY` → `expiry`, `business_date`
|
|
408
|
+
* - `EXERCISE_PAST_CUTOFF` → `cutoff_time`
|
|
409
|
+
* - `DUPLICATE_INSTRUCTION` → `existing_id`
|
|
410
|
+
*
|
|
411
|
+
* Empty for reasons that carry no parameters. New keys may be added over time, so
|
|
412
|
+
* treat unknown keys leniently.
|
|
413
|
+
*/
|
|
414
|
+
metadata: { [key: string]: string };
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Stable, machine-readable reason code, e.g. `DNE_NOT_ON_EXPIRY`,
|
|
418
|
+
* `INSUFFICIENT_POSITION`, `OPTIONS_LEVEL_EXCEEDED`, `EXERCISE_PAST_CUTOFF`.
|
|
419
|
+
*/
|
|
420
|
+
reason: string;
|
|
421
|
+
}
|
|
422
|
+
|
|
369
423
|
/**
|
|
370
424
|
* Lifecycle status of a position instruction.
|
|
371
425
|
*
|
|
@@ -550,6 +604,7 @@ export declare namespace Positions {
|
|
|
550
604
|
type Position as Position,
|
|
551
605
|
type PositionInstruction as PositionInstruction,
|
|
552
606
|
type PositionInstructionList as PositionInstructionList,
|
|
607
|
+
type PositionInstructionRejection as PositionInstructionRejection,
|
|
553
608
|
type PositionInstructionStatus as PositionInstructionStatus,
|
|
554
609
|
type PositionInstructionType as PositionInstructionType,
|
|
555
610
|
type PositionList as PositionList,
|
|
@@ -158,8 +158,8 @@ export class Screener extends APIResource {
|
|
|
158
158
|
* `instrument_id` column is always prepended. Metadata carries `total_items`,
|
|
159
159
|
* `total_pages`, and `next_page_token` for paging.
|
|
160
160
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
161
|
+
* Screener results can shuffle between calls; reconcile by re-checking rows across
|
|
162
|
+
* pages rather than assuming stable ordering.
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```ts
|
|
@@ -516,7 +516,7 @@ export interface ModifierDef {
|
|
|
516
516
|
args: Array<ModifierArg>;
|
|
517
517
|
|
|
518
518
|
/**
|
|
519
|
-
* `"ADD"` or `"SUBTRACT"`.
|
|
519
|
+
* The modifier operation name: one of `"ADD"` or `"SUBTRACT"`.
|
|
520
520
|
*/
|
|
521
521
|
name: string;
|
|
522
522
|
}
|