@clear-street/clearstreet 0.74.1 → 0.76.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.json +1 -1
  3. package/resources/v1/accounts.d.mts +20 -2
  4. package/resources/v1/accounts.d.mts.map +1 -1
  5. package/resources/v1/accounts.d.ts +20 -2
  6. package/resources/v1/accounts.d.ts.map +1 -1
  7. package/resources/v1/index.d.mts +1 -2
  8. package/resources/v1/index.d.mts.map +1 -1
  9. package/resources/v1/index.d.ts +1 -2
  10. package/resources/v1/index.d.ts.map +1 -1
  11. package/resources/v1/index.js +1 -3
  12. package/resources/v1/index.js.map +1 -1
  13. package/resources/v1/index.mjs +0 -1
  14. package/resources/v1/index.mjs.map +1 -1
  15. package/resources/v1/instrument-data/instrument-data.d.mts +3 -4
  16. package/resources/v1/instrument-data/instrument-data.d.mts.map +1 -1
  17. package/resources/v1/instrument-data/instrument-data.d.ts +3 -4
  18. package/resources/v1/instrument-data/instrument-data.d.ts.map +1 -1
  19. package/resources/v1/instrument-data/instrument-data.js.map +1 -1
  20. package/resources/v1/instrument-data/instrument-data.mjs.map +1 -1
  21. package/resources/v1/instrument-data/market-data.d.mts +9 -14
  22. package/resources/v1/instrument-data/market-data.d.mts.map +1 -1
  23. package/resources/v1/instrument-data/market-data.d.ts +9 -14
  24. package/resources/v1/instrument-data/market-data.d.ts.map +1 -1
  25. package/resources/v1/instrument-data/market-data.js +3 -8
  26. package/resources/v1/instrument-data/market-data.js.map +1 -1
  27. package/resources/v1/instrument-data/market-data.mjs +3 -8
  28. package/resources/v1/instrument-data/market-data.mjs.map +1 -1
  29. package/resources/v1/instrument-data/news.d.mts +4 -4
  30. package/resources/v1/instrument-data/news.d.ts +4 -4
  31. package/resources/v1/instruments.d.mts +13 -19
  32. package/resources/v1/instruments.d.mts.map +1 -1
  33. package/resources/v1/instruments.d.ts +13 -19
  34. package/resources/v1/instruments.d.ts.map +1 -1
  35. package/resources/v1/instruments.js +3 -5
  36. package/resources/v1/instruments.js.map +1 -1
  37. package/resources/v1/instruments.mjs +3 -5
  38. package/resources/v1/instruments.mjs.map +1 -1
  39. package/resources/v1/orders.d.mts +12 -12
  40. package/resources/v1/orders.d.ts +12 -12
  41. package/resources/v1/positions.d.mts +25 -22
  42. package/resources/v1/positions.d.mts.map +1 -1
  43. package/resources/v1/positions.d.ts +25 -22
  44. package/resources/v1/positions.d.ts.map +1 -1
  45. package/resources/v1/positions.js +11 -5
  46. package/resources/v1/positions.js.map +1 -1
  47. package/resources/v1/positions.mjs +11 -5
  48. package/resources/v1/positions.mjs.map +1 -1
  49. package/resources/v1/v1.d.mts +2 -6
  50. package/resources/v1/v1.d.mts.map +1 -1
  51. package/resources/v1/v1.d.ts +2 -6
  52. package/resources/v1/v1.d.ts.map +1 -1
  53. package/resources/v1/v1.js +0 -4
  54. package/resources/v1/v1.js.map +1 -1
  55. package/resources/v1/v1.mjs +0 -4
  56. package/resources/v1/v1.mjs.map +1 -1
  57. package/resources/v1/watchlist.d.mts +1 -1
  58. package/resources/v1/watchlist.d.ts +1 -1
  59. package/src/resources/v1/accounts.ts +24 -1
  60. package/src/resources/v1/index.ts +1 -1
  61. package/src/resources/v1/instrument-data/instrument-data.ts +3 -4
  62. package/src/resources/v1/instrument-data/market-data.ts +9 -14
  63. package/src/resources/v1/instrument-data/news.ts +4 -4
  64. package/src/resources/v1/instruments.ts +13 -19
  65. package/src/resources/v1/orders.ts +12 -12
  66. package/src/resources/v1/positions.ts +24 -22
  67. package/src/resources/v1/v1.ts +2 -6
  68. package/src/resources/v1/watchlist.ts +1 -1
  69. package/src/version.ts +1 -1
  70. package/version.d.mts +1 -1
  71. package/version.d.ts +1 -1
  72. package/version.js +1 -1
  73. package/version.mjs +1 -1
  74. package/resources/v1/websocket.d.mts +0 -18
  75. package/resources/v1/websocket.d.mts.map +0 -1
  76. package/resources/v1/websocket.d.ts +0 -18
  77. package/resources/v1/websocket.d.ts.map +0 -1
  78. package/resources/v1/websocket.js +0 -27
  79. package/resources/v1/websocket.js.map +0 -1
  80. package/resources/v1/websocket.mjs +0 -23
  81. package/resources/v1/websocket.mjs.map +0 -1
  82. package/src/resources/v1/websocket.ts +0 -26
