snaptrade-typescript-sdk 6.3.0 → 7.0.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 +11 -24
- package/api/account-information-api-custom.ts +3 -0
- package/api/account-information-api.ts +2 -1
- package/api/api-disclaimer-api-custom.ts +3 -0
- package/api/api-disclaimer-api.ts +2 -1
- package/api/api-status-api-custom.ts +3 -0
- package/api/api-status-api.ts +2 -1
- package/api/authentication-api-custom.ts +3 -0
- package/api/authentication-api.ts +2 -1
- package/api/connections-api-custom.ts +3 -0
- package/api/connections-api.ts +2 -1
- package/api/error-logs-api-custom.ts +3 -0
- package/api/error-logs-api.ts +2 -1
- package/api/options-api-custom.ts +3 -0
- package/api/options-api.ts +2 -1
- package/api/portfolio-management-api-custom.ts +3 -0
- package/api/portfolio-management-api.ts +2 -1
- package/api/reference-data-api-custom.ts +3 -0
- package/api/reference-data-api.ts +2 -1
- package/api/trading-api-custom.ts +3 -0
- package/api/trading-api.ts +2 -1
- package/api/transactions-and-reporting-api-custom.ts +3 -0
- package/api/transactions-and-reporting-api.ts +28 -19
- package/client-custom.ts +5 -0
- package/client.ts +3 -1
- package/configuration.ts +1 -1
- package/dist/api/account-information-api-custom.d.ts +3 -0
- package/dist/api/account-information-api-custom.js +27 -0
- package/dist/api/account-information-api.d.ts +3 -2
- package/dist/api/account-information-api.js +2 -1
- package/dist/api/api-disclaimer-api-custom.d.ts +3 -0
- package/dist/api/api-disclaimer-api-custom.js +27 -0
- package/dist/api/api-disclaimer-api.d.ts +3 -2
- package/dist/api/api-disclaimer-api.js +2 -1
- package/dist/api/api-status-api-custom.d.ts +3 -0
- package/dist/api/api-status-api-custom.js +27 -0
- package/dist/api/api-status-api.d.ts +3 -2
- package/dist/api/api-status-api.js +2 -1
- package/dist/api/authentication-api-custom.d.ts +3 -0
- package/dist/api/authentication-api-custom.js +27 -0
- package/dist/api/authentication-api.d.ts +3 -2
- package/dist/api/authentication-api.js +2 -1
- package/dist/api/connections-api-custom.d.ts +3 -0
- package/dist/api/connections-api-custom.js +27 -0
- package/dist/api/connections-api.d.ts +3 -2
- package/dist/api/connections-api.js +2 -1
- package/dist/api/error-logs-api-custom.d.ts +3 -0
- package/dist/api/error-logs-api-custom.js +27 -0
- package/dist/api/error-logs-api.d.ts +3 -2
- package/dist/api/error-logs-api.js +2 -1
- package/dist/api/options-api-custom.d.ts +3 -0
- package/dist/api/options-api-custom.js +27 -0
- package/dist/api/options-api.d.ts +3 -2
- package/dist/api/options-api.js +2 -1
- package/dist/api/portfolio-management-api-custom.d.ts +3 -0
- package/dist/api/portfolio-management-api-custom.js +27 -0
- package/dist/api/portfolio-management-api.d.ts +3 -2
- package/dist/api/portfolio-management-api.js +2 -1
- package/dist/api/reference-data-api-custom.d.ts +3 -0
- package/dist/api/reference-data-api-custom.js +27 -0
- package/dist/api/reference-data-api.d.ts +3 -2
- package/dist/api/reference-data-api.js +2 -1
- package/dist/api/trading-api-custom.d.ts +3 -0
- package/dist/api/trading-api-custom.js +27 -0
- package/dist/api/trading-api.d.ts +3 -2
- package/dist/api/trading-api.js +2 -1
- package/dist/api/transactions-and-reporting-api-custom.d.ts +3 -0
- package/dist/api/transactions-and-reporting-api-custom.js +27 -0
- package/dist/api/transactions-and-reporting-api.d.ts +17 -16
- package/dist/api/transactions-and-reporting-api.js +18 -9
- package/dist/client-custom.d.ts +4 -0
- package/dist/client-custom.js +9 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.js +32 -13
- package/dist/configuration.js +1 -1
- package/dist/models/snap-trade-holdings-account.d.ts +2 -3
- package/dist/models/symbol.d.ts +6 -0
- package/docs/TransactionsAndReportingApi.md +4 -4
- package/index.test.ts +60 -0
- package/models/snap-trade-holdings-account.ts +2 -5
- package/models/symbol.ts +6 -0
- package/package.json +1 -1
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
13
13
|
import { Configuration } from '../configuration';
|
|
14
|
-
import { RequestArgs
|
|
14
|
+
import { RequestArgs } from '../base';
|
|
15
15
|
import { PerformanceCustom } from '../models';
|
|
16
16
|
import { UniversalActivity } from '../models';
|
|
17
|
+
import { TransactionsAndReportingApiCustom } from "./transactions-and-reporting-api-custom";
|
|
17
18
|
/**
|
|
18
19
|
* TransactionsAndReportingApi - axios parameter creator
|
|
19
20
|
* @export
|
|
@@ -24,19 +25,19 @@ export declare const TransactionsAndReportingApiAxiosParamCreator: (configuratio
|
|
|
24
25
|
* @summary Get transaction history for a user
|
|
25
26
|
* @param {string} userId
|
|
26
27
|
* @param {string} userSecret
|
|
27
|
-
* @param {string} [startDate]
|
|
28
|
-
* @param {string} [endDate]
|
|
28
|
+
* @param {string | Date} [startDate]
|
|
29
|
+
* @param {string | Date} [endDate]
|
|
29
30
|
* @param {string} [accounts] Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
30
31
|
* @param {string} [brokerageAuthorizations] Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations
|
|
31
32
|
* @param {*} [options] Override http request option.
|
|
32
33
|
* @throws {RequiredError}
|
|
33
34
|
*/
|
|
34
|
-
getActivities: (userId: string, userSecret: string, startDate?: string, endDate?: string, accounts?: string, brokerageAuthorizations?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
35
|
+
getActivities: (userId: string, userSecret: string, startDate?: string | Date, endDate?: string | Date, accounts?: string, brokerageAuthorizations?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
35
36
|
/**
|
|
36
37
|
* Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Total Equity Timeframe and Rate of Returns are experimental and should not be trusted to be 100% accurate
|
|
37
38
|
* @summary Get performance information for a specific timeframe
|
|
38
|
-
* @param {string} startDate
|
|
39
|
-
* @param {string} endDate
|
|
39
|
+
* @param {string | Date} startDate
|
|
40
|
+
* @param {string | Date} endDate
|
|
40
41
|
* @param {string} userId
|
|
41
42
|
* @param {string} userSecret
|
|
42
43
|
* @param {string} [accounts] Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
@@ -45,7 +46,7 @@ export declare const TransactionsAndReportingApiAxiosParamCreator: (configuratio
|
|
|
45
46
|
* @param {*} [options] Override http request option.
|
|
46
47
|
* @throws {RequiredError}
|
|
47
48
|
*/
|
|
48
|
-
getReportingCustomRange: (startDate: string, endDate: string, userId: string, userSecret: string, accounts?: string, detailed?: boolean, frequency?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
49
|
+
getReportingCustomRange: (startDate: string | Date, endDate: string | Date, userId: string, userSecret: string, accounts?: string, detailed?: boolean, frequency?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
52
|
* TransactionsAndReportingApi - functional programming interface
|
|
@@ -111,16 +112,16 @@ export type TransactionsAndReportingApiGetActivitiesRequest = {
|
|
|
111
112
|
readonly userSecret: string;
|
|
112
113
|
/**
|
|
113
114
|
*
|
|
114
|
-
* @type {string}
|
|
115
|
+
* @type {string | Date}
|
|
115
116
|
* @memberof TransactionsAndReportingApiGetActivities
|
|
116
117
|
*/
|
|
117
|
-
readonly startDate?: string;
|
|
118
|
+
readonly startDate?: string | Date;
|
|
118
119
|
/**
|
|
119
120
|
*
|
|
120
|
-
* @type {string}
|
|
121
|
+
* @type {string | Date}
|
|
121
122
|
* @memberof TransactionsAndReportingApiGetActivities
|
|
122
123
|
*/
|
|
123
|
-
readonly endDate?: string;
|
|
124
|
+
readonly endDate?: string | Date;
|
|
124
125
|
/**
|
|
125
126
|
* Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
126
127
|
* @type {string}
|
|
@@ -142,16 +143,16 @@ export type TransactionsAndReportingApiGetActivitiesRequest = {
|
|
|
142
143
|
export type TransactionsAndReportingApiGetReportingCustomRangeRequest = {
|
|
143
144
|
/**
|
|
144
145
|
*
|
|
145
|
-
* @type {string}
|
|
146
|
+
* @type {string | Date}
|
|
146
147
|
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
147
148
|
*/
|
|
148
|
-
readonly startDate: string;
|
|
149
|
+
readonly startDate: string | Date;
|
|
149
150
|
/**
|
|
150
151
|
*
|
|
151
|
-
* @type {string}
|
|
152
|
+
* @type {string | Date}
|
|
152
153
|
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
153
154
|
*/
|
|
154
|
-
readonly endDate: string;
|
|
155
|
+
readonly endDate: string | Date;
|
|
155
156
|
/**
|
|
156
157
|
*
|
|
157
158
|
* @type {string}
|
|
@@ -189,7 +190,7 @@ export type TransactionsAndReportingApiGetReportingCustomRangeRequest = {
|
|
|
189
190
|
* @class TransactionsAndReportingApi
|
|
190
191
|
* @extends {BaseAPI}
|
|
191
192
|
*/
|
|
192
|
-
export declare class TransactionsAndReportingApi extends
|
|
193
|
+
export declare class TransactionsAndReportingApi extends TransactionsAndReportingApiCustom {
|
|
193
194
|
/**
|
|
194
195
|
* Returns activities (transactions) for a user. Specifing start and end date is highly recommended for automatic calls for better performance
|
|
195
196
|
* @summary Get transaction history for a user
|
|
@@ -83,6 +83,7 @@ var common_1 = require("../common");
|
|
|
83
83
|
// @ts-ignore
|
|
84
84
|
var base_1 = require("../base");
|
|
85
85
|
var requestBeforeHook_1 = require("../requestBeforeHook");
|
|
86
|
+
var transactions_and_reporting_api_custom_1 = require("./transactions-and-reporting-api-custom");
|
|
86
87
|
/**
|
|
87
88
|
* TransactionsAndReportingApi - axios parameter creator
|
|
88
89
|
* @export
|
|
@@ -95,8 +96,8 @@ var TransactionsAndReportingApiAxiosParamCreator = function (configuration) {
|
|
|
95
96
|
* @summary Get transaction history for a user
|
|
96
97
|
* @param {string} userId
|
|
97
98
|
* @param {string} userSecret
|
|
98
|
-
* @param {string} [startDate]
|
|
99
|
-
* @param {string} [endDate]
|
|
99
|
+
* @param {string | Date} [startDate]
|
|
100
|
+
* @param {string | Date} [endDate]
|
|
100
101
|
* @param {string} [accounts] Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
101
102
|
* @param {string} [brokerageAuthorizations] Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations
|
|
102
103
|
* @param {*} [options] Override http request option.
|
|
@@ -141,10 +142,14 @@ var TransactionsAndReportingApiAxiosParamCreator = function (configuration) {
|
|
|
141
142
|
// authentication PartnerTimestamp required
|
|
142
143
|
_a.sent();
|
|
143
144
|
if (startDate !== undefined) {
|
|
144
|
-
localVarQueryParameter['startDate'] = startDate
|
|
145
|
+
localVarQueryParameter['startDate'] = (startDate instanceof Date) ?
|
|
146
|
+
startDate.toISOString().substr(0, 10) :
|
|
147
|
+
startDate;
|
|
145
148
|
}
|
|
146
149
|
if (endDate !== undefined) {
|
|
147
|
-
localVarQueryParameter['endDate'] = endDate
|
|
150
|
+
localVarQueryParameter['endDate'] = (endDate instanceof Date) ?
|
|
151
|
+
endDate.toISOString().substr(0, 10) :
|
|
152
|
+
endDate;
|
|
148
153
|
}
|
|
149
154
|
if (accounts !== undefined) {
|
|
150
155
|
localVarQueryParameter['accounts'] = accounts;
|
|
@@ -178,8 +183,8 @@ var TransactionsAndReportingApiAxiosParamCreator = function (configuration) {
|
|
|
178
183
|
/**
|
|
179
184
|
* Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Total Equity Timeframe and Rate of Returns are experimental and should not be trusted to be 100% accurate
|
|
180
185
|
* @summary Get performance information for a specific timeframe
|
|
181
|
-
* @param {string} startDate
|
|
182
|
-
* @param {string} endDate
|
|
186
|
+
* @param {string | Date} startDate
|
|
187
|
+
* @param {string | Date} endDate
|
|
183
188
|
* @param {string} userId
|
|
184
189
|
* @param {string} userSecret
|
|
185
190
|
* @param {string} [accounts] Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
@@ -231,10 +236,14 @@ var TransactionsAndReportingApiAxiosParamCreator = function (configuration) {
|
|
|
231
236
|
// authentication PartnerTimestamp required
|
|
232
237
|
_a.sent();
|
|
233
238
|
if (startDate !== undefined) {
|
|
234
|
-
localVarQueryParameter['startDate'] = startDate
|
|
239
|
+
localVarQueryParameter['startDate'] = (startDate instanceof Date) ?
|
|
240
|
+
startDate.toISOString().substr(0, 10) :
|
|
241
|
+
startDate;
|
|
235
242
|
}
|
|
236
243
|
if (endDate !== undefined) {
|
|
237
|
-
localVarQueryParameter['endDate'] = endDate
|
|
244
|
+
localVarQueryParameter['endDate'] = (endDate instanceof Date) ?
|
|
245
|
+
endDate.toISOString().substr(0, 10) :
|
|
246
|
+
endDate;
|
|
238
247
|
}
|
|
239
248
|
if (accounts !== undefined) {
|
|
240
249
|
localVarQueryParameter['accounts'] = accounts;
|
|
@@ -387,5 +396,5 @@ var TransactionsAndReportingApi = /** @class */ (function (_super) {
|
|
|
387
396
|
return (0, exports.TransactionsAndReportingApiFp)(this.configuration).getReportingCustomRange(requestParameters, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
388
397
|
};
|
|
389
398
|
return TransactionsAndReportingApi;
|
|
390
|
-
}(
|
|
399
|
+
}(transactions_and_reporting_api_custom_1.TransactionsAndReportingApiCustom));
|
|
391
400
|
exports.TransactionsAndReportingApi = TransactionsAndReportingApi;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnaptradeCustom = void 0;
|
|
4
|
+
var SnaptradeCustom = /** @class */ (function () {
|
|
5
|
+
function SnaptradeCustom(configurationParameters) {
|
|
6
|
+
}
|
|
7
|
+
return SnaptradeCustom;
|
|
8
|
+
}());
|
|
9
|
+
exports.SnaptradeCustom = SnaptradeCustom;
|
package/dist/client.d.ts
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { AccountInformationApi, ApiDisclaimerApi, ApiStatusApi, AuthenticationApi, ConnectionsApi, ErrorLogsApi, OptionsApi, PortfolioManagementApi, ReferenceDataApi, TradingApi, TransactionsAndReportingApi } from "./api";
|
|
13
13
|
import { ConfigurationParameters } from "./configuration";
|
|
14
|
-
|
|
14
|
+
import { SnaptradeCustom } from "./client-custom";
|
|
15
|
+
export declare class Snaptrade extends SnaptradeCustom {
|
|
15
16
|
readonly accountInformation: AccountInformationApi;
|
|
16
17
|
readonly apiDisclaimer: ApiDisclaimerApi;
|
|
17
18
|
readonly apiStatus: ApiStatusApi;
|
package/dist/client.js
CHANGED
|
@@ -10,25 +10,44 @@
|
|
|
10
10
|
* https://konfigthis.com
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
|
+
var __extends = (this && this.__extends) || (function () {
|
|
14
|
+
var extendStatics = function (d, b) {
|
|
15
|
+
extendStatics = Object.setPrototypeOf ||
|
|
16
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
17
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
18
|
+
return extendStatics(d, b);
|
|
19
|
+
};
|
|
20
|
+
return function (d, b) {
|
|
21
|
+
if (typeof b !== "function" && b !== null)
|
|
22
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
23
|
+
extendStatics(d, b);
|
|
24
|
+
function __() { this.constructor = d; }
|
|
25
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
13
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
29
|
exports.Snaptrade = void 0;
|
|
15
30
|
var api_1 = require("./api");
|
|
16
31
|
var configuration_1 = require("./configuration");
|
|
17
|
-
var
|
|
32
|
+
var client_custom_1 = require("./client-custom");
|
|
33
|
+
var Snaptrade = /** @class */ (function (_super) {
|
|
34
|
+
__extends(Snaptrade, _super);
|
|
18
35
|
function Snaptrade(configurationParameters) {
|
|
36
|
+
var _this = _super.call(this, configurationParameters) || this;
|
|
19
37
|
var configuration = new configuration_1.Configuration(configurationParameters);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
_this.accountInformation = new api_1.AccountInformationApi(configuration);
|
|
39
|
+
_this.apiDisclaimer = new api_1.ApiDisclaimerApi(configuration);
|
|
40
|
+
_this.apiStatus = new api_1.ApiStatusApi(configuration);
|
|
41
|
+
_this.authentication = new api_1.AuthenticationApi(configuration);
|
|
42
|
+
_this.connections = new api_1.ConnectionsApi(configuration);
|
|
43
|
+
_this.errorLogs = new api_1.ErrorLogsApi(configuration);
|
|
44
|
+
_this.options = new api_1.OptionsApi(configuration);
|
|
45
|
+
_this.portfolioManagement = new api_1.PortfolioManagementApi(configuration);
|
|
46
|
+
_this.referenceData = new api_1.ReferenceDataApi(configuration);
|
|
47
|
+
_this.trading = new api_1.TradingApi(configuration);
|
|
48
|
+
_this.transactionsAndReporting = new api_1.TransactionsAndReportingApi(configuration);
|
|
49
|
+
return _this;
|
|
31
50
|
}
|
|
32
51
|
return Snaptrade;
|
|
33
|
-
}());
|
|
52
|
+
}(client_custom_1.SnaptradeCustom));
|
|
34
53
|
exports.Snaptrade = Snaptrade;
|
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/
|
|
37
|
+
this.userAgent = param.userAgent === undefined ? "Konfig/7.0.0/typescript" : param.userAgent;
|
|
38
38
|
this.formDataCtor = param.formDataCtor;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
* https://konfigthis.com
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import { BrokerageAuthorization } from './brokerage-authorization';
|
|
13
12
|
/**
|
|
14
13
|
* SnapTradeUser Investment Account
|
|
15
14
|
* @export
|
|
@@ -25,10 +24,10 @@ export interface SnapTradeHoldingsAccount {
|
|
|
25
24
|
'id'?: string;
|
|
26
25
|
/**
|
|
27
26
|
*
|
|
28
|
-
* @type {
|
|
27
|
+
* @type {string}
|
|
29
28
|
* @memberof SnapTradeHoldingsAccount
|
|
30
29
|
*/
|
|
31
|
-
'brokerage_authorization'?:
|
|
30
|
+
'brokerage_authorization'?: string;
|
|
32
31
|
/**
|
|
33
32
|
*
|
|
34
33
|
* @type {string}
|
package/dist/models/symbol.d.ts
CHANGED
|
@@ -48,8 +48,8 @@ Name | Type | Description | Notes
|
|
|
48
48
|
------------- | ------------- | ------------- | -------------
|
|
49
49
|
**userId** | [**string**] | | defaults to undefined
|
|
50
50
|
**userSecret** | [**string**] | | defaults to undefined
|
|
51
|
-
**startDate** | [**string**] | | (optional) defaults to undefined
|
|
52
|
-
**endDate** | [**string**] | | (optional) defaults to undefined
|
|
51
|
+
**startDate** | [**string | Date**] | | (optional) defaults to undefined
|
|
52
|
+
**endDate** | [**string | Date**] | | (optional) defaults to undefined
|
|
53
53
|
**accounts** | [**string**] | Optional comma seperated list of account IDs used to filter the request on specific accounts | (optional) defaults to undefined
|
|
54
54
|
**brokerageAuthorizations** | [**string**] | Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations | (optional) defaults to undefined
|
|
55
55
|
|
|
@@ -111,8 +111,8 @@ console.log(getReportingCustomRangeResponse)
|
|
|
111
111
|
|
|
112
112
|
Name | Type | Description | Notes
|
|
113
113
|
------------- | ------------- | ------------- | -------------
|
|
114
|
-
**startDate** | [**string**] | | defaults to undefined
|
|
115
|
-
**endDate** | [**string**] | | defaults to undefined
|
|
114
|
+
**startDate** | [**string | Date**] | | defaults to undefined
|
|
115
|
+
**endDate** | [**string | Date**] | | defaults to undefined
|
|
116
116
|
**userId** | [**string**] | | defaults to undefined
|
|
117
117
|
**userSecret** | [**string**] | | defaults to undefined
|
|
118
118
|
**accounts** | [**string**] | Optional comma seperated list of account IDs used to filter the request on specific accounts | (optional) defaults to undefined
|
package/index.test.ts
CHANGED
|
@@ -88,6 +88,66 @@ it("getUserAccountBalance", async () => {
|
|
|
88
88
|
console.log(response.data);
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
it("getActivities", async () => {
|
|
92
|
+
const snaptrade = new Snaptrade({
|
|
93
|
+
consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
|
|
94
|
+
clientId: process.env.SNAPTRADE_CLIENT_ID,
|
|
95
|
+
});
|
|
96
|
+
const userId = process.env.SNAPTRADE_TEST_USER_ID;
|
|
97
|
+
const userSecret = process.env.SNAPTRADE_TEST_USER_SECRET;
|
|
98
|
+
let activities = await snaptrade.transactionsAndReporting.getActivities({
|
|
99
|
+
userId,
|
|
100
|
+
userSecret,
|
|
101
|
+
});
|
|
102
|
+
console.log(activities.data);
|
|
103
|
+
expect(activities).not.toBeNull();
|
|
104
|
+
// create two variables "startDate" and "endDate" that are strings representing 1 year ago and today in yyyy-mm-dd format using today's date
|
|
105
|
+
const startDate = "2020-01-01";
|
|
106
|
+
const endDate = "2020-12-31";
|
|
107
|
+
activities = await snaptrade.transactionsAndReporting.getActivities({
|
|
108
|
+
userId,
|
|
109
|
+
userSecret,
|
|
110
|
+
startDate,
|
|
111
|
+
endDate,
|
|
112
|
+
});
|
|
113
|
+
console.log(activities.data);
|
|
114
|
+
expect(activities).not.toBeNull();
|
|
115
|
+
// create two variables "startDate" and "endDate" that are Date instances representing 1 year ago and today
|
|
116
|
+
const endDate2 = new Date();
|
|
117
|
+
// create variable startDate2 which is 1 year before endDate2
|
|
118
|
+
const startDate2 = new Date(endDate2);
|
|
119
|
+
startDate2.setFullYear(startDate2.getFullYear() - 1);
|
|
120
|
+
activities = await snaptrade.transactionsAndReporting.getActivities({
|
|
121
|
+
userId,
|
|
122
|
+
userSecret,
|
|
123
|
+
startDate: startDate2,
|
|
124
|
+
endDate: endDate2,
|
|
125
|
+
});
|
|
126
|
+
console.log(activities.data);
|
|
127
|
+
expect(activities).not.toBeNull();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("getUserHoldings", async () => {
|
|
131
|
+
const snaptrade = new Snaptrade({
|
|
132
|
+
consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
|
|
133
|
+
clientId: process.env.SNAPTRADE_CLIENT_ID,
|
|
134
|
+
});
|
|
135
|
+
const userId = process.env.SNAPTRADE_TEST_USER_ID;
|
|
136
|
+
const userSecret = process.env.SNAPTRADE_TEST_USER_SECRET;
|
|
137
|
+
const accounts = await snaptrade.accountInformation.listUserAccounts({
|
|
138
|
+
userId,
|
|
139
|
+
userSecret,
|
|
140
|
+
});
|
|
141
|
+
const holdings = await snaptrade.accountInformation.getUserHoldings({
|
|
142
|
+
userId,
|
|
143
|
+
userSecret,
|
|
144
|
+
accountId: accounts.data[0].id,
|
|
145
|
+
});
|
|
146
|
+
// assert holdings is not null with jest
|
|
147
|
+
expect(holdings).not.toBeNull();
|
|
148
|
+
console.log(holdings.data);
|
|
149
|
+
});
|
|
150
|
+
|
|
91
151
|
it.skip("getOptionsChain", async () => {
|
|
92
152
|
const snaptrade = new Snaptrade({
|
|
93
153
|
consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
|
|
@@ -12,9 +12,6 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
// May contain unused imports in some cases
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
import { BrokerageAuthorization } from './brokerage-authorization';
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* SnapTradeUser Investment Account
|
|
@@ -32,10 +29,10 @@ export interface SnapTradeHoldingsAccount {
|
|
|
32
29
|
'id'?: string;
|
|
33
30
|
/**
|
|
34
31
|
*
|
|
35
|
-
* @type {
|
|
32
|
+
* @type {string}
|
|
36
33
|
* @memberof SnapTradeHoldingsAccount
|
|
37
34
|
*/
|
|
38
|
-
'brokerage_authorization'?:
|
|
35
|
+
'brokerage_authorization'?: string;
|
|
39
36
|
/**
|
|
40
37
|
*
|
|
41
38
|
* @type {string}
|
package/models/symbol.ts
CHANGED