snaptrade-typescript-sdk 8.5.0 → 8.7.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/.konfig/generate-id.txt +1 -1
- package/README.md +9 -11
- package/configuration.ts +1 -1
- package/dist/configuration.js +1 -1
- package/dist/models/options-holdings.d.ts +1 -1
- package/dist/models/options-position.d.ts +1 -1
- package/dist/models/position.d.ts +1 -1
- package/dist/models/session-event.d.ts +6 -0
- package/dist/models/symbol.d.ts +7 -0
- package/docs/AccountInformationApi.md +120 -120
- package/docs/ApiDisclaimerApi.md +10 -11
- package/docs/ApiStatusApi.md +8 -9
- package/docs/AuthenticationApi.md +66 -66
- package/docs/ConnectionsApi.md +58 -57
- package/docs/ErrorLogsApi.md +10 -11
- package/docs/OptionsApi.md +80 -82
- package/docs/PortfolioManagementApi.md +433 -434
- package/docs/ReferenceDataApi.md +117 -119
- package/docs/TradingApi.md +152 -156
- package/docs/TransactionsAndReportingApi.md +40 -37
- package/models/options-holdings.ts +1 -1
- package/models/options-position.ts +1 -1
- package/models/position.ts +1 -1
- package/models/session-event.ts +6 -0
- package/models/symbol.ts +9 -0
- package/package.json +1 -1
package/.konfig/generate-id.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
da703192-74cf-4e40-a6e8-b57469e2b225
|
package/README.md
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
Connect brokerage accounts to your app for live positions and trading
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Important note: this library is can be used in both the client-side or server-side, but using it
|
|
6
|
-
in client-side browser code is not recommended as you would expose security credentials.**
|
|
1
|
+
# snaptrade-typescript-sdk@8.7.0
|
|
7
2
|
|
|
8
|
-
|
|
3
|
+
Connect brokerage accounts to your app for live positions and trading
|
|
4
|
+
## Installing
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
### npm
|
|
11
7
|
```
|
|
12
8
|
npm install snaptrade-typescript-sdk --save
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
### yarn
|
|
16
12
|
```
|
|
17
13
|
yarn add snaptrade-typescript-sdk
|
|
18
14
|
```
|
|
19
15
|
|
|
16
|
+
**Important note: this library is can be used in both the client-side or server-side, but using it
|
|
17
|
+
in client-side browser code is not recommended as you would expose security credentials.**
|
|
20
18
|
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
## Getting Started
|
|
23
22
|
|
|
24
23
|
```typescript
|
|
25
24
|
const { Snaptrade } = require("snaptrade-typescript-sdk");
|
|
@@ -94,7 +93,6 @@ function getUserId() {
|
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
main();
|
|
97
|
-
|
|
98
96
|
```
|
|
99
97
|
|
|
100
98
|
## Documentation for API Endpoints
|
package/configuration.ts
CHANGED
|
@@ -110,7 +110,7 @@ export class Configuration {
|
|
|
110
110
|
this.accessToken = param.accessToken;
|
|
111
111
|
this.basePath = param.basePath;
|
|
112
112
|
this.baseOptions = param.baseOptions ?? {};
|
|
113
|
-
this.userAgent = param.userAgent === undefined ? "Konfig/8.
|
|
113
|
+
this.userAgent = param.userAgent === undefined ? "Konfig/8.7.0/typescript" : param.userAgent;
|
|
114
114
|
this.formDataCtor = param.formDataCtor;
|
|
115
115
|
}
|
|
116
116
|
|
package/dist/configuration.js
CHANGED
|
@@ -34,7 +34,7 @@ var Configuration = /** @class */ (function () {
|
|
|
34
34
|
this.accessToken = param.accessToken;
|
|
35
35
|
this.basePath = param.basePath;
|
|
36
36
|
this.baseOptions = (_a = param.baseOptions) !== null && _a !== void 0 ? _a : {};
|
|
37
|
-
this.userAgent = param.userAgent === undefined ? "Konfig/8.
|
|
37
|
+
this.userAgent = param.userAgent === undefined ? "Konfig/8.7.0/typescript" : param.userAgent;
|
|
38
38
|
this.formDataCtor = param.formDataCtor;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -52,6 +52,12 @@ export interface SessionEvent {
|
|
|
52
52
|
* @memberof SessionEvent
|
|
53
53
|
*/
|
|
54
54
|
'brokerage_status_code'?: number | null;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @memberof SessionEvent
|
|
59
|
+
*/
|
|
60
|
+
'brokerage_authorization_id'?: string;
|
|
55
61
|
}
|
|
56
62
|
export declare const SessionEventSessionEventTypeEnum: {
|
|
57
63
|
readonly ConnectionFailed: "CONNECTION_FAILED";
|
package/dist/models/symbol.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { Currency } from './currency';
|
|
13
13
|
import { Exchange } from './exchange';
|
|
14
|
+
import { SecurityType } from './security-type';
|
|
14
15
|
/**
|
|
15
16
|
* Symbol
|
|
16
17
|
* @export
|
|
@@ -54,4 +55,10 @@ export interface Symbol {
|
|
|
54
55
|
* @memberof Symbol
|
|
55
56
|
*/
|
|
56
57
|
'exchange'?: Exchange;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @type {SecurityType}
|
|
61
|
+
* @memberof Symbol
|
|
62
|
+
*/
|
|
63
|
+
'type'?: SecurityType;
|
|
57
64
|
}
|
|
@@ -23,23 +23,23 @@ Method | HTTP request | Description
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
26
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
27
27
|
|
|
28
28
|
const snaptrade = new Snaptrade({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const getAllUserHoldingsResponse =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
30
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
31
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
32
|
+
clientId: "YOUR_CLIENT_ID",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const getAllUserHoldingsResponse =
|
|
36
|
+
await snaptrade.accountInformation.getAllUserHoldings({
|
|
37
|
+
userId: "John.doe@snaptrade.com",
|
|
38
|
+
userSecret: "USERSECRET123",
|
|
39
|
+
brokerageAuthorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
console.log(getAllUserHoldingsResponse);
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
|
|
@@ -81,23 +81,23 @@ Name | Type | Description | Notes
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
```typescript
|
|
84
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
84
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
85
85
|
|
|
86
86
|
const snaptrade = new Snaptrade({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const getUserAccountBalanceResponse =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
88
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
89
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
90
|
+
clientId: "YOUR_CLIENT_ID",
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const getUserAccountBalanceResponse =
|
|
94
|
+
await snaptrade.accountInformation.getUserAccountBalance({
|
|
95
|
+
userId: "John.doe@snaptrade.com",
|
|
96
|
+
userSecret: "USERSECRET123",
|
|
97
|
+
accountId: "accountId_example",
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
console.log(getUserAccountBalanceResponse);
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
|
|
@@ -137,23 +137,23 @@ Name | Type | Description | Notes
|
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
```typescript
|
|
140
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
140
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
141
141
|
|
|
142
142
|
const snaptrade = new Snaptrade({
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
const getUserAccountDetailsResponse =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
143
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
144
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
145
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
146
|
+
clientId: "YOUR_CLIENT_ID",
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const getUserAccountDetailsResponse =
|
|
150
|
+
await snaptrade.accountInformation.getUserAccountDetails({
|
|
151
|
+
userId: "John.doe@snaptrade.com",
|
|
152
|
+
userSecret: "USERSECRET123",
|
|
153
|
+
accountId: "accountId_example",
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
console.log(getUserAccountDetailsResponse);
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
|
|
@@ -193,24 +193,24 @@ Name | Type | Description | Notes
|
|
|
193
193
|
|
|
194
194
|
|
|
195
195
|
```typescript
|
|
196
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
196
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
197
197
|
|
|
198
198
|
const snaptrade = new Snaptrade({
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
const getUserAccountOrdersResponse =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
199
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
200
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
201
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
202
|
+
clientId: "YOUR_CLIENT_ID",
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const getUserAccountOrdersResponse =
|
|
206
|
+
await snaptrade.accountInformation.getUserAccountOrders({
|
|
207
|
+
userId: "John.doe@snaptrade.com",
|
|
208
|
+
userSecret: "USERSECRET123",
|
|
209
|
+
state: "all",
|
|
210
|
+
accountId: "accountId_example",
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
console.log(getUserAccountOrdersResponse);
|
|
214
214
|
```
|
|
215
215
|
|
|
216
216
|
|
|
@@ -251,23 +251,23 @@ Name | Type | Description | Notes
|
|
|
251
251
|
|
|
252
252
|
|
|
253
253
|
```typescript
|
|
254
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
254
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
255
255
|
|
|
256
256
|
const snaptrade = new Snaptrade({
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
const getUserAccountPositionsResponse =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
257
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
258
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
259
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
260
|
+
clientId: "YOUR_CLIENT_ID",
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
const getUserAccountPositionsResponse =
|
|
264
|
+
await snaptrade.accountInformation.getUserAccountPositions({
|
|
265
|
+
userId: "John.doe@snaptrade.com",
|
|
266
|
+
userSecret: "USERSECRET123",
|
|
267
|
+
accountId: "accountId_example",
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
console.log(getUserAccountPositionsResponse);
|
|
271
271
|
```
|
|
272
272
|
|
|
273
273
|
|
|
@@ -307,23 +307,23 @@ Name | Type | Description | Notes
|
|
|
307
307
|
|
|
308
308
|
|
|
309
309
|
```typescript
|
|
310
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
310
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
311
311
|
|
|
312
312
|
const snaptrade = new Snaptrade({
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
const getUserHoldingsResponse =
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
313
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
314
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
315
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
316
|
+
clientId: "YOUR_CLIENT_ID",
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
const getUserHoldingsResponse =
|
|
320
|
+
await snaptrade.accountInformation.getUserHoldings({
|
|
321
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
322
|
+
userId: "John.doe@snaptrade.com",
|
|
323
|
+
userSecret: "USERSECRET123",
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
console.log(getUserHoldingsResponse);
|
|
327
327
|
```
|
|
328
328
|
|
|
329
329
|
|
|
@@ -365,22 +365,22 @@ Name | Type | Description | Notes
|
|
|
365
365
|
|
|
366
366
|
|
|
367
367
|
```typescript
|
|
368
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
368
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
369
369
|
|
|
370
370
|
const snaptrade = new Snaptrade({
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
const listUserAccountsResponse =
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
371
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
372
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
373
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
374
|
+
clientId: "YOUR_CLIENT_ID",
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
const listUserAccountsResponse =
|
|
378
|
+
await snaptrade.accountInformation.listUserAccounts({
|
|
379
|
+
userId: "John.doe@snaptrade.com",
|
|
380
|
+
userSecret: "USERSECRET123",
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
console.log(listUserAccountsResponse);
|
|
384
384
|
```
|
|
385
385
|
|
|
386
386
|
|
|
@@ -419,23 +419,23 @@ Name | Type | Description | Notes
|
|
|
419
419
|
|
|
420
420
|
|
|
421
421
|
```typescript
|
|
422
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
422
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
423
423
|
|
|
424
424
|
const snaptrade = new Snaptrade({
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
})
|
|
430
|
-
|
|
431
|
-
const updateUserAccountResponse =
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
425
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
426
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
427
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
428
|
+
clientId: "YOUR_CLIENT_ID",
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
const updateUserAccountResponse =
|
|
432
|
+
await snaptrade.accountInformation.updateUserAccount({
|
|
433
|
+
userId: "John.doe@snaptrade.com",
|
|
434
|
+
userSecret: "USERSECRET123",
|
|
435
|
+
accountId: "accountId_example",
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
console.log(updateUserAccountResponse);
|
|
439
439
|
```
|
|
440
440
|
|
|
441
441
|
|
package/docs/ApiDisclaimerApi.md
CHANGED
|
@@ -16,22 +16,21 @@ Method | HTTP request | Description
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
19
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
20
20
|
|
|
21
21
|
const snaptrade = new Snaptrade({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
22
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
23
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
24
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
25
|
+
clientId: "YOUR_CLIENT_ID",
|
|
26
|
+
});
|
|
27
27
|
|
|
28
28
|
const acceptResponse = await snaptrade.apiDisclaimer.accept({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log(acceptResponse)
|
|
29
|
+
userId: "John.doe@snaptrade.com",
|
|
30
|
+
userSecret: "USERSECRET123",
|
|
31
|
+
});
|
|
34
32
|
|
|
33
|
+
console.log(acceptResponse);
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
|
package/docs/ApiStatusApi.md
CHANGED
|
@@ -18,19 +18,18 @@ Check whether the API is operational and verify timestamps.
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
|
-
import { Snaptrade } from "snaptrade-typescript-sdk"
|
|
21
|
+
import { Snaptrade } from "snaptrade-typescript-sdk";
|
|
22
22
|
|
|
23
23
|
const snaptrade = new Snaptrade({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
24
|
+
// Defining the base path is optional and defaults to https://api.snaptrade.com/api/v1
|
|
25
|
+
// basePath: "https://api.snaptrade.com/api/v1",
|
|
26
|
+
consumerKey: "YOUR_CONSUMER_KEY",
|
|
27
|
+
clientId: "YOUR_CLIENT_ID",
|
|
28
|
+
});
|
|
29
29
|
|
|
30
|
-
const checkResponse = await snaptrade.apiStatus.check()
|
|
31
|
-
|
|
32
|
-
console.log(checkResponse)
|
|
30
|
+
const checkResponse = await snaptrade.apiStatus.check();
|
|
33
31
|
|
|
32
|
+
console.log(checkResponse);
|
|
34
33
|
```
|
|
35
34
|
|
|
36
35
|
|