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.
@@ -1 +1 @@
1
- 23c52a19-6df6-49be-bcc9-c9a1f0602b2c
1
+ da703192-74cf-4e40-a6e8-b57469e2b225
package/README.md CHANGED
@@ -1,25 +1,24 @@
1
- ## snaptrade-typescript-sdk@8.5.0
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
- ### Installing
3
+ Connect brokerage accounts to your app for live positions and trading
4
+ ## Installing
9
5
 
10
- #### npm
6
+ ### npm
11
7
  ```
12
8
  npm install snaptrade-typescript-sdk --save
13
9
  ```
14
10
 
15
- #### yarn
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
- ### Getting Started
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.5.0/typescript" : param.userAgent;
113
+ this.userAgent = param.userAgent === undefined ? "Konfig/8.7.0/typescript" : param.userAgent;
114
114
  this.formDataCtor = param.formDataCtor;
115
115
  }
116
116
 
@@ -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.5.0/typescript" : param.userAgent;
37
+ this.userAgent = param.userAgent === undefined ? "Konfig/8.7.0/typescript" : param.userAgent;
38
38
  this.formDataCtor = param.formDataCtor;
39
39
  }
40
40
  /**
@@ -53,5 +53,5 @@ export interface OptionsHoldings {
53
53
  * @type {number}
54
54
  * @memberof OptionsHoldings
55
55
  */
56
- 'average_purchase_price'?: number;
56
+ 'average_purchase_price'?: number | null;
57
57
  }
@@ -59,5 +59,5 @@ export interface OptionsPosition {
59
59
  * @type {number}
60
60
  * @memberof OptionsPosition
61
61
  */
62
- 'average_purchase_price'?: number;
62
+ 'average_purchase_price'?: number | null;
63
63
  }
@@ -52,5 +52,5 @@ export interface Position {
52
52
  * @type {number}
53
53
  * @memberof Position
54
54
  */
55
- 'average_purchase_price'?: number;
55
+ 'average_purchase_price'?: number | null;
56
56
  }
@@ -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";
@@ -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
- // 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 = await snaptrade.accountInformation.getAllUserHoldings({
36
- "userId": "John.doe@snaptrade.com",
37
- "userSecret": "USERSECRET123",
38
- "brokerageAuthorizations": "917c8734-8470-4a3e-a18f-57c3f2ee6631",
39
- })
40
-
41
- console.log(getAllUserHoldingsResponse)
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
- // 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 = await snaptrade.accountInformation.getUserAccountBalance({
94
- "userId": "John.doe@snaptrade.com",
95
- "userSecret": "USERSECRET123",
96
- "accountId": "accountId_example",
97
- })
98
-
99
- console.log(getUserAccountBalanceResponse)
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
- // 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 = await snaptrade.accountInformation.getUserAccountDetails({
150
- "userId": "John.doe@snaptrade.com",
151
- "userSecret": "USERSECRET123",
152
- "accountId": "accountId_example",
153
- })
154
-
155
- console.log(getUserAccountDetailsResponse)
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
- // 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 = await snaptrade.accountInformation.getUserAccountOrders({
206
- "userId": "John.doe@snaptrade.com",
207
- "userSecret": "USERSECRET123",
208
- "state": "all",
209
- "accountId": "accountId_example",
210
- })
211
-
212
- console.log(getUserAccountOrdersResponse)
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
- // 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 = await snaptrade.accountInformation.getUserAccountPositions({
264
- "userId": "John.doe@snaptrade.com",
265
- "userSecret": "USERSECRET123",
266
- "accountId": "accountId_example",
267
- })
268
-
269
- console.log(getUserAccountPositionsResponse)
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
- // 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 = await snaptrade.accountInformation.getUserHoldings({
320
- "accountId": "917c8734-8470-4a3e-a18f-57c3f2ee6631",
321
- "userId": "John.doe@snaptrade.com",
322
- "userSecret": "USERSECRET123",
323
- })
324
-
325
- console.log(getUserHoldingsResponse)
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
- // 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 = await snaptrade.accountInformation.listUserAccounts({
378
- "userId": "John.doe@snaptrade.com",
379
- "userSecret": "USERSECRET123",
380
- })
381
-
382
- console.log(listUserAccountsResponse)
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
- // 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 = await snaptrade.accountInformation.updateUserAccount({
432
- "userId": "John.doe@snaptrade.com",
433
- "userSecret": "USERSECRET123",
434
- "accountId": "accountId_example",
435
- })
436
-
437
- console.log(updateUserAccountResponse)
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
 
@@ -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
- // 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
- })
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
- "userId": "John.doe@snaptrade.com",
30
- "userSecret": "USERSECRET123",
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
 
@@ -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
- // 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
- })
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