@@ -89,6 +89,12 @@ export class Positions extends APIResource {
89
89
  * Returns the current lifecycle state of the account's position instructions.
90
90
  * Optionally filter by a specific contract.
91
91
  *
92
+ * Note: instructions that fail pre-acceptance validation on `POST` — duplicates,
93
+ * `DO_NOT_EXERCISE` / `CONTRARY_EXERCISE` on a non-expiry day, insufficient
94
+ * position, or an unresolvable instrument — are rejected (with `status = REJECTED`
95
+ * and a `rejection_reason`) without being persisted, so they surface only in the
96
+ * `POST` response and never appear in this list.
97
+ *
92
98
  * @example
93
99
  * ```ts
94
100
  * const response =
@@ -127,14 +133,14 @@ export class Positions extends APIResource {
127
133
  *
128
134
  * - **All rows accepted** → `200 OK`. Every row is in `data` with `status = SENT`.
129
135
  * - **Partial success** → `207 Multi-Status`. `data` contains every row; rejected
130
- * rows carry `status = ENGINE_REJECTED` (or `REJECTED`) and `rejection_reason`.
131
- * The top-level `error` summarizes the batch failure.
136
+ * rows carry `status = REJECTED` and `rejection_reason`. The top-level `error`
137
+ * summarizes the batch failure.
132
138
  * - **All rows rejected** → `4xx`/`5xx`. The HTTP status reflects the aggregate
133
139
  * cause: `409` when every row was a duplicate, `400` for validation failures
134
140
  * like DNE/CEA on a non-expiry day, `503` if the clearing service is
135
- * unavailable. `data` still contains every row carrying
136
- * `status = ENGINE_REJECTED` and `rejection_reason` so callers can attribute
137
- * failures by `instruction_id`; the top-level `error` summarizes the batch.
141
+ * unavailable. `data` still contains every row carrying `status = REJECTED` and
142
+ * `rejection_reason` so callers can attribute failures by `instruction_id`; the
143
+ * top-level `error` summarizes the batch.
138
144
  *
139
145
  * @example
140
146
  * ```ts
@@ -179,7 +185,7 @@ export interface Position {
179
185
  available_quantity: string;
180
186
 
181
187
  /**
182
- * OEMS instrument UUID
188
+ * Unique instrument identifier
183
189
  */
184
190
  instrument_id: string;
185
191
 
@@ -245,7 +251,7 @@ export interface Position {
245
251
  instrument_price?: string | null;
246
252
 
247
253
  /**
248
- * OEMS instrument identifier of the underlying instrument, if resolvable
254
+ * Identifier of the underlying instrument, when available
249
255
  */
250
256
  underlying_instrument_id?: string | null;
251
257
 
@@ -320,9 +326,9 @@ export interface PositionInstruction {
320
326
 
321
327
  /**
322
328
  * Human-readable explanation populated on any non-success terminal status —
323
- * `REJECTED`, `ENGINE_REJECTED`, or `CANCEL_FAILED`. On a `207 Multi-Status` batch
324
- * submit the top-level `error` field summarizes the batch; per-row detail
325
- * continues to live here.
329
+ * `REJECTED` or `CANCEL_FAILED`. On a `207 Multi-Status` batch submit the
330
+ * top-level `error` field summarizes the batch; per-row detail continues to live
331
+ * here.
326
332
  */
327
333
  rejection_reason?: string | null;
328
334
 
@@ -337,27 +343,23 @@ export type PositionInstructionList = Array<PositionInstruction>;
337
343
  /**
338
344
  * Lifecycle status of a position instruction.
339
345
  *
340
- * - `SENT`: accepted and forwarded to the clearing venue.
346
+ * - `SENT`: accepted and submitted to the clearing venue.
341
347
  * - `ACCEPTED`: terminal — accepted by the clearing venue.
342
- * - `REJECTED`: terminal rejection from the clearing venue; `rejection_reason`
343
- * carries the venue-reported detail.
344
- * - `ENGINE_REJECTED`: terminal rejection raised before the instruction reached
345
- * the clearing venue; `rejection_reason` carries the detail. Typical causes:
346
- * duplicate `instruction_id`, `DO_NOT_EXERCISE` / `CONTRARY_EXERCISE` submitted
347
- * on a non-expiry day, insufficient position, or an instrument that does not
348
- * resolve.
348
+ * - `REJECTED`: terminal rejection; `rejection_reason` carries the detail. Covers
349
+ * both venue-reported rejections and rejections raised before the instruction
350
+ * reached the clearing venue (e.g. duplicate `instruction_id`, `DO_NOT_EXERCISE`
351
+ * / `CONTRARY_EXERCISE` submitted on a non-expiry day, insufficient position, or
352
+ * an instrument that does not resolve).
349
353
  * - `CANCEL_REQUESTED`: cancel accepted; final cancel state pending.
350
354
  * - `CANCELLED`: terminal — cancel completed.
351
355
  * - `CANCEL_FAILED`: cancel could not be completed; operator attention required.
352
356
  * `rejection_reason` carries the detail.
353
- * - `UNKNOWN`: status could not be mapped from the upstream service. Not expected
354
- * in practice; surfaces a service version skew.
357
+ * - `UNKNOWN`: status could not be determined.
355
358
  */
356
359
  export type PositionInstructionStatus =
357
360
  | 'SENT'
358
361
  | 'ACCEPTED'
359
362
  | 'REJECTED'
360
- | 'ENGINE_REJECTED'
361
363
  | 'CANCEL_REQUESTED'
362
364
  | 'CANCELLED'
363
365
  | 'CANCEL_FAILED'
@@ -439,7 +441,7 @@ export interface PositionGetPositionInstructionsParams {
439
441
 
440
442
  export interface PositionGetPositionsParams {
441
443
  /**
442
- * Comma-separated OEMS instrument UUIDs
444
+ * Comma-separated instrument identifiers
443
445
  */
444
446
  instrument_ids?: Array<string>;
445
447
 
@@ -23,6 +23,7 @@ import {
23
23
  Accounts,
24
24
  MarginDetails,
25
25
  MarginDetailsUsage,
26
+ MarginSessionDetails,
26
27
  MarginTopContributor,
27
28
  MarginType,
28
29
  PortfolioHistoryResponse,
@@ -143,8 +144,6 @@ import {
143
144
  WatchlistGetWatchlistsResponse,
144
145
  WatchlistItemEntry,
145
146
  } from './watchlist';
146
- import * as WebsocketAPI from './websocket';
147
- import { Websocket } from './websocket';
148
147
  import * as InstrumentDataAPI from './instrument-data/instrument-data';
149
148
  import {
150
149
  AllEventsEventType,
@@ -222,7 +221,6 @@ export class V1 extends APIResource {
222
221
  orders: OrdersAPI.Orders = new OrdersAPI.Orders(this._client);
223
222
  positions: PositionsAPI.Positions = new PositionsAPI.Positions(this._client);
224
223
  watchlist: WatchlistAPI.Watchlist = new WatchlistAPI.Watchlist(this._client);
225
- websocket: WebsocketAPI.Websocket = new WebsocketAPI.Websocket(this._client);
226
224
  }
227
225
 
228
226
  /**
@@ -239,7 +237,6 @@ V1.OmniAI = OmniAI;
239
237
  V1.Orders = Orders;
240
238
  V1.Positions = Positions;
241
239
  V1.Watchlist = Watchlist;
242
- V1.Websocket = Websocket;
243
240
 
244
241
  export declare namespace V1 {
245
242
  export { type SecurityType as SecurityType };
@@ -256,6 +253,7 @@ export declare namespace V1 {
256
253
  type AccountType as AccountType,
257
254
  type MarginDetails as MarginDetails,
258
255
  type MarginDetailsUsage as MarginDetailsUsage,
256
+ type MarginSessionDetails as MarginSessionDetails,
259
257
  type MarginTopContributor as MarginTopContributor,
260
258
  type MarginType as MarginType,
261
259
  type PortfolioHistoryResponse as PortfolioHistoryResponse,
@@ -455,6 +453,4 @@ export declare namespace V1 {
455
453
  type WatchlistDeleteWatchlistItemParams as WatchlistDeleteWatchlistItemParams,
456
454
  type WatchlistGetWatchlistsParams as WatchlistGetWatchlistsParams,
457
455
  };
458
-
459
- export { Websocket as Websocket };
460
456
  }
@@ -238,7 +238,7 @@ export interface WatchlistGetWatchlistsResponse extends Shared.BaseResponse {
238
238
 
239
239
  export interface WatchlistAddWatchlistItemParams {
240
240
  /**
241
- * OEMS instrument UUID
241
+ * Instrument identifier
242
242
  */
243
243
  instrument_id: OrdersAPI.InstrumentIDOrSymbol;
244
244
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.74.1'; // x-release-please-version
1
+ export const VERSION = '0.76.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.74.1";
1
+ export declare const VERSION = "0.76.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.74.1";
1
+ export declare const VERSION = "0.76.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.74.1'; // x-release-please-version
4
+ exports.VERSION = '0.76.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.74.1'; // x-release-please-version
1
+ export const VERSION = '0.76.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
@@ -1,18 +0,0 @@
1
- import { APIResource } from "../../core/resource.mjs";
2
- import { APIPromise } from "../../core/api-promise.mjs";
3
- import { RequestOptions } from "../../internal/request-options.mjs";
4
- /**
5
- * Active Websocket.
6
- */
7
- export declare class Websocket extends APIResource {
8
- /**
9
- * Upgrade the HTTP connection to a WebSocket and echo incoming messages.
10
- *
11
- * @example
12
- * ```ts
13
- * await client.v1.websocket.websocketHandler();
14
- * ```
15
- */
16
- websocketHandler(options?: RequestOptions): APIPromise<void>;
17
- }
18
- //# sourceMappingURL=websocket.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"websocket.d.mts","sourceRoot":"","sources":["../../src/resources/v1/websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAEhE;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;OAOG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAM7D"}
@@ -1,18 +0,0 @@
1
- import { APIResource } from "../../core/resource.js";
2
- import { APIPromise } from "../../core/api-promise.js";
3
- import { RequestOptions } from "../../internal/request-options.js";
4
- /**
5
- * Active Websocket.
6
- */
7
- export declare class Websocket extends APIResource {
8
- /**
9
- * Upgrade the HTTP connection to a WebSocket and echo incoming messages.
10
- *
11
- * @example
12
- * ```ts
13
- * await client.v1.websocket.websocketHandler();
14
- * ```
15
- */
16
- websocketHandler(options?: RequestOptions): APIPromise<void>;
17
- }
18
- //# sourceMappingURL=websocket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../src/resources/v1/websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;OAOG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAM7D"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Websocket = void 0;
5
- const resource_1 = require("../../core/resource.js");
6
- const headers_1 = require("../../internal/headers.js");
7
- /**
8
- * Active Websocket.
9
- */
10
- class Websocket extends resource_1.APIResource {
11
- /**
12
- * Upgrade the HTTP connection to a WebSocket and echo incoming messages.
13
- *
14
- * @example
15
- * ```ts
16
- * await client.v1.websocket.websocketHandler();
17
- * ```
18
- */
19
- websocketHandler(options) {
20
- return this._client.get('/v1/ws', {
21
- ...options,
22
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
23
- });
24
- }
25
- }
26
- exports.Websocket = Websocket;
27
- //# sourceMappingURL=websocket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../src/resources/v1/websocket.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAGtD;;GAEG;AACH,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;;;;OAOG;IACH,gBAAgB,CAAC,OAAwB;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;YAChC,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAfD,8BAeC"}
@@ -1,23 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../core/resource.mjs";
3
- import { buildHeaders } from "../../internal/headers.mjs";
4
- /**
5
- * Active Websocket.
6
- */
7
- export class Websocket extends APIResource {
8
- /**
9
- * Upgrade the HTTP connection to a WebSocket and echo incoming messages.
10
- *
11
- * @example
12
- * ```ts
13
- * await client.v1.websocket.websocketHandler();
14
- * ```
15
- */
16
- websocketHandler(options) {
17
- return this._client.get('/v1/ws', {
18
- ...options,
19
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
20
- });
21
- }
22
- }
23
- //# sourceMappingURL=websocket.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"websocket.mjs","sourceRoot":"","sources":["../../src/resources/v1/websocket.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAGtD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;;;;OAOG;IACH,gBAAgB,CAAC,OAAwB;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;YAChC,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,26 +0,0 @@
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
- /**
9
- * Active Websocket.
10
- */
11
- export class Websocket extends APIResource {
12
- /**
13
- * Upgrade the HTTP connection to a WebSocket and echo incoming messages.
14
- *
15
- * @example
16
- * ```ts
17
- * await client.v1.websocket.websocketHandler();
18
- * ```
19
- */
20
- websocketHandler(options?: RequestOptions): APIPromise<void> {
21
- return this._client.get('/v1/ws', {
22
- ...options,
23
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
24
- });
25
- }
26
- }