@clear-street/studio-sdk 0.1.0-alpha.4

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 (291) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +201 -0
  3. package/README.md +288 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +90 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +239 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +881 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +850 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +53 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +143 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +127 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +128 -0
  87. package/index.d.ts +128 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +112 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +84 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +104 -0
  94. package/resource.d.ts +6 -0
  95. package/resource.d.ts.map +1 -0
  96. package/resource.js +11 -0
  97. package/resource.js.map +1 -0
  98. package/resource.mjs +7 -0
  99. package/resource.mjs.map +1 -0
  100. package/resources/accounts/accounts.d.ts +74 -0
  101. package/resources/accounts/accounts.d.ts.map +1 -0
  102. package/resources/accounts/accounts.js +73 -0
  103. package/resources/accounts/accounts.js.map +1 -0
  104. package/resources/accounts/accounts.mjs +46 -0
  105. package/resources/accounts/accounts.mjs.map +1 -0
  106. package/resources/accounts/bulk-orders.d.ts +137 -0
  107. package/resources/accounts/bulk-orders.d.ts.map +1 -0
  108. package/resources/accounts/bulk-orders.js +29 -0
  109. package/resources/accounts/bulk-orders.js.map +1 -0
  110. package/resources/accounts/bulk-orders.mjs +25 -0
  111. package/resources/accounts/bulk-orders.mjs.map +1 -0
  112. package/resources/accounts/easy-borrows.d.ts +17 -0
  113. package/resources/accounts/easy-borrows.d.ts.map +1 -0
  114. package/resources/accounts/easy-borrows.js +18 -0
  115. package/resources/accounts/easy-borrows.js.map +1 -0
  116. package/resources/accounts/easy-borrows.mjs +14 -0
  117. package/resources/accounts/easy-borrows.mjs.map +1 -0
  118. package/resources/accounts/index.d.ts +10 -0
  119. package/resources/accounts/index.d.ts.map +1 -0
  120. package/resources/accounts/index.js +23 -0
  121. package/resources/accounts/index.js.map +1 -0
  122. package/resources/accounts/index.mjs +11 -0
  123. package/resources/accounts/index.mjs.map +1 -0
  124. package/resources/accounts/locate-orders.d.ts +56 -0
  125. package/resources/accounts/locate-orders.d.ts.map +1 -0
  126. package/resources/accounts/locate-orders.js +39 -0
  127. package/resources/accounts/locate-orders.js.map +1 -0
  128. package/resources/accounts/locate-orders.mjs +35 -0
  129. package/resources/accounts/locate-orders.mjs.map +1 -0
  130. package/resources/accounts/orders.d.ts +168 -0
  131. package/resources/accounts/orders.d.ts.map +1 -0
  132. package/resources/accounts/orders.js +53 -0
  133. package/resources/accounts/orders.js.map +1 -0
  134. package/resources/accounts/orders.mjs +49 -0
  135. package/resources/accounts/orders.mjs.map +1 -0
  136. package/resources/accounts/pnl-details.d.ts +113 -0
  137. package/resources/accounts/pnl-details.d.ts.map +1 -0
  138. package/resources/accounts/pnl-details.js +17 -0
  139. package/resources/accounts/pnl-details.js.map +1 -0
  140. package/resources/accounts/pnl-details.mjs +13 -0
  141. package/resources/accounts/pnl-details.mjs.map +1 -0
  142. package/resources/accounts/pnl-summary.d.ts +10 -0
  143. package/resources/accounts/pnl-summary.d.ts.map +1 -0
  144. package/resources/accounts/pnl-summary.js +15 -0
  145. package/resources/accounts/pnl-summary.js.map +1 -0
  146. package/resources/accounts/pnl-summary.mjs +11 -0
  147. package/resources/accounts/pnl-summary.mjs.map +1 -0
  148. package/resources/accounts/positions.d.ts +37 -0
  149. package/resources/accounts/positions.d.ts.map +1 -0
  150. package/resources/accounts/positions.js +24 -0
  151. package/resources/accounts/positions.js.map +1 -0
  152. package/resources/accounts/positions.mjs +20 -0
  153. package/resources/accounts/positions.mjs.map +1 -0
  154. package/resources/accounts/trades.d.ts +37 -0
  155. package/resources/accounts/trades.d.ts.map +1 -0
  156. package/resources/accounts/trades.js +24 -0
  157. package/resources/accounts/trades.js.map +1 -0
  158. package/resources/accounts/trades.mjs +20 -0
  159. package/resources/accounts/trades.mjs.map +1 -0
  160. package/resources/entities/entities.d.ts +458 -0
  161. package/resources/entities/entities.d.ts.map +1 -0
  162. package/resources/entities/entities.js +61 -0
  163. package/resources/entities/entities.js.map +1 -0
  164. package/resources/entities/entities.mjs +34 -0
  165. package/resources/entities/entities.mjs.map +1 -0
  166. package/resources/entities/index.d.ts +6 -0
  167. package/resources/entities/index.d.ts.map +1 -0
  168. package/resources/entities/index.js +15 -0
  169. package/resources/entities/index.js.map +1 -0
  170. package/resources/entities/index.mjs +7 -0
  171. package/resources/entities/index.mjs.map +1 -0
  172. package/resources/entities/pnl-summaries.d.ts +10 -0
  173. package/resources/entities/pnl-summaries.d.ts.map +1 -0
  174. package/resources/entities/pnl-summaries.js +15 -0
  175. package/resources/entities/pnl-summaries.js.map +1 -0
  176. package/resources/entities/pnl-summaries.mjs +11 -0
  177. package/resources/entities/pnl-summaries.mjs.map +1 -0
  178. package/resources/entities/portfolio-margins.d.ts +10 -0
  179. package/resources/entities/portfolio-margins.d.ts.map +1 -0
  180. package/resources/entities/portfolio-margins.js +15 -0
  181. package/resources/entities/portfolio-margins.js.map +1 -0
  182. package/resources/entities/portfolio-margins.mjs +11 -0
  183. package/resources/entities/portfolio-margins.mjs.map +1 -0
  184. package/resources/entities/regt-margin-simulations.d.ts +97 -0
  185. package/resources/entities/regt-margin-simulations.d.ts.map +1 -0
  186. package/resources/entities/regt-margin-simulations.js +30 -0
  187. package/resources/entities/regt-margin-simulations.js.map +1 -0
  188. package/resources/entities/regt-margin-simulations.mjs +26 -0
  189. package/resources/entities/regt-margin-simulations.mjs.map +1 -0
  190. package/resources/entities/regt-margins.d.ts +10 -0
  191. package/resources/entities/regt-margins.d.ts.map +1 -0
  192. package/resources/entities/regt-margins.js +15 -0
  193. package/resources/entities/regt-margins.js.map +1 -0
  194. package/resources/entities/regt-margins.mjs +11 -0
  195. package/resources/entities/regt-margins.mjs.map +1 -0
  196. package/resources/index.d.ts +5 -0
  197. package/resources/index.d.ts.map +1 -0
  198. package/resources/index.js +26 -0
  199. package/resources/index.js.map +1 -0
  200. package/resources/index.mjs +6 -0
  201. package/resources/index.mjs.map +1 -0
  202. package/resources/instruments.d.ts +45 -0
  203. package/resources/instruments.d.ts.map +1 -0
  204. package/resources/instruments.js +18 -0
  205. package/resources/instruments.js.map +1 -0
  206. package/resources/instruments.mjs +14 -0
  207. package/resources/instruments.mjs.map +1 -0
  208. package/resources/shared.d.ts +251 -0
  209. package/resources/shared.d.ts.map +1 -0
  210. package/resources/shared.js +4 -0
  211. package/resources/shared.js.map +1 -0
  212. package/resources/shared.mjs +3 -0
  213. package/resources/shared.mjs.map +1 -0
  214. package/shims/node.d.ts +29 -0
  215. package/shims/node.d.ts.map +1 -0
  216. package/shims/node.js +31 -0
  217. package/shims/node.js.map +1 -0
  218. package/shims/node.mjs +5 -0
  219. package/shims/node.mjs.map +1 -0
  220. package/shims/web.d.ts +26 -0
  221. package/shims/web.d.ts.map +1 -0
  222. package/shims/web.js +31 -0
  223. package/shims/web.js.map +1 -0
  224. package/shims/web.mjs +5 -0
  225. package/shims/web.mjs.map +1 -0
  226. package/src/_shims/MultipartBody.ts +9 -0
  227. package/src/_shims/README.md +46 -0
  228. package/src/_shims/auto/runtime-bun.ts +4 -0
  229. package/src/_shims/auto/runtime-node.ts +4 -0
  230. package/src/_shims/auto/runtime.ts +4 -0
  231. package/src/_shims/auto/types-node.ts +4 -0
  232. package/src/_shims/auto/types.d.ts +101 -0
  233. package/src/_shims/auto/types.js +3 -0
  234. package/src/_shims/auto/types.mjs +3 -0
  235. package/src/_shims/bun-runtime.ts +14 -0
  236. package/src/_shims/index.d.ts +81 -0
  237. package/src/_shims/index.js +13 -0
  238. package/src/_shims/index.mjs +7 -0
  239. package/src/_shims/manual-types.d.ts +12 -0
  240. package/src/_shims/manual-types.js +3 -0
  241. package/src/_shims/manual-types.mjs +3 -0
  242. package/src/_shims/node-runtime.ts +83 -0
  243. package/src/_shims/node-types.d.ts +42 -0
  244. package/src/_shims/node-types.js +3 -0
  245. package/src/_shims/node-types.mjs +3 -0
  246. package/src/_shims/registry.ts +67 -0
  247. package/src/_shims/web-runtime.ts +103 -0
  248. package/src/_shims/web-types.d.ts +83 -0
  249. package/src/_shims/web-types.js +3 -0
  250. package/src/_shims/web-types.mjs +3 -0
  251. package/src/core.ts +1165 -0
  252. package/src/error.ts +146 -0
  253. package/src/index.ts +206 -0
  254. package/src/lib/.keep +4 -0
  255. package/src/resource.ts +11 -0
  256. package/src/resources/accounts/accounts.ts +87 -0
  257. package/src/resources/accounts/bulk-orders.ts +163 -0
  258. package/src/resources/accounts/easy-borrows.ts +23 -0
  259. package/src/resources/accounts/index.ts +25 -0
  260. package/src/resources/accounts/locate-orders.ts +94 -0
  261. package/src/resources/accounts/orders.ts +246 -0
  262. package/src/resources/accounts/pnl-details.ts +143 -0
  263. package/src/resources/accounts/pnl-summary.ts +14 -0
  264. package/src/resources/accounts/positions.ts +66 -0
  265. package/src/resources/accounts/trades.ts +62 -0
  266. package/src/resources/entities/entities.ts +562 -0
  267. package/src/resources/entities/index.ts +12 -0
  268. package/src/resources/entities/pnl-summaries.ts +14 -0
  269. package/src/resources/entities/portfolio-margins.ts +14 -0
  270. package/src/resources/entities/regt-margin-simulations.ts +127 -0
  271. package/src/resources/entities/regt-margins.ts +14 -0
  272. package/src/resources/index.ts +13 -0
  273. package/src/resources/instruments.ts +70 -0
  274. package/src/resources/shared.ts +320 -0
  275. package/src/shims/node.ts +50 -0
  276. package/src/shims/web.ts +50 -0
  277. package/src/tsconfig.json +11 -0
  278. package/src/uploads.ts +248 -0
  279. package/src/version.ts +1 -0
  280. package/uploads.d.ts +75 -0
  281. package/uploads.d.ts.map +1 -0
  282. package/uploads.js +165 -0
  283. package/uploads.js.map +1 -0
  284. package/uploads.mjs +152 -0
  285. package/uploads.mjs.map +1 -0
  286. package/version.d.ts +2 -0
  287. package/version.d.ts.map +1 -0
  288. package/version.js +5 -0
  289. package/version.js.map +1 -0
  290. package/version.mjs +2 -0
  291. package/version.mjs.map +1 -0
