snaptrade-typescript-sdk 8.7.0 → 8.9.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 +1 -3
- package/dist/api/portfolio-management-api.d.ts +0 -47
- package/dist/api/portfolio-management-api.js +0 -103
- package/dist/api.d.ts +0 -1
- package/dist/api.js +0 -1
- package/dist/client.d.ts +1 -2
- package/dist/client.js +0 -1
- package/dist/configuration.js +1 -1
- package/dist/models/index.d.ts +0 -1
- package/dist/models/index.js +0 -1
- package/package.json +4 -1
- package/.konfig/generate-id.txt +0 -1
- package/.konfigignore +0 -3
- package/api/account-information-api-custom.ts +0 -3
- package/api/account-information-api.ts +0 -1062
- package/api/api-disclaimer-api-custom.ts +0 -3
- package/api/api-disclaimer-api.ts +0 -183
- package/api/api-status-api-custom.ts +0 -3
- package/api/api-status-api.ts +0 -128
- package/api/authentication-api-custom.ts +0 -3
- package/api/authentication-api.ts +0 -568
- package/api/connections-api-custom.ts +0 -3
- package/api/connections-api.ts +0 -544
- package/api/error-logs-api-custom.ts +0 -3
- package/api/error-logs-api.ts +0 -174
- package/api/options-api-custom.ts +0 -3
- package/api/options-api.ts +0 -739
- package/api/portfolio-management-api-custom.ts +0 -3
- package/api/portfolio-management-api.ts +0 -3301
- package/api/reference-data-api-custom.ts +0 -3
- package/api/reference-data-api.ts +0 -1031
- package/api/trading-api-custom.ts +0 -3
- package/api/trading-api.ts +0 -1304
- package/api/transactions-and-reporting-api-custom.ts +0 -3
- package/api/transactions-and-reporting-api.ts +0 -408
- package/api.ts +0 -27
- package/base.ts +0 -70
- package/client-custom.ts +0 -5
- package/client.ts +0 -59
- package/common.ts +0 -163
- package/configuration.ts +0 -131
- package/dist/api/api-disclaimer-api-custom.d.ts +0 -3
- package/dist/api/api-disclaimer-api-custom.js +0 -27
- package/dist/api/api-disclaimer-api.d.ts +0 -97
- package/dist/api/api-disclaimer-api.js +0 -247
- package/dist/models/apidisclaimer-accept-request.d.ts +0 -24
- package/dist/models/apidisclaimer-accept-request.js +0 -15
- package/docs/AccountInformationApi.md +0 -469
- package/docs/ApiDisclaimerApi.md +0 -64
- package/docs/ApiStatusApi.md +0 -58
- package/docs/AuthenticationApi.md +0 -293
- package/docs/ConnectionsApi.md +0 -238
- package/docs/ErrorLogsApi.md +0 -62
- package/docs/OptionsApi.md +0 -312
- package/docs/PortfolioManagementApi.md +0 -1785
- package/docs/ReferenceDataApi.md +0 -568
- package/docs/TradingApi.md +0 -596
- package/docs/TransactionsAndReportingApi.md +0 -144
- package/index.test.ts +0 -177
- package/index.ts +0 -18
- package/jest.config.ts +0 -11
- package/models/account-holdings-account.ts +0 -61
- package/models/account-holdings.ts +0 -61
- package/models/account-order-record-status.ts +0 -48
- package/models/account-order-record.ts +0 -151
- package/models/account-simple.ts +0 -52
- package/models/account-sync-status.ts +0 -32
- package/models/account.ts +0 -91
- package/models/action.ts +0 -30
- package/models/apidisclaimer-accept-request.ts +0 -29
- package/models/authentication-login-snap-trade-user200-response.ts +0 -31
- package/models/balance.ts +0 -40
- package/models/brokerage-authorization-type-read-only-brokerage.ts +0 -43
- package/models/brokerage-authorization-type-read-only.ts +0 -68
- package/models/brokerage-authorization-type.ts +0 -39
- package/models/brokerage-authorization.ts +0 -82
- package/models/brokerage-symbol.ts +0 -61
- package/models/brokerage-type.ts +0 -37
- package/models/brokerage.ts +0 -136
- package/models/calculated-trade.ts +0 -40
- package/models/cash-restriction.ts +0 -63
- package/models/connections-session-events200-response-inner.ts +0 -25
- package/models/currency.ts +0 -43
- package/models/delete-user-response.ts +0 -37
- package/models/dividend-at-date.ts +0 -43
- package/models/encrypted-response-encrypted-message-data.ts +0 -43
- package/models/encrypted-response.ts +0 -38
- package/models/exchange-rate-pairs.ts +0 -46
- package/models/exchange.ts +0 -73
- package/models/excluded-asset.ts +0 -34
- package/models/index.ts +0 -109
- package/models/jwt.ts +0 -31
- package/models/login-redirect-uri.ts +0 -35
- package/models/manual-trade-and-impact.ts +0 -49
- package/models/manual-trade-balance.ts +0 -49
- package/models/manual-trade-form.ts +0 -80
- package/models/manual-trade-symbol.ts +0 -64
- package/models/manual-trade.ts +0 -88
- package/models/model-asset-class-details.ts +0 -41
- package/models/model-asset-class-target.ts +0 -34
- package/models/model-asset-class.ts +0 -37
- package/models/model-portfolio-asset-class.ts +0 -40
- package/models/model-portfolio-details.ts +0 -50
- package/models/model-portfolio-security.ts +0 -40
- package/models/model-portfolio.ts +0 -52
- package/models/model400-failed-request-response.ts +0 -37
- package/models/model401-failed-request-response.ts +0 -37
- package/models/model403-failed-request-response.ts +0 -37
- package/models/model404-failed-request-response.ts +0 -37
- package/models/monthly-dividends.ts +0 -40
- package/models/net-contributions.ts +0 -43
- package/models/net-dividend.ts +0 -46
- package/models/option-chain-inner-chain-per-root-inner-chain-per-strike-price-inner.ts +0 -43
- package/models/option-chain-inner-chain-per-root-inner.ts +0 -46
- package/models/option-chain-inner.ts +0 -58
- package/models/option-leg.ts +0 -53
- package/models/option-strategy-legs-inner.ts +0 -47
- package/models/option-strategy.ts +0 -61
- package/models/options-get-option-strategy-request.ts +0 -51
- package/models/options-holdings.ts +0 -67
- package/models/options-place-option-strategy-request.ts +0 -57
- package/models/options-position.ts +0 -73
- package/models/options-symbol.ts +0 -94
- package/models/order-type.ts +0 -32
- package/models/partner-data.ts +0 -100
- package/models/past-value.ts +0 -43
- package/models/performance-custom.ts +0 -154
- package/models/portfolio-group-info.ts +0 -115
- package/models/portfolio-group-position.ts +0 -46
- package/models/portfolio-group-settings.ts +0 -58
- package/models/portfolio-group.ts +0 -37
- package/models/position-symbol.ts +0 -64
- package/models/position.ts +0 -64
- package/models/redirect-tokenand-pin.ts +0 -37
- package/models/security-type.ts +0 -49
- package/models/session-event.ts +0 -80
- package/models/snap-trade-apidisclaimer-accept-status.ts +0 -37
- package/models/snap-trade-holdings-account-account-id.ts +0 -82
- package/models/snap-trade-holdings-account.ts +0 -79
- package/models/snap-trade-holdings-total-value.ts +0 -37
- package/models/snap-trade-login-user-request-body.ts +0 -61
- package/models/snap-trade-register-user-request-body.ts +0 -35
- package/models/status.ts +0 -43
- package/models/strategy-impact-legs-inner.ts +0 -67
- package/models/strategy-impact.ts +0 -94
- package/models/strategy-order-place-orders-inner-legs-inner.ts +0 -67
- package/models/strategy-order-place-orders-inner.ts +0 -286
- package/models/strategy-order-place.ts +0 -40
- package/models/strategy-order-record.ts +0 -133
- package/models/strategy-quotes-greek.ts +0 -55
- package/models/strategy-quotes.ts +0 -67
- package/models/sub-period-return-rate.ts +0 -43
- package/models/symbol-query.ts +0 -29
- package/models/symbol.ts +0 -76
- package/models/symbols-quotes.ts +0 -64
- package/models/target-asset.ts +0 -62
- package/models/time-in-force.ts +0 -31
- package/models/trade-execution-status.ts +0 -105
- package/models/trade-impact.ts +0 -61
- package/models/trade.ts +0 -88
- package/models/trading-cancel-user-account-order-request.ts +0 -29
- package/models/trading-place-ocoorder-request.ts +0 -35
- package/models/transactions-status.ts +0 -35
- package/models/underlying-symbol.ts +0 -76
- package/models/universal-activity.ts +0 -127
- package/models/universal-symbol-ticker.ts +0 -82
- package/models/universal-symbol.ts +0 -80
- package/models/user-error-log.ts +0 -61
- package/models/user-idand-secret.ts +0 -37
- package/models/user-settings.ts +0 -88
- package/models/usexchange.ts +0 -79
- package/pagination/page-types.ts +0 -34
- package/pagination/page.ts +0 -58
- package/pagination/pageable.ts +0 -113
- package/pagination/paginate.ts +0 -41
- package/requestAfterHook.ts +0 -53
- package/requestBeforeHook.ts +0 -15
- package/tsconfig.json +0 -22
- package/tsconfig.test.json +0 -6
package/pagination/pageable.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SnapTrade
|
|
3
|
-
* Connect brokerage accounts to your app for live positions and trading
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 1.0.0
|
|
6
|
-
* Contact: api@snaptrade.com
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
9
|
-
* https://konfigthis.com
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { AxiosPromise } from "axios";
|
|
14
|
-
import {
|
|
15
|
-
PageBase,
|
|
16
|
-
PageInfo,
|
|
17
|
-
PageParameterProperties,
|
|
18
|
-
PageParameters,
|
|
19
|
-
} from "./page-types";
|
|
20
|
-
|
|
21
|
-
export type PageParametersBase<Parameters> = Parameters & {
|
|
22
|
-
requestBody?: Parameters;
|
|
23
|
-
};
|
|
24
|
-
export type PageRequest<
|
|
25
|
-
Data extends PageInfo,
|
|
26
|
-
Parameters extends PageParameters
|
|
27
|
-
> = (parameters: Parameters) => AxiosPromise<Data>;
|
|
28
|
-
|
|
29
|
-
export abstract class Pageable<
|
|
30
|
-
Data extends PageInfo,
|
|
31
|
-
Parameters extends PageParameters
|
|
32
|
-
> {
|
|
33
|
-
readonly data: Data;
|
|
34
|
-
protected readonly initialParameters: Parameters;
|
|
35
|
-
private readonly _request: PageRequest<Data, Parameters>;
|
|
36
|
-
async previous(): Promise<PageBase<Data, Parameters>> {
|
|
37
|
-
if (!this.hasPrevious()) return this;
|
|
38
|
-
if (this.previousParameters === null) return this;
|
|
39
|
-
const response = await this.makeRequest(this.previousParameters);
|
|
40
|
-
return this.withData(response.data);
|
|
41
|
-
}
|
|
42
|
-
async next(): Promise<PageBase<Data, Parameters>> {
|
|
43
|
-
if (!this.hasNext()) return this;
|
|
44
|
-
if (this.nextParameters === null) return this;
|
|
45
|
-
const response = await this.makeRequest(this.nextParameters);
|
|
46
|
-
return this.withData(response.data);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Generate minimal set of parameters needed to get the previous page
|
|
51
|
-
*/
|
|
52
|
-
protected abstract get previousParameters(): PageParameterProperties | null;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Generate minimal set of parameters needed to get the next page
|
|
56
|
-
*/
|
|
57
|
-
protected abstract get nextParameters(): PageParameterProperties | null;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Is there a previous page based on PageInfo?
|
|
61
|
-
*/
|
|
62
|
-
abstract hasPrevious(): boolean;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Is there a next page based on PageInfo?
|
|
66
|
-
*/
|
|
67
|
-
abstract hasNext(): boolean;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Helper for invoking a request. Handles request body and parameter based pagination
|
|
71
|
-
*/
|
|
72
|
-
private makeRequest(parameters: PageParameterProperties): AxiosPromise<Data> {
|
|
73
|
-
// Handle request body pagination
|
|
74
|
-
if (this.initialParameters.requestBody !== undefined) {
|
|
75
|
-
return this._request({
|
|
76
|
-
...this.initialParameters,
|
|
77
|
-
requestBody: { ...this.initialParameters.requestBody, ...parameters },
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return this._request({ ...this.initialParameters, ...parameters });
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Helper for creating new page
|
|
85
|
-
*/
|
|
86
|
-
private withData(data: Data): PageBase<Data, Parameters> {
|
|
87
|
-
return this.make({
|
|
88
|
-
data,
|
|
89
|
-
initialParameters: this.initialParameters,
|
|
90
|
-
request: this._request,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
constructor({
|
|
95
|
-
data,
|
|
96
|
-
initialParameters,
|
|
97
|
-
request,
|
|
98
|
-
}: {
|
|
99
|
-
data: Data;
|
|
100
|
-
initialParameters: Parameters;
|
|
101
|
-
request: PageRequest<Data, Parameters>;
|
|
102
|
-
}) {
|
|
103
|
-
this.data = data;
|
|
104
|
-
this._request = request;
|
|
105
|
-
this.initialParameters = initialParameters;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
abstract make(parameters: {
|
|
109
|
-
data: Data;
|
|
110
|
-
initialParameters: Parameters;
|
|
111
|
-
request: PageRequest<Data, Parameters>;
|
|
112
|
-
}): Pageable<Data, Parameters>;
|
|
113
|
-
}
|
package/pagination/paginate.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SnapTrade
|
|
3
|
-
* Connect brokerage accounts to your app for live positions and trading
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 1.0.0
|
|
6
|
-
* Contact: api@snaptrade.com
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
9
|
-
* https://konfigthis.com
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { PageBase, PageInfo, PageParameters } from "./page-types";
|
|
14
|
-
import { Page } from "./page";
|
|
15
|
-
import { PageRequest } from "./pageable";
|
|
16
|
-
|
|
17
|
-
export const paginate = <
|
|
18
|
-
Data extends PageInfo,
|
|
19
|
-
Parameters extends PageParameters
|
|
20
|
-
>({
|
|
21
|
-
request,
|
|
22
|
-
initialParameters,
|
|
23
|
-
}: {
|
|
24
|
-
request: PageRequest<Data, Parameters>;
|
|
25
|
-
initialParameters: Parameters;
|
|
26
|
-
}): Promise<PageBase<Data, Parameters>> => {
|
|
27
|
-
return new Promise(async (resolve, reject) => {
|
|
28
|
-
try {
|
|
29
|
-
const data = await request(initialParameters);
|
|
30
|
-
resolve(
|
|
31
|
-
new Page({
|
|
32
|
-
data: data.data,
|
|
33
|
-
initialParameters,
|
|
34
|
-
request: (parameters) => request(parameters),
|
|
35
|
-
})
|
|
36
|
-
);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
reject(error);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
package/requestAfterHook.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import * as crypto from "crypto";
|
|
2
|
-
import { RequestArgs } from "./base";
|
|
3
|
-
import { Configuration } from "./configuration";
|
|
4
|
-
|
|
5
|
-
const JSONstringifyOrder = (obj: any) => {
|
|
6
|
-
var allKeys: any = [];
|
|
7
|
-
var seen: any = {};
|
|
8
|
-
JSON.stringify(obj, function (key, value) {
|
|
9
|
-
if (!(key in seen)) {
|
|
10
|
-
allKeys.push(key);
|
|
11
|
-
seen[key] = null;
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
});
|
|
15
|
-
allKeys.sort();
|
|
16
|
-
return JSON.stringify(obj, allKeys);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function requestAfterHook(request: {
|
|
20
|
-
axiosArgs: RequestArgs;
|
|
21
|
-
basePath: string;
|
|
22
|
-
url: string;
|
|
23
|
-
configuration?: Configuration;
|
|
24
|
-
}): void {
|
|
25
|
-
const { configuration, basePath, axiosArgs, url } = request;
|
|
26
|
-
if (configuration?.consumerKey === undefined)
|
|
27
|
-
throw Error("Consumer key is required");
|
|
28
|
-
const consumerKey = encodeURI(configuration.consumerKey);
|
|
29
|
-
const requestData =
|
|
30
|
-
axiosArgs.options.data === undefined || axiosArgs.options.data === "{}"
|
|
31
|
-
? null
|
|
32
|
-
: JSON.parse(axiosArgs.options.data);
|
|
33
|
-
const path =
|
|
34
|
-
axiosArgs.url.indexOf("?") === -1
|
|
35
|
-
? `${axiosArgs.url}`
|
|
36
|
-
: `${axiosArgs.url.split("?")[0]}`;
|
|
37
|
-
const requestPath = `/api/v1${path}`;
|
|
38
|
-
const requestQuery = url
|
|
39
|
-
.replace(basePath, "")
|
|
40
|
-
.replace(path, "")
|
|
41
|
-
.replace("?", "");
|
|
42
|
-
const sigObject = {
|
|
43
|
-
content: requestData,
|
|
44
|
-
path: requestPath,
|
|
45
|
-
query: requestQuery,
|
|
46
|
-
};
|
|
47
|
-
const sigContent = JSONstringifyOrder(sigObject);
|
|
48
|
-
const hmac = crypto.createHmac("sha256", consumerKey);
|
|
49
|
-
const signature = hmac.update(sigContent).digest("base64");
|
|
50
|
-
|
|
51
|
-
if (axiosArgs.options.headers)
|
|
52
|
-
axiosArgs.options.headers["Signature"] = signature;
|
|
53
|
-
}
|
package/requestBeforeHook.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Configuration } from "./configuration";
|
|
2
|
-
import { AxiosRequestConfig } from "axios";
|
|
3
|
-
|
|
4
|
-
export function requestBeforeHook(request: {
|
|
5
|
-
requestBody?: any;
|
|
6
|
-
queryParameters: Record<string, any>;
|
|
7
|
-
path: string;
|
|
8
|
-
requestConfig: AxiosRequestConfig;
|
|
9
|
-
configuration?: Configuration;
|
|
10
|
-
}): void {
|
|
11
|
-
const { queryParameters } = request;
|
|
12
|
-
queryParameters["timestamp"] = Math.round(
|
|
13
|
-
new Date().getTime() / 1000
|
|
14
|
-
).toString();
|
|
15
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"declaration": true,
|
|
4
|
-
"target": "ES5",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"noImplicitAny": true,
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"rootDir": ".",
|
|
9
|
-
"lib": [
|
|
10
|
-
"es6",
|
|
11
|
-
"dom"
|
|
12
|
-
],
|
|
13
|
-
"typeRoots": [
|
|
14
|
-
"node_modules/@types"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
"exclude": [
|
|
18
|
-
"dist",
|
|
19
|
-
"index.test.ts",
|
|
20
|
-
"node_modules"
|
|
21
|
-
]
|
|
22
|
-
}
|