@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.
- package/CHANGELOG.md +47 -0
- package/LICENSE +201 -0
- package/README.md +288 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +90 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +239 -0
- package/core.d.ts.map +1 -0
- package/core.js +881 -0
- package/core.js.map +1 -0
- package/core.mjs +850 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +53 -0
- package/error.d.ts.map +1 -0
- package/error.js +143 -0
- package/error.js.map +1 -0
- package/error.mjs +127 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +128 -0
- package/index.d.ts +128 -0
- package/index.d.ts.map +1 -0
- package/index.js +112 -0
- package/index.js.map +1 -0
- package/index.mjs +84 -0
- package/index.mjs.map +1 -0
- package/package.json +104 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/accounts/accounts.d.ts +74 -0
- package/resources/accounts/accounts.d.ts.map +1 -0
- package/resources/accounts/accounts.js +73 -0
- package/resources/accounts/accounts.js.map +1 -0
- package/resources/accounts/accounts.mjs +46 -0
- package/resources/accounts/accounts.mjs.map +1 -0
- package/resources/accounts/bulk-orders.d.ts +137 -0
- package/resources/accounts/bulk-orders.d.ts.map +1 -0
- package/resources/accounts/bulk-orders.js +29 -0
- package/resources/accounts/bulk-orders.js.map +1 -0
- package/resources/accounts/bulk-orders.mjs +25 -0
- package/resources/accounts/bulk-orders.mjs.map +1 -0
- package/resources/accounts/easy-borrows.d.ts +17 -0
- package/resources/accounts/easy-borrows.d.ts.map +1 -0
- package/resources/accounts/easy-borrows.js +18 -0
- package/resources/accounts/easy-borrows.js.map +1 -0
- package/resources/accounts/easy-borrows.mjs +14 -0
- package/resources/accounts/easy-borrows.mjs.map +1 -0
- package/resources/accounts/index.d.ts +10 -0
- package/resources/accounts/index.d.ts.map +1 -0
- package/resources/accounts/index.js +23 -0
- package/resources/accounts/index.js.map +1 -0
- package/resources/accounts/index.mjs +11 -0
- package/resources/accounts/index.mjs.map +1 -0
- package/resources/accounts/locate-orders.d.ts +56 -0
- package/resources/accounts/locate-orders.d.ts.map +1 -0
- package/resources/accounts/locate-orders.js +39 -0
- package/resources/accounts/locate-orders.js.map +1 -0
- package/resources/accounts/locate-orders.mjs +35 -0
- package/resources/accounts/locate-orders.mjs.map +1 -0
- package/resources/accounts/orders.d.ts +168 -0
- package/resources/accounts/orders.d.ts.map +1 -0
- package/resources/accounts/orders.js +53 -0
- package/resources/accounts/orders.js.map +1 -0
- package/resources/accounts/orders.mjs +49 -0
- package/resources/accounts/orders.mjs.map +1 -0
- package/resources/accounts/pnl-details.d.ts +113 -0
- package/resources/accounts/pnl-details.d.ts.map +1 -0
- package/resources/accounts/pnl-details.js +17 -0
- package/resources/accounts/pnl-details.js.map +1 -0
- package/resources/accounts/pnl-details.mjs +13 -0
- package/resources/accounts/pnl-details.mjs.map +1 -0
- package/resources/accounts/pnl-summary.d.ts +10 -0
- package/resources/accounts/pnl-summary.d.ts.map +1 -0
- package/resources/accounts/pnl-summary.js +15 -0
- package/resources/accounts/pnl-summary.js.map +1 -0
- package/resources/accounts/pnl-summary.mjs +11 -0
- package/resources/accounts/pnl-summary.mjs.map +1 -0
- package/resources/accounts/positions.d.ts +37 -0
- package/resources/accounts/positions.d.ts.map +1 -0
- package/resources/accounts/positions.js +24 -0
- package/resources/accounts/positions.js.map +1 -0
- package/resources/accounts/positions.mjs +20 -0
- package/resources/accounts/positions.mjs.map +1 -0
- package/resources/accounts/trades.d.ts +37 -0
- package/resources/accounts/trades.d.ts.map +1 -0
- package/resources/accounts/trades.js +24 -0
- package/resources/accounts/trades.js.map +1 -0
- package/resources/accounts/trades.mjs +20 -0
- package/resources/accounts/trades.mjs.map +1 -0
- package/resources/entities/entities.d.ts +458 -0
- package/resources/entities/entities.d.ts.map +1 -0
- package/resources/entities/entities.js +61 -0
- package/resources/entities/entities.js.map +1 -0
- package/resources/entities/entities.mjs +34 -0
- package/resources/entities/entities.mjs.map +1 -0
- package/resources/entities/index.d.ts +6 -0
- package/resources/entities/index.d.ts.map +1 -0
- package/resources/entities/index.js +15 -0
- package/resources/entities/index.js.map +1 -0
- package/resources/entities/index.mjs +7 -0
- package/resources/entities/index.mjs.map +1 -0
- package/resources/entities/pnl-summaries.d.ts +10 -0
- package/resources/entities/pnl-summaries.d.ts.map +1 -0
- package/resources/entities/pnl-summaries.js +15 -0
- package/resources/entities/pnl-summaries.js.map +1 -0
- package/resources/entities/pnl-summaries.mjs +11 -0
- package/resources/entities/pnl-summaries.mjs.map +1 -0
- package/resources/entities/portfolio-margins.d.ts +10 -0
- package/resources/entities/portfolio-margins.d.ts.map +1 -0
- package/resources/entities/portfolio-margins.js +15 -0
- package/resources/entities/portfolio-margins.js.map +1 -0
- package/resources/entities/portfolio-margins.mjs +11 -0
- package/resources/entities/portfolio-margins.mjs.map +1 -0
- package/resources/entities/regt-margin-simulations.d.ts +97 -0
- package/resources/entities/regt-margin-simulations.d.ts.map +1 -0
- package/resources/entities/regt-margin-simulations.js +30 -0
- package/resources/entities/regt-margin-simulations.js.map +1 -0
- package/resources/entities/regt-margin-simulations.mjs +26 -0
- package/resources/entities/regt-margin-simulations.mjs.map +1 -0
- package/resources/entities/regt-margins.d.ts +10 -0
- package/resources/entities/regt-margins.d.ts.map +1 -0
- package/resources/entities/regt-margins.js +15 -0
- package/resources/entities/regt-margins.js.map +1 -0
- package/resources/entities/regt-margins.mjs +11 -0
- package/resources/entities/regt-margins.mjs.map +1 -0
- package/resources/index.d.ts +5 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +26 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +6 -0
- package/resources/index.mjs.map +1 -0
- package/resources/instruments.d.ts +45 -0
- package/resources/instruments.d.ts.map +1 -0
- package/resources/instruments.js +18 -0
- package/resources/instruments.js.map +1 -0
- package/resources/instruments.mjs +14 -0
- package/resources/instruments.mjs.map +1 -0
- package/resources/shared.d.ts +251 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/shims/node.d.ts +29 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +83 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1165 -0
- package/src/error.ts +146 -0
- package/src/index.ts +206 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/accounts/accounts.ts +87 -0
- package/src/resources/accounts/bulk-orders.ts +163 -0
- package/src/resources/accounts/easy-borrows.ts +23 -0
- package/src/resources/accounts/index.ts +25 -0
- package/src/resources/accounts/locate-orders.ts +94 -0
- package/src/resources/accounts/orders.ts +246 -0
- package/src/resources/accounts/pnl-details.ts +143 -0
- package/src/resources/accounts/pnl-summary.ts +14 -0
- package/src/resources/accounts/positions.ts +66 -0
- package/src/resources/accounts/trades.ts +62 -0
- package/src/resources/entities/entities.ts +562 -0
- package/src/resources/entities/index.ts +12 -0
- package/src/resources/entities/pnl-summaries.ts +14 -0
- package/src/resources/entities/portfolio-margins.ts +14 -0
- package/src/resources/entities/regt-margin-simulations.ts +127 -0
- package/src/resources/entities/regt-margins.ts +14 -0
- package/src/resources/index.ts +13 -0
- package/src/resources/instruments.ts +70 -0
- package/src/resources/shared.ts +320 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +248 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +165 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +152 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- 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
|
+
}
|
package/src/shims/web.ts
ADDED
|
@@ -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
|
+
}
|