snaptrade-typescript-sdk 10.0.4 → 11.0.0-canary.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/README.md +48 -364
- package/dist/index.cjs +3506 -1608
- package/dist/index.d.cts +1 -10806
- package/dist/index.d.mts +1723 -1336
- package/dist/index.d.ts +1 -10806
- package/dist/index.mjs +3433 -1540
- package/package.json +1 -6
- package/dist/index.browser.mjs +0 -10336
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
|
8
8
|
|
|
9
|
-
[](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/11.0.0-canary.0)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -124,15 +124,15 @@ yarn add snaptrade-typescript-sdk
|
|
|
124
124
|
## Getting Started<a id="getting-started"></a>
|
|
125
125
|
|
|
126
126
|
```typescript
|
|
127
|
-
const { Snaptrade } = require("snaptrade-typescript-sdk");
|
|
128
|
-
const { randomUUID } = require("crypto");
|
|
129
|
-
const readline = require("readline");
|
|
127
|
+
const { Snaptrade, SnaptradeAuth } = require("snaptrade-typescript-sdk");
|
|
130
128
|
|
|
131
129
|
async function main() {
|
|
132
130
|
// 1) Initialize a client with your clientID and consumerKey.
|
|
133
131
|
const snaptrade = new Snaptrade({
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
auth: SnaptradeAuth.commercialApiKey({
|
|
133
|
+
consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
|
|
134
|
+
clientId: process.env.SNAPTRADE_CLIENT_ID,
|
|
135
|
+
}),
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
// 2) Check that the client is able to make a request to the API server.
|
|
@@ -140,51 +140,32 @@ async function main() {
|
|
|
140
140
|
console.log("status:", status.data);
|
|
141
141
|
|
|
142
142
|
// 3) Create a new user on SnapTrade
|
|
143
|
-
const userId =
|
|
144
|
-
const
|
|
143
|
+
const userId = uuid();
|
|
144
|
+
const { userSecret } = (
|
|
145
145
|
await snaptrade.authentication.registerSnapTradeUser({
|
|
146
146
|
userId,
|
|
147
147
|
})
|
|
148
148
|
).data;
|
|
149
|
-
console.log("registerResponse:", registerResponse);
|
|
150
149
|
|
|
151
150
|
// Note: A user secret is only generated once. It's required to access
|
|
152
151
|
// resources for certain endpoints.
|
|
153
|
-
|
|
152
|
+
console.log("userSecret:", userSecret);
|
|
154
153
|
|
|
155
154
|
// 4) Get a redirect URI. Users will need this to connect
|
|
156
|
-
|
|
157
|
-
const redirectURI = (
|
|
155
|
+
const data = (
|
|
158
156
|
await snaptrade.authentication.loginSnapTradeUser({ userId, userSecret })
|
|
159
157
|
).data;
|
|
160
|
-
|
|
158
|
+
if (!("redirectURI" in data)) throw Error("Should have gotten redirect URI");
|
|
159
|
+
console.log("redirectURI:", data.redirectURI);
|
|
161
160
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// 5) Get a list of connections
|
|
167
|
-
const connections = (
|
|
168
|
-
await snaptrade.connections.listBrokerageAuthorizations({
|
|
161
|
+
// 5) Obtaining account holdings data
|
|
162
|
+
const holdings = (
|
|
163
|
+
await snaptrade.accountInformation.getAllUserHoldings({
|
|
169
164
|
userId,
|
|
170
165
|
userSecret,
|
|
171
166
|
})
|
|
172
167
|
).data;
|
|
173
|
-
console.log("
|
|
174
|
-
|
|
175
|
-
// 6) Get a list of accounts for the first connection, if available
|
|
176
|
-
if (!Array.isArray(connections) || connections.length === 0) {
|
|
177
|
-
console.log("No brokerage connections found for the user.");
|
|
178
|
-
} else {
|
|
179
|
-
const accounts = (
|
|
180
|
-
await snaptrade.connections.listBrokerageAuthorizationAccounts({
|
|
181
|
-
authorizationId: connections[0].id,
|
|
182
|
-
userId,
|
|
183
|
-
userSecret,
|
|
184
|
-
})
|
|
185
|
-
).data;
|
|
186
|
-
console.log("accounts:", accounts);
|
|
187
|
-
}
|
|
168
|
+
console.log("holdings:", holdings);
|
|
188
169
|
|
|
189
170
|
// 6) Deleting a user
|
|
190
171
|
const deleteResponse = (
|
|
@@ -193,17 +174,26 @@ async function main() {
|
|
|
193
174
|
console.log("deleteResponse:", deleteResponse);
|
|
194
175
|
}
|
|
195
176
|
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
177
|
+
// Should be replaced with function to get user ID
|
|
178
|
+
function getUserId() {
|
|
179
|
+
var d = new Date().getTime(); //Timestamp
|
|
180
|
+
var d2 =
|
|
181
|
+
(typeof performance !== "undefined" &&
|
|
182
|
+
performance.now &&
|
|
183
|
+
performance.now() * 1000) ||
|
|
184
|
+
0; //Time in microseconds since page-load or 0 if unsupported
|
|
185
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
186
|
+
var r = Math.random() * 16; //random number between 0 and 16
|
|
187
|
+
if (d > 0) {
|
|
188
|
+
//Use timestamp until depleted
|
|
189
|
+
r = (d + r) % 16 | 0;
|
|
190
|
+
d = Math.floor(d / 16);
|
|
191
|
+
} else {
|
|
192
|
+
//Use microseconds since page-load if supported
|
|
193
|
+
r = (d2 + r) % 16 | 0;
|
|
194
|
+
d2 = Math.floor(d2 / 16);
|
|
195
|
+
}
|
|
196
|
+
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
|
207
197
|
});
|
|
208
198
|
}
|
|
209
199
|
|
|
@@ -232,11 +222,9 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
232
222
|
const getAccountActivitiesResponse =
|
|
233
223
|
await snaptrade.accountInformation.getAccountActivities({
|
|
234
224
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
235
|
-
startDate: "2022-01-
|
|
236
|
-
endDate: "2022-01-
|
|
225
|
+
startDate: "2022-01-24T00:00:00.000Z",
|
|
226
|
+
endDate: "2022-01-24T00:00:00.000Z",
|
|
237
227
|
type: "BUY,SELL,DIVIDEND",
|
|
238
|
-
userId: "snaptrade-user-123",
|
|
239
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
240
228
|
});
|
|
241
229
|
```
|
|
242
230
|
|
|
@@ -244,10 +232,6 @@ const getAccountActivitiesResponse =
|
|
|
244
232
|
|
|
245
233
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
246
234
|
|
|
247
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
248
|
-
|
|
249
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
250
|
-
|
|
251
235
|
##### startDate: `string | Date`<a id="startdate-string--date"></a>
|
|
252
236
|
|
|
253
237
|
The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
|
|
@@ -291,18 +275,12 @@ An experimental endpoint that returns estimated historical total account value f
|
|
|
291
275
|
```typescript
|
|
292
276
|
const getAccountBalanceHistoryResponse =
|
|
293
277
|
await snaptrade.accountInformation.getAccountBalanceHistory({
|
|
294
|
-
userId: "snaptrade-user-123",
|
|
295
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
296
278
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
297
279
|
});
|
|
298
280
|
```
|
|
299
281
|
|
|
300
282
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
301
283
|
|
|
302
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
303
|
-
|
|
304
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
305
|
-
|
|
306
284
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
307
285
|
|
|
308
286
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -322,7 +300,7 @@ const getAccountBalanceHistoryResponse =
|
|
|
322
300
|
|
|
323
301
|
Returns a list of all positions in the specified account.
|
|
324
302
|
|
|
325
|
-
The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and
|
|
303
|
+
The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, option positions, and CFD positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
326
304
|
|
|
327
305
|
`mutualfund` positions may also include `cash_equivalent`. `stock` positions may include `tax_lots` when tax lot data is enabled for the account.
|
|
328
306
|
|
|
@@ -334,18 +312,12 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
334
312
|
```typescript
|
|
335
313
|
const getAllAccountPositionsResponse =
|
|
336
314
|
await snaptrade.accountInformation.getAllAccountPositions({
|
|
337
|
-
userId: "snaptrade-user-123",
|
|
338
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
339
315
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
340
316
|
});
|
|
341
317
|
```
|
|
342
318
|
|
|
343
319
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
344
320
|
|
|
345
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
346
|
-
|
|
347
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
348
|
-
|
|
349
321
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
350
322
|
|
|
351
323
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -377,18 +349,12 @@ account.
|
|
|
377
349
|
```typescript
|
|
378
350
|
const getAllUserHoldingsResponse =
|
|
379
351
|
await snaptrade.accountInformation.getAllUserHoldings({
|
|
380
|
-
userId: "snaptrade-user-123",
|
|
381
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
382
352
|
brokerageAuthorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
383
353
|
});
|
|
384
354
|
```
|
|
385
355
|
|
|
386
356
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
387
357
|
|
|
388
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
389
|
-
|
|
390
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
391
|
-
|
|
392
358
|
##### brokerageAuthorizations: `string`<a id="brokerageauthorizations-string"></a>
|
|
393
359
|
|
|
394
360
|
Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations).
|
|
@@ -422,18 +388,12 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
422
388
|
```typescript
|
|
423
389
|
const getUserAccountBalanceResponse =
|
|
424
390
|
await snaptrade.accountInformation.getUserAccountBalance({
|
|
425
|
-
userId: "snaptrade-user-123",
|
|
426
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
427
391
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
428
392
|
});
|
|
429
393
|
```
|
|
430
394
|
|
|
431
395
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
432
396
|
|
|
433
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
434
|
-
|
|
435
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
436
|
-
|
|
437
397
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
438
398
|
|
|
439
399
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -465,18 +425,12 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
465
425
|
```typescript
|
|
466
426
|
const getUserAccountDetailsResponse =
|
|
467
427
|
await snaptrade.accountInformation.getUserAccountDetails({
|
|
468
|
-
userId: "snaptrade-user-123",
|
|
469
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
470
428
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
471
429
|
});
|
|
472
430
|
```
|
|
473
431
|
|
|
474
432
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
475
433
|
|
|
476
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
477
|
-
|
|
478
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
479
|
-
|
|
480
434
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
481
435
|
|
|
482
436
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -509,8 +463,6 @@ This endpoint only returns orders placed through SnapTrade. In other words, orde
|
|
|
509
463
|
const getUserAccountOrderDetailResponse =
|
|
510
464
|
await snaptrade.accountInformation.getUserAccountOrderDetail({
|
|
511
465
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
512
|
-
userId: "snaptrade-user-123",
|
|
513
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
514
466
|
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
515
467
|
});
|
|
516
468
|
```
|
|
@@ -523,10 +475,6 @@ Order ID returned by brokerage. This is the unique identifier for the order in t
|
|
|
523
475
|
|
|
524
476
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
525
477
|
|
|
526
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
527
|
-
|
|
528
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
529
|
-
|
|
530
478
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
531
479
|
|
|
532
480
|
[AccountOrderRecord](./models/account-order-record.ts)
|
|
@@ -556,8 +504,6 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
556
504
|
```typescript
|
|
557
505
|
const getUserAccountOrdersResponse =
|
|
558
506
|
await snaptrade.accountInformation.getUserAccountOrders({
|
|
559
|
-
userId: "snaptrade-user-123",
|
|
560
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
561
507
|
state: "all",
|
|
562
508
|
days: 30,
|
|
563
509
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
@@ -566,10 +512,6 @@ const getUserAccountOrdersResponse =
|
|
|
566
512
|
|
|
567
513
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
568
514
|
|
|
569
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
570
|
-
|
|
571
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
572
|
-
|
|
573
515
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
574
516
|
|
|
575
517
|
##### state: `'all' | 'open' | 'executed'`<a id="state-all--open--executed"></a>
|
|
@@ -612,18 +554,12 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
612
554
|
```typescript
|
|
613
555
|
const getUserAccountPositionsResponse =
|
|
614
556
|
await snaptrade.accountInformation.getUserAccountPositions({
|
|
615
|
-
userId: "snaptrade-user-123",
|
|
616
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
617
557
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
618
558
|
});
|
|
619
559
|
```
|
|
620
560
|
|
|
621
561
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
622
562
|
|
|
623
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
624
|
-
|
|
625
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
626
|
-
|
|
627
563
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
628
564
|
|
|
629
565
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -652,18 +588,12 @@ By default only returns executed orders, but that can be changed by setting *onl
|
|
|
652
588
|
```typescript
|
|
653
589
|
const getUserAccountRecentOrdersResponse =
|
|
654
590
|
await snaptrade.accountInformation.getUserAccountRecentOrders({
|
|
655
|
-
userId: "snaptrade-user-123",
|
|
656
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
657
591
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
658
592
|
});
|
|
659
593
|
```
|
|
660
594
|
|
|
661
595
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
662
596
|
|
|
663
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
664
|
-
|
|
665
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
666
|
-
|
|
667
597
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
668
598
|
|
|
669
599
|
##### onlyExecuted: `boolean`<a id="onlyexecuted-boolean"></a>
|
|
@@ -693,8 +623,6 @@ Returns a list of rate of return percents for a given account.
|
|
|
693
623
|
```typescript
|
|
694
624
|
const getUserAccountReturnRatesResponse =
|
|
695
625
|
await snaptrade.accountInformation.getUserAccountReturnRates({
|
|
696
|
-
userId: "snaptrade-user-123",
|
|
697
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
698
626
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
699
627
|
timeframes: "ALL,1Y",
|
|
700
628
|
});
|
|
@@ -702,10 +630,6 @@ const getUserAccountReturnRatesResponse =
|
|
|
702
630
|
|
|
703
631
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
704
632
|
|
|
705
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
706
|
-
|
|
707
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
708
|
-
|
|
709
633
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
710
634
|
|
|
711
635
|
##### timeframes: `string`<a id="timeframes-string"></a>
|
|
@@ -744,8 +668,6 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
744
668
|
const getUserHoldingsResponse =
|
|
745
669
|
await snaptrade.accountInformation.getUserHoldings({
|
|
746
670
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
747
|
-
userId: "snaptrade-user-123",
|
|
748
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
749
671
|
});
|
|
750
672
|
```
|
|
751
673
|
|
|
@@ -753,10 +675,6 @@ const getUserHoldingsResponse =
|
|
|
753
675
|
|
|
754
676
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
755
677
|
|
|
756
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
757
|
-
|
|
758
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
759
|
-
|
|
760
678
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
761
679
|
|
|
762
680
|
[AccountHoldingsAccount](./models/account-holdings-account.ts)
|
|
@@ -784,18 +702,9 @@ This endpoint returns Daily data regardless of the customer's plan. Daily data i
|
|
|
784
702
|
|
|
785
703
|
```typescript
|
|
786
704
|
const listUserAccountsResponse =
|
|
787
|
-
await snaptrade.accountInformation.listUserAccounts(
|
|
788
|
-
userId: "snaptrade-user-123",
|
|
789
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
790
|
-
});
|
|
705
|
+
await snaptrade.accountInformation.listUserAccounts();
|
|
791
706
|
```
|
|
792
707
|
|
|
793
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
794
|
-
|
|
795
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
796
|
-
|
|
797
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
798
|
-
|
|
799
708
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
800
709
|
|
|
801
710
|
[Account](./models/account.ts)
|
|
@@ -818,18 +727,12 @@ Updates various properties of a specified account.
|
|
|
818
727
|
```typescript
|
|
819
728
|
const updateUserAccountResponse =
|
|
820
729
|
await snaptrade.accountInformation.updateUserAccount({
|
|
821
|
-
userId: "snaptrade-user-123",
|
|
822
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
823
730
|
accountId: "accountId_example",
|
|
824
731
|
});
|
|
825
732
|
```
|
|
826
733
|
|
|
827
734
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
828
735
|
|
|
829
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
830
|
-
|
|
831
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
832
|
-
|
|
833
736
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
834
737
|
|
|
835
738
|
The ID of the account to update.
|
|
@@ -878,15 +781,9 @@ Deletes a registered user and all associated data. This action is irreversible.
|
|
|
878
781
|
|
|
879
782
|
```typescript
|
|
880
783
|
const deleteSnapTradeUserResponse =
|
|
881
|
-
await snaptrade.authentication.deleteSnapTradeUser(
|
|
882
|
-
userId: "snaptrade-user-123",
|
|
883
|
-
});
|
|
784
|
+
await snaptrade.authentication.deleteSnapTradeUser();
|
|
884
785
|
```
|
|
885
786
|
|
|
886
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
887
|
-
|
|
888
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
889
|
-
|
|
890
787
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
891
788
|
|
|
892
789
|
[DeleteUserResponse](./models/delete-user-response.ts)
|
|
@@ -932,8 +829,6 @@ Please note that the returned URL expires in 5 minutes.
|
|
|
932
829
|
```typescript
|
|
933
830
|
const loginSnapTradeUserResponse =
|
|
934
831
|
await snaptrade.authentication.loginSnapTradeUser({
|
|
935
|
-
userId: "snaptrade-user-123",
|
|
936
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
937
832
|
broker: "ALPACA",
|
|
938
833
|
immediateRedirect: true,
|
|
939
834
|
customRedirect: "https://snaptrade.com",
|
|
@@ -947,10 +842,6 @@ const loginSnapTradeUserResponse =
|
|
|
947
842
|
|
|
948
843
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
949
844
|
|
|
950
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
951
|
-
|
|
952
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
953
|
-
|
|
954
845
|
##### broker: `string`<a id="broker-string"></a>
|
|
955
846
|
|
|
956
847
|
Slug of the brokerage to connect the user to. See [the integrations page](https://support.snaptrade.com/brokerages) for a list of supported brokerages and their slugs.
|
|
@@ -1077,8 +968,6 @@ Deletes the SnapTrade connection specified by the ID. This will also remove the
|
|
|
1077
968
|
```typescript
|
|
1078
969
|
const deleteConnectionResponse = await snaptrade.connections.deleteConnection({
|
|
1079
970
|
connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1080
|
-
userId: "snaptrade-user-123",
|
|
1081
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1082
971
|
});
|
|
1083
972
|
```
|
|
1084
973
|
|
|
@@ -1086,10 +975,6 @@ const deleteConnectionResponse = await snaptrade.connections.deleteConnection({
|
|
|
1086
975
|
|
|
1087
976
|
##### connectionId: `string`<a id="connectionid-string"></a>
|
|
1088
977
|
|
|
1089
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1090
|
-
|
|
1091
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1092
|
-
|
|
1093
978
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1094
979
|
|
|
1095
980
|
[DeleteConnectionConfirmation](./models/delete-connection-confirmation.ts)
|
|
@@ -1113,8 +998,6 @@ Returns a single connection for the specified ID.
|
|
|
1113
998
|
const detailBrokerageAuthorizationResponse =
|
|
1114
999
|
await snaptrade.connections.detailBrokerageAuthorization({
|
|
1115
1000
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1116
|
-
userId: "snaptrade-user-123",
|
|
1117
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1118
1001
|
});
|
|
1119
1002
|
```
|
|
1120
1003
|
|
|
@@ -1122,10 +1005,6 @@ const detailBrokerageAuthorizationResponse =
|
|
|
1122
1005
|
|
|
1123
1006
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1124
1007
|
|
|
1125
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1126
|
-
|
|
1127
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1128
|
-
|
|
1129
1008
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1130
1009
|
|
|
1131
1010
|
[BrokerageAuthorization](./models/brokerage-authorization.ts)
|
|
@@ -1153,8 +1032,6 @@ This endpoint is available on test keys. If you would like it enabled on product
|
|
|
1153
1032
|
const disableBrokerageAuthorizationResponse =
|
|
1154
1033
|
await snaptrade.connections.disableBrokerageAuthorization({
|
|
1155
1034
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1156
|
-
userId: "snaptrade-user-123",
|
|
1157
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1158
1035
|
});
|
|
1159
1036
|
```
|
|
1160
1037
|
|
|
@@ -1162,10 +1039,6 @@ const disableBrokerageAuthorizationResponse =
|
|
|
1162
1039
|
|
|
1163
1040
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1164
1041
|
|
|
1165
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1166
|
-
|
|
1167
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1168
|
-
|
|
1169
1042
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1170
1043
|
|
|
1171
1044
|
[BrokerageAuthorizationDisabledConfirmation](./models/brokerage-authorization-disabled-confirmation.ts)
|
|
@@ -1196,8 +1069,6 @@ Check your API key on the [Customer Dashboard billing page](https://dashboard.sn
|
|
|
1196
1069
|
const listBrokerageAuthorizationAccountsResponse =
|
|
1197
1070
|
await snaptrade.connections.listBrokerageAuthorizationAccounts({
|
|
1198
1071
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1199
|
-
userId: "snaptrade-user-123",
|
|
1200
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1201
1072
|
});
|
|
1202
1073
|
```
|
|
1203
1074
|
|
|
@@ -1205,10 +1076,6 @@ const listBrokerageAuthorizationAccountsResponse =
|
|
|
1205
1076
|
|
|
1206
1077
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1207
1078
|
|
|
1208
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1209
|
-
|
|
1210
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1211
|
-
|
|
1212
1079
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1213
1080
|
|
|
1214
1081
|
[Account](./models/account.ts)
|
|
@@ -1235,18 +1102,9 @@ SnapTrade performs de-duping on connections for a given user. If the user has an
|
|
|
1235
1102
|
|
|
1236
1103
|
```typescript
|
|
1237
1104
|
const listBrokerageAuthorizationsResponse =
|
|
1238
|
-
await snaptrade.connections.listBrokerageAuthorizations(
|
|
1239
|
-
userId: "snaptrade-user-123",
|
|
1240
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1241
|
-
});
|
|
1105
|
+
await snaptrade.connections.listBrokerageAuthorizations();
|
|
1242
1106
|
```
|
|
1243
1107
|
|
|
1244
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1245
|
-
|
|
1246
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1247
|
-
|
|
1248
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1249
|
-
|
|
1250
1108
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1251
1109
|
|
|
1252
1110
|
[BrokerageAuthorization](./models/brokerage-authorization.ts)
|
|
@@ -1275,8 +1133,6 @@ This endpoint will also trigger a transaction sync for the past day if one has n
|
|
|
1275
1133
|
const refreshBrokerageAuthorizationResponse =
|
|
1276
1134
|
await snaptrade.connections.refreshBrokerageAuthorization({
|
|
1277
1135
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1278
|
-
userId: "snaptrade-user-123",
|
|
1279
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1280
1136
|
});
|
|
1281
1137
|
```
|
|
1282
1138
|
|
|
@@ -1284,10 +1140,6 @@ const refreshBrokerageAuthorizationResponse =
|
|
|
1284
1140
|
|
|
1285
1141
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1286
1142
|
|
|
1287
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1288
|
-
|
|
1289
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1290
|
-
|
|
1291
1143
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1292
1144
|
|
|
1293
1145
|
[BrokerageAuthorizationRefreshConfirmation](./models/brokerage-authorization-refresh-confirmation.ts)
|
|
@@ -1311,8 +1163,6 @@ Deletes the SnapTrade connection specified by the ID. This will also remove the
|
|
|
1311
1163
|
const removeBrokerageAuthorizationResponse =
|
|
1312
1164
|
await snaptrade.connections.removeBrokerageAuthorization({
|
|
1313
1165
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1314
|
-
userId: "snaptrade-user-123",
|
|
1315
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1316
1166
|
});
|
|
1317
1167
|
```
|
|
1318
1168
|
|
|
@@ -1320,10 +1170,6 @@ const removeBrokerageAuthorizationResponse =
|
|
|
1320
1170
|
|
|
1321
1171
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1322
1172
|
|
|
1323
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1324
|
-
|
|
1325
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1326
|
-
|
|
1327
1173
|
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1328
1174
|
|
|
1329
1175
|
`/authorizations/{authorizationId}` `DELETE`
|
|
@@ -1342,8 +1188,6 @@ Returns a list of rate of return percents for a given connection.
|
|
|
1342
1188
|
|
|
1343
1189
|
```typescript
|
|
1344
1190
|
const returnRatesResponse = await snaptrade.connections.returnRates({
|
|
1345
|
-
userId: "snaptrade-user-123",
|
|
1346
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1347
1191
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1348
1192
|
timeframes: "ALL,1Y",
|
|
1349
1193
|
});
|
|
@@ -1351,10 +1195,6 @@ const returnRatesResponse = await snaptrade.connections.returnRates({
|
|
|
1351
1195
|
|
|
1352
1196
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1353
1197
|
|
|
1354
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1355
|
-
|
|
1356
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1357
|
-
|
|
1358
1198
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1359
1199
|
|
|
1360
1200
|
##### timeframes: `string`<a id="timeframes-string"></a>
|
|
@@ -1383,8 +1223,6 @@ Returns a list of session events associated with a user.
|
|
|
1383
1223
|
```typescript
|
|
1384
1224
|
const sessionEventsResponse = await snaptrade.connections.sessionEvents({
|
|
1385
1225
|
partnerClientId: "SNAPTRADETEST",
|
|
1386
|
-
userId:
|
|
1387
|
-
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
1388
1226
|
sessionId:
|
|
1389
1227
|
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
1390
1228
|
});
|
|
@@ -1394,10 +1232,6 @@ const sessionEventsResponse = await snaptrade.connections.sessionEvents({
|
|
|
1394
1232
|
|
|
1395
1233
|
##### partnerClientId: `string`<a id="partnerclientid-string"></a>
|
|
1396
1234
|
|
|
1397
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1398
|
-
|
|
1399
|
-
Optional comma separated list of user IDs used to filter the request on specific users
|
|
1400
|
-
|
|
1401
1235
|
##### sessionId: `string`<a id="sessionid-string"></a>
|
|
1402
1236
|
|
|
1403
1237
|
Optional comma separated list of session IDs used to filter the request on specific users
|
|
@@ -1426,8 +1260,6 @@ Trigger a transactions sync for all accounts under this connection. Updates will
|
|
|
1426
1260
|
const syncBrokerageAuthorizationTransactionsResponse =
|
|
1427
1261
|
await snaptrade.connections.syncBrokerageAuthorizationTransactions({
|
|
1428
1262
|
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1429
|
-
userId: "snaptrade-user-123",
|
|
1430
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1431
1263
|
});
|
|
1432
1264
|
```
|
|
1433
1265
|
|
|
@@ -1435,10 +1267,6 @@ const syncBrokerageAuthorizationTransactionsResponse =
|
|
|
1435
1267
|
|
|
1436
1268
|
##### authorizationId: `string`<a id="authorizationid-string"></a>
|
|
1437
1269
|
|
|
1438
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1439
|
-
|
|
1440
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1441
|
-
|
|
1442
1270
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1443
1271
|
|
|
1444
1272
|
[BrokerageAuthorizationTransactionsSyncConfirmation](./models/brokerage-authorization-transactions-sync-confirmation.ts)
|
|
@@ -1463,8 +1291,6 @@ This endpoint requires `userId` and `userSecret` in addition to the partner sign
|
|
|
1463
1291
|
```typescript
|
|
1464
1292
|
const addSubscriptionResponse =
|
|
1465
1293
|
await snaptrade.experimentalEndpoints.addSubscription({
|
|
1466
|
-
userId: "snaptrade-user-123",
|
|
1467
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1468
1294
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1469
1295
|
});
|
|
1470
1296
|
```
|
|
@@ -1475,10 +1301,6 @@ const addSubscriptionResponse =
|
|
|
1475
1301
|
|
|
1476
1302
|
Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
|
1477
1303
|
|
|
1478
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1479
|
-
|
|
1480
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1481
|
-
|
|
1482
1304
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1483
1305
|
|
|
1484
1306
|
[TradeDetectionSubscription](./models/trade-detection-subscription.ts)
|
|
@@ -1545,8 +1367,6 @@ const getUserAccountOrderDetailV2Response =
|
|
|
1545
1367
|
await snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2({
|
|
1546
1368
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1547
1369
|
brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
1548
|
-
userId: "snaptrade-user-123",
|
|
1549
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1550
1370
|
});
|
|
1551
1371
|
```
|
|
1552
1372
|
|
|
@@ -1556,10 +1376,6 @@ const getUserAccountOrderDetailV2Response =
|
|
|
1556
1376
|
|
|
1557
1377
|
##### brokerageOrderId: `string`<a id="brokerageorderid-string"></a>
|
|
1558
1378
|
|
|
1559
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1560
|
-
|
|
1561
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1562
|
-
|
|
1563
1379
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1564
1380
|
|
|
1565
1381
|
[AccountOrderRecordV2](./models/account-order-record-v2.ts)
|
|
@@ -1587,8 +1403,6 @@ If the connection has become disabled, it can no longer access the latest data f
|
|
|
1587
1403
|
```typescript
|
|
1588
1404
|
const getUserAccountOrdersV2Response =
|
|
1589
1405
|
await snaptrade.experimentalEndpoints.getUserAccountOrdersV2({
|
|
1590
|
-
userId: "snaptrade-user-123",
|
|
1591
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1592
1406
|
state: "all",
|
|
1593
1407
|
days: 30,
|
|
1594
1408
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
@@ -1597,10 +1411,6 @@ const getUserAccountOrdersV2Response =
|
|
|
1597
1411
|
|
|
1598
1412
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1599
1413
|
|
|
1600
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1601
|
-
|
|
1602
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1603
|
-
|
|
1604
1414
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
1605
1415
|
|
|
1606
1416
|
##### state: `'all' | 'open' | 'executed'`<a id="state-all--open--executed"></a>
|
|
@@ -1638,18 +1448,12 @@ By default only returns executed orders, but that can be changed by setting *onl
|
|
|
1638
1448
|
```typescript
|
|
1639
1449
|
const getUserAccountRecentOrdersV2Response =
|
|
1640
1450
|
await snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2({
|
|
1641
|
-
userId: "snaptrade-user-123",
|
|
1642
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1643
1451
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1644
1452
|
});
|
|
1645
1453
|
```
|
|
1646
1454
|
|
|
1647
1455
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1648
1456
|
|
|
1649
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1650
|
-
|
|
1651
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1652
|
-
|
|
1653
1457
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
1654
1458
|
|
|
1655
1459
|
##### onlyExecuted: `boolean`<a id="onlyexecuted-boolean"></a>
|
|
@@ -1709,18 +1513,12 @@ Check your API key on the [Customer Dashboard billing page](https://dashboard.sn
|
|
|
1709
1513
|
|
|
1710
1514
|
```typescript
|
|
1711
1515
|
const listOptionHoldingsResponse = await snaptrade.options.listOptionHoldings({
|
|
1712
|
-
userId: "snaptrade-user-123",
|
|
1713
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1714
1516
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1715
1517
|
});
|
|
1716
1518
|
```
|
|
1717
1519
|
|
|
1718
1520
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1719
1521
|
|
|
1720
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
1721
|
-
|
|
1722
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1723
|
-
|
|
1724
1522
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
1725
1523
|
|
|
1726
1524
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -2052,8 +1850,6 @@ The search results are further limited to the symbols supported by the brokerage
|
|
|
2052
1850
|
```typescript
|
|
2053
1851
|
const symbolSearchUserAccountResponse =
|
|
2054
1852
|
await snaptrade.referenceData.symbolSearchUserAccount({
|
|
2055
|
-
userId: "snaptrade-user-123",
|
|
2056
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2057
1853
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2058
1854
|
substring: "AAPL",
|
|
2059
1855
|
});
|
|
@@ -2061,10 +1857,6 @@ const symbolSearchUserAccountResponse =
|
|
|
2061
1857
|
|
|
2062
1858
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
2063
1859
|
|
|
2064
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2065
|
-
|
|
2066
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2067
|
-
|
|
2068
1860
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2069
1861
|
|
|
2070
1862
|
##### substring: `string`<a id="substring-string"></a>
|
|
@@ -2093,8 +1885,6 @@ Cancels an order in the specified account. Accepts order IDs for all asset types
|
|
|
2093
1885
|
|
|
2094
1886
|
```typescript
|
|
2095
1887
|
const cancelOrderResponse = await snaptrade.trading.cancelOrder({
|
|
2096
|
-
userId: "snaptrade-user-123",
|
|
2097
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2098
1888
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2099
1889
|
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
2100
1890
|
});
|
|
@@ -2106,10 +1896,6 @@ const cancelOrderResponse = await snaptrade.trading.cancelOrder({
|
|
|
2106
1896
|
|
|
2107
1897
|
Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
2108
1898
|
|
|
2109
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2110
|
-
|
|
2111
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2112
|
-
|
|
2113
1899
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2114
1900
|
|
|
2115
1901
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -2137,8 +1923,6 @@ Attempts to cancel an open order with the brokerage. If the order is no longer c
|
|
|
2137
1923
|
```typescript
|
|
2138
1924
|
const cancelUserAccountOrderResponse =
|
|
2139
1925
|
await snaptrade.trading.cancelUserAccountOrder({
|
|
2140
|
-
userId: "snaptrade-user-123",
|
|
2141
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2142
1926
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2143
1927
|
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
2144
1928
|
});
|
|
@@ -2150,10 +1934,6 @@ const cancelUserAccountOrderResponse =
|
|
|
2150
1934
|
|
|
2151
1935
|
Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
2152
1936
|
|
|
2153
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2154
|
-
|
|
2155
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2156
|
-
|
|
2157
1937
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2158
1938
|
|
|
2159
1939
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
@@ -2179,8 +1959,6 @@ Gets a quote for the specified account.
|
|
|
2179
1959
|
```typescript
|
|
2180
1960
|
const getCryptocurrencyPairQuoteResponse =
|
|
2181
1961
|
await snaptrade.trading.getCryptocurrencyPairQuote({
|
|
2182
|
-
userId: "snaptrade-user-123",
|
|
2183
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2184
1962
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2185
1963
|
instrumentSymbol: "BTC-USD",
|
|
2186
1964
|
});
|
|
@@ -2188,10 +1966,6 @@ const getCryptocurrencyPairQuoteResponse =
|
|
|
2188
1966
|
|
|
2189
1967
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
2190
1968
|
|
|
2191
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2192
|
-
|
|
2193
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2194
|
-
|
|
2195
1969
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2196
1970
|
|
|
2197
1971
|
##### instrumentSymbol: `string`<a id="instrumentsymbol-string"></a>
|
|
@@ -2219,8 +1993,6 @@ Only supported for certain enabled brokerages. Please refer to the [brokerage tr
|
|
|
2219
1993
|
|
|
2220
1994
|
```typescript
|
|
2221
1995
|
const getOptionImpactResponse = await snaptrade.trading.getOptionImpact({
|
|
2222
|
-
userId: "snaptrade-user-123",
|
|
2223
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2224
1996
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2225
1997
|
order_type: "MARKET",
|
|
2226
1998
|
time_in_force: "Day",
|
|
@@ -2252,10 +2024,6 @@ The Time in Force type for the order. This field indicates how long the order wi
|
|
|
2252
2024
|
|
|
2253
2025
|
##### legs: [`MlegLeg`](./models/mleg-leg.ts)[]<a id="legs-mleglegmodelsmleg-legts"></a>
|
|
2254
2026
|
|
|
2255
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2256
|
-
|
|
2257
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2258
|
-
|
|
2259
2027
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2260
2028
|
|
|
2261
2029
|
##### limit_price: `string`<a id="limit_price-string"></a>
|
|
@@ -2289,8 +2057,6 @@ Simulates an order and its impact on the account. This endpoint does not place t
|
|
|
2289
2057
|
|
|
2290
2058
|
```typescript
|
|
2291
2059
|
const getOrderImpactResponse = await snaptrade.trading.getOrderImpact({
|
|
2292
|
-
userId: "snaptrade-user-123",
|
|
2293
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2294
2060
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2295
2061
|
action: "BUY",
|
|
2296
2062
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
@@ -2324,10 +2090,6 @@ The type of order to place. - For `Limit` and `StopLimit` orders, the `price` f
|
|
|
2324
2090
|
|
|
2325
2091
|
The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
|
2326
2092
|
|
|
2327
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2328
|
-
|
|
2329
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2330
|
-
|
|
2331
2093
|
##### price: `number`<a id="price-number"></a>
|
|
2332
2094
|
|
|
2333
2095
|
The limit price for `Limit` and `StopLimit` orders.
|
|
@@ -2364,8 +2126,6 @@ Returns a quote for a single option contract. The option contract is specified u
|
|
|
2364
2126
|
```typescript
|
|
2365
2127
|
const getUserAccountOptionQuotesResponse =
|
|
2366
2128
|
await snaptrade.trading.getUserAccountOptionQuotes({
|
|
2367
|
-
userId: "snaptrade-user-123",
|
|
2368
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2369
2129
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2370
2130
|
symbol: "AAPL 251219C00150000",
|
|
2371
2131
|
});
|
|
@@ -2373,10 +2133,6 @@ const getUserAccountOptionQuotesResponse =
|
|
|
2373
2133
|
|
|
2374
2134
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
2375
2135
|
|
|
2376
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2377
|
-
|
|
2378
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2379
|
-
|
|
2380
2136
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2381
2137
|
|
|
2382
2138
|
##### symbol: `string`<a id="symbol-string"></a>
|
|
@@ -2414,8 +2170,6 @@ This endpoint is disabled for free plans by default. Please contact support to e
|
|
|
2414
2170
|
```typescript
|
|
2415
2171
|
const getUserAccountQuotesResponse =
|
|
2416
2172
|
await snaptrade.trading.getUserAccountQuotes({
|
|
2417
|
-
userId: "snaptrade-user-123",
|
|
2418
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2419
2173
|
symbols: "symbols_example",
|
|
2420
2174
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2421
2175
|
});
|
|
@@ -2423,10 +2177,6 @@ const getUserAccountQuotesResponse =
|
|
|
2423
2177
|
|
|
2424
2178
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
2425
2179
|
|
|
2426
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2427
|
-
|
|
2428
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2429
|
-
|
|
2430
2180
|
##### symbols: `string`<a id="symbols-string"></a>
|
|
2431
2181
|
|
|
2432
2182
|
List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator. Maximum of 10 values allowed
|
|
@@ -2463,8 +2213,6 @@ use. Only supported on certain brokerages
|
|
|
2463
2213
|
```typescript
|
|
2464
2214
|
const placeBracketOrderResponse = await snaptrade.trading.placeBracketOrder({
|
|
2465
2215
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2466
|
-
userId: "snaptrade-user-123",
|
|
2467
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2468
2216
|
action: "BUY",
|
|
2469
2217
|
instrument: {
|
|
2470
2218
|
symbol: "AAPL",
|
|
@@ -2509,10 +2257,6 @@ The Time in Force type for the order. This field indicates how long the order wi
|
|
|
2509
2257
|
|
|
2510
2258
|
The ID of the account to execute the trade on.
|
|
2511
2259
|
|
|
2512
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2513
|
-
|
|
2514
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2515
|
-
|
|
2516
2260
|
##### price: `number`<a id="price-number"></a>
|
|
2517
2261
|
|
|
2518
2262
|
The limit price for `Limit` and `StopLimit` orders.
|
|
@@ -2553,8 +2297,6 @@ Only supported on certain brokerages.
|
|
|
2553
2297
|
```typescript
|
|
2554
2298
|
const placeComplexOrderResponse = await snaptrade.trading.placeComplexOrder({
|
|
2555
2299
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2556
|
-
userId: "snaptrade-user-123",
|
|
2557
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2558
2300
|
type: "OTO",
|
|
2559
2301
|
orders: [
|
|
2560
2302
|
{
|
|
@@ -2589,10 +2331,6 @@ The orders that make up the complex order. Required counts and roles per type: -
|
|
|
2589
2331
|
|
|
2590
2332
|
The ID of the account to execute the trade on.
|
|
2591
2333
|
|
|
2592
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2593
|
-
|
|
2594
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2595
|
-
|
|
2596
2334
|
##### client_order_id: `string`<a id="client_order_id-string"></a>
|
|
2597
2335
|
|
|
2598
2336
|
An optional client-provided identifier for this complex order. Passed through to the brokerage and returned in the response.
|
|
@@ -2620,8 +2358,6 @@ This endpoint does not compute the impact to the account balance from the order
|
|
|
2620
2358
|
|
|
2621
2359
|
```typescript
|
|
2622
2360
|
const placeCryptoOrderResponse = await snaptrade.trading.placeCryptoOrder({
|
|
2623
|
-
userId: "snaptrade-user-123",
|
|
2624
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2625
2361
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2626
2362
|
instrument: {
|
|
2627
2363
|
symbol: "BTC",
|
|
@@ -2634,7 +2370,7 @@ const placeCryptoOrderResponse = await snaptrade.trading.placeCryptoOrder({
|
|
|
2634
2370
|
limit_price: "123.45",
|
|
2635
2371
|
stop_price: "123.45",
|
|
2636
2372
|
post_only: false,
|
|
2637
|
-
expiration_date: "2024-01-01T00:00:
|
|
2373
|
+
expiration_date: "2024-01-01T00:00:00.000Z",
|
|
2638
2374
|
});
|
|
2639
2375
|
```
|
|
2640
2376
|
|
|
@@ -2658,10 +2394,6 @@ The Time in Force type for the order. This field indicates how long the order wi
|
|
|
2658
2394
|
|
|
2659
2395
|
The amount of the base currency to buy or sell.
|
|
2660
2396
|
|
|
2661
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2662
|
-
|
|
2663
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2664
|
-
|
|
2665
2397
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2666
2398
|
|
|
2667
2399
|
##### limit_price: `string`<a id="limit_price-string"></a>
|
|
@@ -2706,8 +2438,6 @@ It's recommended to trigger a manual refresh of the account after placing an ord
|
|
|
2706
2438
|
|
|
2707
2439
|
```typescript
|
|
2708
2440
|
const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
|
|
2709
|
-
userId: "snaptrade-user-123",
|
|
2710
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2711
2441
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2712
2442
|
action: "BUY",
|
|
2713
2443
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
@@ -2739,10 +2469,6 @@ The type of order to place. - For `Limit` and `StopLimit` orders, the `price` f
|
|
|
2739
2469
|
|
|
2740
2470
|
The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
|
2741
2471
|
|
|
2742
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2743
|
-
|
|
2744
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2745
|
-
|
|
2746
2472
|
##### universal_symbol_id: [`string`](./models/model-string.ts)<a id="universal_symbol_id-stringmodelsmodel-stringts"></a>
|
|
2747
2473
|
|
|
2748
2474
|
The universal symbol ID of the security to trade. Must be \\\'null\\\' if `symbol` is provided, otherwise must be provided.
|
|
@@ -2791,8 +2517,6 @@ Places a multi-leg option order. Only supported on certain option trading broker
|
|
|
2791
2517
|
|
|
2792
2518
|
```typescript
|
|
2793
2519
|
const placeMlegOrderResponse = await snaptrade.trading.placeMlegOrder({
|
|
2794
|
-
userId: "snaptrade-user-123",
|
|
2795
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2796
2520
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2797
2521
|
order_type: "MARKET",
|
|
2798
2522
|
time_in_force: "Day",
|
|
@@ -2824,10 +2548,6 @@ The Time in Force type for the order. This field indicates how long the order wi
|
|
|
2824
2548
|
|
|
2825
2549
|
##### legs: [`MlegLeg`](./models/mleg-leg.ts)[]<a id="legs-mleglegmodelsmleg-legts"></a>
|
|
2826
2550
|
|
|
2827
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2828
|
-
|
|
2829
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2830
|
-
|
|
2831
2551
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2832
2552
|
|
|
2833
2553
|
##### limit_price: `string`<a id="limit_price-string"></a>
|
|
@@ -2865,8 +2585,6 @@ It's recommended to trigger a manual refresh of the account after placing an ord
|
|
|
2865
2585
|
```typescript
|
|
2866
2586
|
const placeOrderResponse = await snaptrade.trading.placeOrder({
|
|
2867
2587
|
tradeId: "139e307a-82f7-4402-b39e-4da7baa87758",
|
|
2868
|
-
userId: "snaptrade-user-123",
|
|
2869
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2870
2588
|
wait_to_confirm: true,
|
|
2871
2589
|
});
|
|
2872
2590
|
```
|
|
@@ -2877,10 +2595,6 @@ const placeOrderResponse = await snaptrade.trading.placeOrder({
|
|
|
2877
2595
|
|
|
2878
2596
|
Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
|
|
2879
2597
|
|
|
2880
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2881
|
-
|
|
2882
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2883
|
-
|
|
2884
2598
|
##### wait_to_confirm: `boolean`<a id="wait_to_confirm-boolean"></a>
|
|
2885
2599
|
|
|
2886
2600
|
Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request.
|
|
@@ -2907,8 +2621,6 @@ Previews an order using the specified account.
|
|
|
2907
2621
|
|
|
2908
2622
|
```typescript
|
|
2909
2623
|
const previewCryptoOrderResponse = await snaptrade.trading.previewCryptoOrder({
|
|
2910
|
-
userId: "snaptrade-user-123",
|
|
2911
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2912
2624
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2913
2625
|
instrument: {
|
|
2914
2626
|
symbol: "BTC",
|
|
@@ -2921,7 +2633,7 @@ const previewCryptoOrderResponse = await snaptrade.trading.previewCryptoOrder({
|
|
|
2921
2633
|
limit_price: "123.45",
|
|
2922
2634
|
stop_price: "123.45",
|
|
2923
2635
|
post_only: false,
|
|
2924
|
-
expiration_date: "2024-01-01T00:00:
|
|
2636
|
+
expiration_date: "2024-01-01T00:00:00.000Z",
|
|
2925
2637
|
});
|
|
2926
2638
|
```
|
|
2927
2639
|
|
|
@@ -2945,10 +2657,6 @@ The Time in Force type for the order. This field indicates how long the order wi
|
|
|
2945
2657
|
|
|
2946
2658
|
The amount of the base currency to buy or sell.
|
|
2947
2659
|
|
|
2948
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
2949
|
-
|
|
2950
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2951
|
-
|
|
2952
2660
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
2953
2661
|
|
|
2954
2662
|
##### limit_price: `string`<a id="limit_price-string"></a>
|
|
@@ -2992,8 +2700,6 @@ returned in the response going forward. Only supported on some brokerages
|
|
|
2992
2700
|
```typescript
|
|
2993
2701
|
const replaceOrderResponse = await snaptrade.trading.replaceOrder({
|
|
2994
2702
|
accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
2995
|
-
userId: "snaptrade-user-123",
|
|
2996
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2997
2703
|
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
2998
2704
|
action: "BUY",
|
|
2999
2705
|
order_type: "Market",
|
|
@@ -3027,10 +2733,6 @@ The Time in Force type for the order. This field indicates how long the order wi
|
|
|
3027
2733
|
|
|
3028
2734
|
The ID of the account to execute the trade on.
|
|
3029
2735
|
|
|
3030
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
3031
|
-
|
|
3032
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
3033
|
-
|
|
3034
2736
|
##### price: `number`<a id="price-number"></a>
|
|
3035
2737
|
|
|
3036
2738
|
The limit price for `Limit` and `StopLimit` orders.
|
|
@@ -3068,8 +2770,6 @@ Searches cryptocurrency pairs instruments accessible to the specified account. B
|
|
|
3068
2770
|
```typescript
|
|
3069
2771
|
const searchCryptocurrencyPairInstrumentsResponse =
|
|
3070
2772
|
await snaptrade.trading.searchCryptocurrencyPairInstruments({
|
|
3071
|
-
userId: "snaptrade-user-123",
|
|
3072
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
3073
2773
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
3074
2774
|
base: "BTC",
|
|
3075
2775
|
quote: "USD",
|
|
@@ -3078,10 +2778,6 @@ const searchCryptocurrencyPairInstrumentsResponse =
|
|
|
3078
2778
|
|
|
3079
2779
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
3080
2780
|
|
|
3081
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
3082
|
-
|
|
3083
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
3084
|
-
|
|
3085
2781
|
##### accountId: `string`<a id="accountid-string"></a>
|
|
3086
2782
|
|
|
3087
2783
|
##### base: `string`<a id="base-string"></a>
|
|
@@ -3120,24 +2816,18 @@ This endpoint returns Daily data. Daily data is cached and refreshed once a day.
|
|
|
3120
2816
|
```typescript
|
|
3121
2817
|
const getActivitiesResponse =
|
|
3122
2818
|
await snaptrade.transactionsAndReporting.getActivities({
|
|
3123
|
-
startDate: "2022-01-
|
|
3124
|
-
endDate: "2022-01-
|
|
2819
|
+
startDate: "2022-01-24T00:00:00.000Z",
|
|
2820
|
+
endDate: "2022-01-24T00:00:00.000Z",
|
|
3125
2821
|
accounts:
|
|
3126
2822
|
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
3127
2823
|
brokerageAuthorizations:
|
|
3128
2824
|
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
3129
2825
|
type: "BUY,SELL,DIVIDEND",
|
|
3130
|
-
userId: "snaptrade-user-123",
|
|
3131
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
3132
2826
|
});
|
|
3133
2827
|
```
|
|
3134
2828
|
|
|
3135
2829
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
3136
2830
|
|
|
3137
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
3138
|
-
|
|
3139
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
3140
|
-
|
|
3141
2831
|
##### startDate: `string | Date`<a id="startdate-string--date"></a>
|
|
3142
2832
|
|
|
3143
2833
|
The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
|
|
@@ -3181,14 +2871,12 @@ Returns performance information (contributions, dividends, rate of return, etc)
|
|
|
3181
2871
|
```typescript
|
|
3182
2872
|
const getReportingCustomRangeResponse =
|
|
3183
2873
|
await snaptrade.transactionsAndReporting.getReportingCustomRange({
|
|
3184
|
-
startDate: "2022-01-
|
|
3185
|
-
endDate: "2022-01-
|
|
2874
|
+
startDate: "2022-01-24T00:00:00.000Z",
|
|
2875
|
+
endDate: "2022-01-24T00:00:00.000Z",
|
|
3186
2876
|
accounts:
|
|
3187
2877
|
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
3188
2878
|
detailed: true,
|
|
3189
2879
|
frequency: "monthly",
|
|
3190
|
-
userId: "snaptrade-user-123",
|
|
3191
|
-
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
3192
2880
|
});
|
|
3193
2881
|
```
|
|
3194
2882
|
|
|
@@ -3198,10 +2886,6 @@ const getReportingCustomRangeResponse =
|
|
|
3198
2886
|
|
|
3199
2887
|
##### endDate: `string | Date`<a id="enddate-string--date"></a>
|
|
3200
2888
|
|
|
3201
|
-
##### userId: `string`<a id="userid-string"></a>
|
|
3202
|
-
|
|
3203
|
-
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
3204
|
-
|
|
3205
2889
|
##### accounts: `string`<a id="accounts-string"></a>
|
|
3206
2890
|
|
|
3207
2891
|
Optional comma separated list of account IDs used to filter the request on specific accounts
|