@@ -0,0 +1,127 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from "../../resource";
4
+ import * as Core from "../../core";
5
+ import * as RegtMarginSimulationsAPI from "./regt-margin-simulations";
6
+ import * as Shared from "../shared";
7
+
8
+ export class RegtMarginSimulations extends APIResource {
9
+ /**
10
+ * Simulate Reg-T margin calculation for a given hypothetical set of prices and/or
11
+ * trades. This is useful for understanding the impact of price fluctuations or
12
+ * trades on margin requirements. Once a simulation is created, it remains
13
+ * available for 48-hours, after which it will automatically be deleted.
14
+ *
15
+ * Simulations created through the API are visible in the Studio UI under the Risk
16
+ * & Margin section, after enabling the "Risk Simulations" toggle.
17
+ */
18
+ create(
19
+ entityId: string,
20
+ body: RegtMarginSimulationCreateParams,
21
+ options?: Core.RequestOptions,
22
+ ): Core.APIPromise<RegtMarginSimulationCreateResponse> {
23
+ return this._client.post(`/entities/${entityId}/regt-margin-simulations`, { body, ...options });
24
+ }
25
+
26
+ /**
27
+ * Get a Reg-T margin simluation that was previously created. Note, simulations are
28
+ * automatically deleted after 48-hours.
29
+ */
30
+ retrieve(
31
+ entityId: string,
32
+ simulationId: SimulationID,
33
+ options?: Core.RequestOptions,
34
+ ): Core.APIPromise<Shared.RegtMarginSimulation> {
35
+ return this._client.get(`/entities/${entityId}/regt-margin-simulations/${simulationId}`, options);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Unique ID for a simulation.
41
+ */
42
+ export type SimulationID = string;
43
+
44
+ export interface RegtMarginSimulationCreateResponse {
45
+ /**
46
+ * Unique ID for a simulation.
47
+ */
48
+ simulation_id: SimulationID;
49
+ }
50
+
51
+ export interface RegtMarginSimulationCreateParams {
52
+ /**
53
+ * A name for this simulation for reference.
54
+ */
55
+ name: string;
56
+
57
+ /**
58
+ * If true, the simulation will ignore any existing positions and balances in the
59
+ * account. Set to true if you want to simulate from a clean slate, i.e. an empty
60
+ * account.
61
+ */
62
+ ignore_existing?: boolean;
63
+
64
+ /**
65
+ * List of prices to use in the simulation, i.e. fair-market-values you specify for
66
+ * each symbol. If this is not provided, current market prices will be used, if
67
+ * they are available.
68
+ */
69
+ prices?: Array<RegtMarginSimulationCreateParams.Price>;
70
+
71
+ /**
72
+ * List of hypothetical trades to include in the simulation, if any.
73
+ */
74
+ trades?: Array<RegtMarginSimulationCreateParams.Trade>;
75
+ }
76
+
77
+ export namespace RegtMarginSimulationCreateParams {
78
+ export interface Price {
79
+ /**
80
+ * The price to use in the simulation.
81
+ */
82
+ price: string;
83
+
84
+ /**
85
+ * The symbol for the instrument.
86
+ */
87
+ symbol: string;
88
+
89
+ /**
90
+ * Denotes the format of the provided `symbol` field.
91
+ */
92
+ symbol_format?: 'cms' | 'osi';
93
+ }
94
+
95
+ export interface Trade {
96
+ /**
97
+ * The price of the simulated trade.
98
+ */
99
+ price: string;
100
+
101
+ /**
102
+ * The quantity of the simulated trade.
103
+ */
104
+ quantity: string;
105
+
106
+ /**
107
+ * The side of the simulated trade.
108
+ */
109
+ side: 'buy' | 'sell';
110
+
111
+ /**
112
+ * The symbol for the instrument.
113
+ */
114
+ symbol: string;
115
+
116
+ /**
117
+ * Denotes the format of the provided `symbol` field.
118
+ */
119
+ symbol_format?: 'cms' | 'osi';
120
+ }
121
+ }
122
+
123
+ export namespace RegtMarginSimulations {
124
+ export import SimulationID = RegtMarginSimulationsAPI.SimulationID;
125
+ export import RegtMarginSimulationCreateResponse = RegtMarginSimulationsAPI.RegtMarginSimulationCreateResponse;
126
+ export import RegtMarginSimulationCreateParams = RegtMarginSimulationsAPI.RegtMarginSimulationCreateParams;
127
+ }
@@ -0,0 +1,14 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from "../../resource";
4
+ import * as Core from "../../core";
5
+ import * as EntitiesAPI from "./entities";
6
+
7
+ export class RegtMargins extends APIResource {
8
+ /**
9
+ * Get the latest Reg-T margin calculation for the given entity
10
+ */
11
+ retrieve(entityId: string, options?: Core.RequestOptions): Core.APIPromise<EntitiesAPI.RegtMargin> {
12
+ return this._client.get(`/entities/${entityId}/regt-margin`, options);
13
+ }
14
+ }
@@ -0,0 +1,13 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './shared';
4
+ export { Account, AccountListResponse, Accounts } from './accounts/accounts';
5
+ export {
6
+ Entity,
7
+ PnlSummary,
8
+ PortfolioMargin,
9
+ RegtMargin,
10
+ EntityListResponse,
11
+ Entities,
12
+ } from './entities/entities';
13
+ export { Instrument, InstrumentRetrieveParams, Instruments } from './instruments';
@@ -0,0 +1,70 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from "../resource";
4
+ import { isRequestOptions } from "../core";
5
+ import * as Core from "../core";
6
+ import * as InstrumentsAPI from "./instruments";
7
+
8
+ export class Instruments extends APIResource {
9
+ /**
10
+ * Get an instrument by the given symbol
11
+ */
12
+ retrieve(
13
+ symbol: string,
14
+ query?: InstrumentRetrieveParams,
15
+ options?: Core.RequestOptions,
16
+ ): Core.APIPromise<Instrument>;
17
+ retrieve(symbol: string, options?: Core.RequestOptions): Core.APIPromise<Instrument>;
18
+ retrieve(
19
+ symbol: string,
20
+ query: InstrumentRetrieveParams | Core.RequestOptions = {},
21
+ options?: Core.RequestOptions,
22
+ ): Core.APIPromise<Instrument> {
23
+ if (isRequestOptions(query)) {
24
+ return this.retrieve(symbol, {}, query);
25
+ }
26
+ return this._client.get(`/instruments/${symbol}`, { query, ...options });
27
+ }
28
+ }
29
+
30
+ export interface Instrument {
31
+ /**
32
+ * The asset class of the symbol.
33
+ */
34
+ asset_class: 'other' | 'equity' | 'option' | 'debt';
35
+
36
+ /**
37
+ * A description of the instrument.
38
+ */
39
+ description: string;
40
+
41
+ /**
42
+ * The primary exchange for the instrument.
43
+ */
44
+ primary_exchange: string;
45
+
46
+ symbols: Array<Instrument.Symbol>;
47
+ }
48
+
49
+ export namespace Instrument {
50
+ export interface Symbol {
51
+ symbol?: string;
52
+
53
+ /**
54
+ * Denotes the format of the provided `symbol` field.
55
+ */
56
+ symbol_format?: 'cms' | 'osi';
57
+ }
58
+ }
59
+
60
+ export interface InstrumentRetrieveParams {
61
+ /**
62
+ * The format of the provided symbol.
63
+ */
64
+ symbol_format?: 'cms' | 'osi';
65
+ }
66
+
67
+ export namespace Instruments {
68
+ export import Instrument = InstrumentsAPI.Instrument;
69
+ export import InstrumentRetrieveParams = InstrumentsAPI.InstrumentRetrieveParams;
70
+ }
@@ -0,0 +1,320 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as EntitiesAPI from "./entities/entities";
4
+ import * as RegtMarginSimulationsAPI from "./entities/regt-margin-simulations";
5
+
6
+ export interface LocateOrder {
7
+ /**
8
+ * Account ID for the account.
9
+ */
10
+ account_id: string;
11
+
12
+ /**
13
+ * Unique locate ID assigned by us.
14
+ */
15
+ locate_order_id: string;
16
+
17
+ /**
18
+ * Unique MPID assigned by us.
19
+ */
20
+ mpid: string;
21
+
22
+ /**
23
+ * The timestamp indicating when the locate order was requested.
24
+ */
25
+ requested_at: number;
26
+
27
+ /**
28
+ * String representation of quantity.
29
+ */
30
+ requested_quantity: string;
31
+
32
+ /**
33
+ * The status of the locate order.
34
+ */
35
+ status: 'pending' | 'offered' | 'filled' | 'rejected' | 'declined' | 'expired' | 'cancelled';
36
+
37
+ symbol: string;
38
+
39
+ /**
40
+ * The timestamp indicating when the locate order was last updated.
41
+ */
42
+ updated_at: number;
43
+
44
+ /**
45
+ * The rate charged if the instrument is held overnight.
46
+ */
47
+ borrow_rate?: string;
48
+
49
+ /**
50
+ * Comment from the desk.
51
+ */
52
+ desk_comment?: string;
53
+
54
+ /**
55
+ * The timestamp indicating when the locate-order will expire.
56
+ */
57
+ expires_at?: number;
58
+
59
+ /**
60
+ * The locate ID, available once the locate order has been offered
61
+ */
62
+ locate_id?: string;
63
+
64
+ /**
65
+ * The timestamp indicating when the locate-order was located.
66
+ */
67
+ located_at?: number;
68
+
69
+ /**
70
+ * The quantity that has been located.
71
+ */
72
+ located_quantity?: string;
73
+
74
+ /**
75
+ * The reference ID provided by you.
76
+ */
77
+ reference_id?: string;
78
+
79
+ /**
80
+ * The total cost of the locate.
81
+ */
82
+ total_cost?: string;
83
+
84
+ /**
85
+ * Comment from the trader.
86
+ */
87
+ trader_comment?: string;
88
+ }
89
+
90
+ export interface Order {
91
+ /**
92
+ * Account ID for the account.
93
+ */
94
+ account_id: string;
95
+
96
+ /**
97
+ * When the order was created in milliseconds since epoch.
98
+ */
99
+ created_at: number;
100
+
101
+ /**
102
+ * The quantity that has been filled.
103
+ */
104
+ filled_quantity: string;
105
+
106
+ /**
107
+ * An internally generated unique ID for this order.
108
+ */
109
+ order_id: string;
110
+
111
+ /**
112
+ * The type of order, can be one of the following:
113
+ *
114
+ * - `limit`: A limit order will execute at-or-better than the limit price you
115
+ * specify
116
+ * - `market`: An order that will execute at the prevailing market prices
117
+ */
118
+ order_type: 'limit' | 'market';
119
+
120
+ /**
121
+ * The requested quantity on this order.
122
+ */
123
+ quantity: string;
124
+
125
+ /**
126
+ * Buy, sell, sell-short indicator.
127
+ */
128
+ side: 'buy' | 'sell' | 'sell-short';
129
+
130
+ /**
131
+ * Simplified order state, which is inferred from `OrderStatus`. Makes it easier to
132
+ * determine whether an order can be executed against.
133
+ *
134
+ * - `open`: Order _can_ potentially be executed against.
135
+ * - `rejected`: Order _cannot_ be executed against because it was rejected. This
136
+ * is a terminal state.
137
+ * - `closed`: Order _cannot_ be executed against. This is a terminal state.
138
+ */
139
+ state: 'open' | 'rejected' | 'closed';
140
+
141
+ /**
142
+ * Granular order status using
143
+ * [standard values come FIX tag 39](https://www.fixtrading.org/online-specification/order-state-changes).
144
+ */
145
+ status:
146
+ | 'new'
147
+ | 'partially-filled'
148
+ | 'filled'
149
+ | 'canceled'
150
+ | 'replaced'
151
+ | 'pending-cancel'
152
+ | 'stopped'
153
+ | 'rejected'
154
+ | 'suspended'
155
+ | 'pending-new'
156
+ | 'calculated'
157
+ | 'expired'
158
+ | 'accepted-for-bidding'
159
+ | 'pending-replace'
160
+ | 'done-for-day';
161
+
162
+ /**
163
+ * Strategy type used for execution, can be one of below. Note, we use sensible
164
+ * defaults for strategy parameters at the moment. In future, we will provide a way
165
+ * to provide specify these parameters.
166
+ *
167
+ * - `sor`: Smart order router
168
+ * - `dark`: Dark pool
169
+ * - `ap`: Arrival price
170
+ * - `pov`: Percentage of volume
171
+ * - `twap`: Time weighted average price
172
+ * - `vwap`: Volume weighted average price
173
+ *
174
+ * For more information on these strategies, please refer to our
175
+ * [documentation](https://docs.clearstreet.io/studio/docs/execution-strategies).
176
+ */
177
+ strategy_type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap';
178
+
179
+ symbol: string;
180
+
181
+ /**
182
+ * The lifecycle enforcement of this order.
183
+ *
184
+ * - `day`: The order will exist for the duration of the current trading session
185
+ * - `ioc`: The order will immediately be executed or cancelled
186
+ * - `day-plus`: The order will exist only for the duration the current trading
187
+ * session plus extended hours, if applicable
188
+ * - `at-open`: The order will exist only for the opening auction of the next
189
+ * session
190
+ * - `at-close`: The order will exist only for the closing auction of the current
191
+ * session
192
+ */
193
+ time_in_force: 'day' | 'ioc' | 'day-plus' | 'at-open' | 'at-close';
194
+
195
+ /**
196
+ * When the order was updated in milliseconds since epoch.
197
+ */
198
+ updated_at: number;
199
+
200
+ /**
201
+ * A monotonically increasing number indicating the version of this order. A higher
202
+ * number indicates a more recent version of the order.
203
+ */
204
+ version: number;
205
+
206
+ /**
207
+ * Calculated average price of all fills on this order.
208
+ */
209
+ average_price?: number;
210
+
211
+ /**
212
+ * The last reason why this order was updated
213
+ */
214
+ order_update_reason?: 'place' | 'modify' | 'cancel' | 'execution-report' | 'cancel-reject';
215
+
216
+ /**
217
+ * The requsted limit price on this order.
218
+ */
219
+ price?: string;
220
+
221
+ /**
222
+ * The ID you provided when creating this order.
223
+ */
224
+ reference_id?: string;
225
+
226
+ /**
227
+ * Free form text typically contains reasons for a reject.
228
+ */
229
+ text?: string;
230
+ }
231
+
232
+ export interface PnlSummaryForAccount extends EntitiesAPI.PnlSummary {
233
+ /**
234
+ * Account ID
235
+ */
236
+ account_id: string;
237
+ }
238
+
239
+ export interface Position {
240
+ /**
241
+ * Account ID for the account.
242
+ */
243
+ account_id?: string;
244
+
245
+ /**
246
+ * String representation of quantity.
247
+ */
248
+ quantity?: string;
249
+
250
+ symbol?: string;
251
+ }
252
+
253
+ export interface RegtMarginSimulation {
254
+ /**
255
+ * The margin calculation after applying simulated trades.
256
+ */
257
+ after: EntitiesAPI.RegtMargin;
258
+
259
+ /**
260
+ * The margin calculation before applying simulated trades.
261
+ */
262
+ before: EntitiesAPI.RegtMargin;
263
+
264
+ /**
265
+ * Timestamp of when this simulation was created.
266
+ */
267
+ created_at: number;
268
+
269
+ /**
270
+ * Name of this simulation that you provided when creating it.
271
+ */
272
+ name: string;
273
+
274
+ /**
275
+ * Unique ID for a simulation.
276
+ */
277
+ simulation_id: RegtMarginSimulationsAPI.SimulationID;
278
+ }
279
+
280
+ export interface Trade {
281
+ /**
282
+ * When this trade happened in milliseconds since epoch.
283
+ */
284
+ created_at: number;
285
+
286
+ /**
287
+ * The order ID of the order this trade occurred on.
288
+ */
289
+ order_id: string;
290
+
291
+ /**
292
+ * The traded price.
293
+ */
294
+ price: string;
295
+
296
+ /**
297
+ * The amount that was traded.
298
+ */
299
+ quantity: string;
300
+
301
+ /**
302
+ * The side this trade occurred on.
303
+ */
304
+ side: 'buy' | 'sell' | 'sell-short';
305
+
306
+ /**
307
+ * Unique trade ID assigned by us.
308
+ */
309
+ trade_id: string;
310
+
311
+ /**
312
+ * Account ID for the account.
313
+ */
314
+ account_id?: string;
315
+
316
+ /**
317
+ * The symbol this trade was for.
318
+ */
319
+ symbol?: string;
320
+ }
@@ -0,0 +1,50 @@
1
+ // @ts-ignore
2
+ import * as types from '../_shims/node-types';
3
+ import { setShims } from '../_shims/registry';
4
+ import { getRuntime } from '../_shims/node-runtime';
5
+ setShims(getRuntime());
6
+
7
+ declare module '../_shims/manual-types' {
8
+ export namespace manual {
9
+ // @ts-ignore
10
+ export type Agent = types.Agent;
11
+ // @ts-ignore
12
+ export import fetch = types.fetch;
13
+ // @ts-ignore
14
+ export type Request = types.Request;
15
+ // @ts-ignore
16
+ export type RequestInfo = types.RequestInfo;
17
+ // @ts-ignore
18
+ export type RequestInit = types.RequestInit;
19
+ // @ts-ignore
20
+ export type Response = types.Response;
21
+ // @ts-ignore
22
+ export type ResponseInit = types.ResponseInit;
23
+ // @ts-ignore
24
+ export type ResponseType = types.ResponseType;
25
+ // @ts-ignore
26
+ export type BodyInit = types.BodyInit;
27
+ // @ts-ignore
28
+ export type Headers = types.Headers;
29
+ // @ts-ignore
30
+ export type HeadersInit = types.HeadersInit;
31
+ // @ts-ignore
32
+ export type BlobPropertyBag = types.BlobPropertyBag;
33
+ // @ts-ignore
34
+ export type FilePropertyBag = types.FilePropertyBag;
35
+ // @ts-ignore
36
+ export type FileFromPathOptions = types.FileFromPathOptions;
37
+ // @ts-ignore
38
+ export import FormData = types.FormData;
39
+ // @ts-ignore
40
+ export import File = types.File;
41
+ // @ts-ignore
42
+ export import Blob = types.Blob;
43
+ // @ts-ignore
44
+ export type Readable = types.Readable;
45
+ // @ts-ignore
46
+ export type FsReadStream = types.FsReadStream;
47
+ // @ts-ignore
48
+ export import ReadableStream = types.ReadableStream;
49
+ }
50
+ }
@@ -0,0 +1,50 @@
1
+ // @ts-ignore
2
+ import * as types from '../_shims/web-types';
3
+ import { setShims } from '../_shims/registry';
4
+ import { getRuntime } from '../_shims/web-runtime';
5
+ setShims(getRuntime({ manuallyImported: true }));
6
+
7
+ declare module '../_shims/manual-types' {
8
+ export namespace manual {
9
+ // @ts-ignore
10
+ export type Agent = types.Agent;
11
+ // @ts-ignore
12
+ export import fetch = types.fetch;
13
+ // @ts-ignore
14
+ export type Request = types.Request;
15
+ // @ts-ignore
16
+ export type RequestInfo = types.RequestInfo;
17
+ // @ts-ignore
18
+ export type RequestInit = types.RequestInit;
19
+ // @ts-ignore
20
+ export type Response = types.Response;
21
+ // @ts-ignore
22
+ export type ResponseInit = types.ResponseInit;
23
+ // @ts-ignore
24
+ export type ResponseType = types.ResponseType;
25
+ // @ts-ignore
26
+ export type BodyInit = types.BodyInit;
27
+ // @ts-ignore
28
+ export type Headers = types.Headers;
29
+ // @ts-ignore
30
+ export type HeadersInit = types.HeadersInit;
31
+ // @ts-ignore
32
+ export type BlobPropertyBag = types.BlobPropertyBag;
33
+ // @ts-ignore
34
+ export type FilePropertyBag = types.FilePropertyBag;
35
+ // @ts-ignore
36
+ export type FileFromPathOptions = types.FileFromPathOptions;
37
+ // @ts-ignore
38
+ export import FormData = types.FormData;
39
+ // @ts-ignore
40
+ export import File = types.File;
41
+ // @ts-ignore
42
+ export import Blob = types.Blob;
43
+ // @ts-ignore
44
+ export type Readable = types.Readable;
45
+ // @ts-ignore
46
+ export type FsReadStream = types.FsReadStream;
47
+ // @ts-ignore
48
+ export import ReadableStream = types.ReadableStream;
49
+ }
50
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ // this config is included in the published src directory to prevent TS errors
3
+ // from appearing when users go to source, and VSCode opens the source .ts file
4
+ // via declaration maps
5
+ "include": ["index.ts"],
6
+ "compilerOptions": {
7
+ "target": "es2015",
8
+ "lib": ["DOM"],
9
+ "moduleResolution": "node"
10
+ }
11
+ }