snaptrade-typescript-sdk 8.7.0 → 8.8.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 -2
- package/dist/api/portfolio-management-api.d.ts +0 -47
- package/dist/api/portfolio-management-api.js +0 -103
- package/dist/configuration.js +1 -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/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/common.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* SnapTrade
|
|
5
|
-
* Connect brokerage accounts to your app for live positions and trading
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 1.0.0
|
|
8
|
-
* Contact: api@snaptrade.com
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
11
|
-
* https://konfigthis.com
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { Configuration } from "./configuration";
|
|
16
|
-
import { RequiredError, RequestArgs } from "./base";
|
|
17
|
-
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
|
18
|
-
import { requestAfterHook } from "./requestAfterHook";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @export
|
|
23
|
-
*/
|
|
24
|
-
export const DUMMY_BASE_URL = 'https://example.com'
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @throws {RequiredError}
|
|
29
|
-
* @export
|
|
30
|
-
*/
|
|
31
|
-
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
|
32
|
-
if (paramValue === null || paramValue === undefined) {
|
|
33
|
-
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @export
|
|
40
|
-
*/
|
|
41
|
-
export const setApiKeyToObject = async function ({
|
|
42
|
-
object,
|
|
43
|
-
key,
|
|
44
|
-
type,
|
|
45
|
-
keyParamName,
|
|
46
|
-
configuration,
|
|
47
|
-
prefix
|
|
48
|
-
}: {
|
|
49
|
-
object: any
|
|
50
|
-
key?: string
|
|
51
|
-
type?: "Cookie"
|
|
52
|
-
keyParamName: string
|
|
53
|
-
configuration?: Configuration
|
|
54
|
-
prefix?: string
|
|
55
|
-
}) {
|
|
56
|
-
key = key ? key : keyParamName
|
|
57
|
-
let apiKey: string | null | undefined = null
|
|
58
|
-
if (configuration && configuration.apiKey) {
|
|
59
|
-
if (typeof configuration.apiKey === 'function')
|
|
60
|
-
apiKey = await configuration.apiKey(keyParamName)
|
|
61
|
-
else if (typeof configuration.apiKey === 'string')
|
|
62
|
-
apiKey = configuration.apiKey
|
|
63
|
-
else if (typeof configuration.apiKey === 'object') {
|
|
64
|
-
if (keyParamName in configuration.apiKey)
|
|
65
|
-
apiKey = configuration.apiKey[keyParamName]
|
|
66
|
-
} else
|
|
67
|
-
throw Error(
|
|
68
|
-
`Unexpected type ${typeof configuration.apiKey} for Configuration.apiKey`
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
if (!apiKey) return
|
|
72
|
-
object[key] = prefix !== undefined ? `${prefix}${apiKey}` : apiKey
|
|
73
|
-
if (type === "Cookie")
|
|
74
|
-
object[key] = `${keyParamName}=${object[key]}`
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @export
|
|
80
|
-
*/
|
|
81
|
-
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
|
82
|
-
if (configuration && (configuration.username || configuration.password)) {
|
|
83
|
-
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* @export
|
|
90
|
-
*/
|
|
91
|
-
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
|
92
|
-
if (configuration && configuration.accessToken) {
|
|
93
|
-
const accessToken = typeof configuration.accessToken === 'function'
|
|
94
|
-
? await configuration.accessToken()
|
|
95
|
-
: await configuration.accessToken;
|
|
96
|
-
object["Authorization"] = "Bearer " + accessToken;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
|
101
|
-
if (typeof parameter === "object") {
|
|
102
|
-
if (Array.isArray(parameter)) {
|
|
103
|
-
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
Object.keys(parameter).forEach(currentKey =>
|
|
107
|
-
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
if (urlSearchParams.has(key)) {
|
|
113
|
-
urlSearchParams.append(key, parameter);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
urlSearchParams.set(key, parameter);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* @export
|
|
124
|
-
*/
|
|
125
|
-
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
|
126
|
-
const searchParams = new URLSearchParams(url.search);
|
|
127
|
-
setFlattenedQueryParams(searchParams, objects);
|
|
128
|
-
url.search = searchParams.toString();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
* @export
|
|
134
|
-
*/
|
|
135
|
-
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
|
136
|
-
const nonString = typeof value !== 'string';
|
|
137
|
-
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
138
|
-
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
139
|
-
: nonString;
|
|
140
|
-
return needsSerialization
|
|
141
|
-
? JSON.stringify(value !== undefined ? value : {})
|
|
142
|
-
: (value || "");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @export
|
|
148
|
-
*/
|
|
149
|
-
export const toPathString = function (url: URL) {
|
|
150
|
-
return url.pathname + url.search + url.hash
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
*
|
|
155
|
-
* @export
|
|
156
|
-
*/
|
|
157
|
-
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
158
|
-
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
159
|
-
const url = (configuration?.basePath || basePath) + axiosArgs.url
|
|
160
|
-
requestAfterHook({axiosArgs, basePath, url, configuration})
|
|
161
|
-
return axios.request<T, R>({...axiosArgs.options, url});
|
|
162
|
-
};
|
|
163
|
-
}
|
package/configuration.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* SnapTrade
|
|
5
|
-
* Connect brokerage accounts to your app for live positions and trading
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 1.0.0
|
|
8
|
-
* Contact: api@snaptrade.com
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
11
|
-
* https://konfigthis.com
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type ApiKey =
|
|
17
|
-
| string
|
|
18
|
-
| ((keyParamName: string) => string)
|
|
19
|
-
| ((keyParamName: string) => Promise<string>)
|
|
20
|
-
| { [apiKeyName: string]: string | undefined };
|
|
21
|
-
|
|
22
|
-
export interface ConfigurationParameters {
|
|
23
|
-
consumerKey?: string;
|
|
24
|
-
clientId?: string;
|
|
25
|
-
Signature?: string;
|
|
26
|
-
timestamp?: string;
|
|
27
|
-
apiKey?: ApiKey;
|
|
28
|
-
username?: string;
|
|
29
|
-
password?: string;
|
|
30
|
-
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
31
|
-
basePath?: string;
|
|
32
|
-
baseOptions?: any;
|
|
33
|
-
userAgent?: string;
|
|
34
|
-
formDataCtor?: new () => any;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class Configuration {
|
|
38
|
-
/**
|
|
39
|
-
* Client state
|
|
40
|
-
*/
|
|
41
|
-
consumerKey?: string;
|
|
42
|
-
/**
|
|
43
|
-
* parameter for apiKey security
|
|
44
|
-
* @param name security name
|
|
45
|
-
* @memberof Configuration
|
|
46
|
-
*/
|
|
47
|
-
apiKey?: ApiKey;
|
|
48
|
-
/**
|
|
49
|
-
* parameter for basic security
|
|
50
|
-
*
|
|
51
|
-
* @type {string}
|
|
52
|
-
* @memberof Configuration
|
|
53
|
-
*/
|
|
54
|
-
username?: string;
|
|
55
|
-
/**
|
|
56
|
-
* parameter for basic security
|
|
57
|
-
*
|
|
58
|
-
* @type {string}
|
|
59
|
-
* @memberof Configuration
|
|
60
|
-
*/
|
|
61
|
-
password?: string;
|
|
62
|
-
/**
|
|
63
|
-
* parameter for oauth2 security
|
|
64
|
-
* @param name security name
|
|
65
|
-
* @param scopes oauth2 scope
|
|
66
|
-
* @memberof Configuration
|
|
67
|
-
*/
|
|
68
|
-
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
69
|
-
/**
|
|
70
|
-
* override base path
|
|
71
|
-
*
|
|
72
|
-
* @type {string}
|
|
73
|
-
* @memberof Configuration
|
|
74
|
-
*/
|
|
75
|
-
basePath?: string;
|
|
76
|
-
/**
|
|
77
|
-
* base options for axios calls
|
|
78
|
-
*
|
|
79
|
-
* @type {any}
|
|
80
|
-
* @memberof Configuration
|
|
81
|
-
*/
|
|
82
|
-
baseOptions?: any;
|
|
83
|
-
/**
|
|
84
|
-
* The FormData constructor that will be used to create multipart form data
|
|
85
|
-
* requests. You can inject this here so that execution environments that
|
|
86
|
-
* do not support the FormData class can still run the generated client.
|
|
87
|
-
*
|
|
88
|
-
* @type {new () => FormData}
|
|
89
|
-
*/
|
|
90
|
-
formDataCtor?: new () => any;
|
|
91
|
-
/**
|
|
92
|
-
* Default User-Agent header
|
|
93
|
-
*/
|
|
94
|
-
userAgent: string;
|
|
95
|
-
|
|
96
|
-
constructor(param: ConfigurationParameters = {}) {
|
|
97
|
-
this.consumerKey = param.consumerKey
|
|
98
|
-
this.apiKey = param.apiKey
|
|
99
|
-
if (this.apiKey === undefined) {
|
|
100
|
-
this.apiKey = {}
|
|
101
|
-
if (param.clientId !== undefined)
|
|
102
|
-
this.apiKey["clientId"] = param.clientId
|
|
103
|
-
if (param.Signature !== undefined)
|
|
104
|
-
this.apiKey["Signature"] = param.Signature
|
|
105
|
-
if (param.timestamp !== undefined)
|
|
106
|
-
this.apiKey["timestamp"] = param.timestamp
|
|
107
|
-
}
|
|
108
|
-
this.username = param.username;
|
|
109
|
-
this.password = param.password;
|
|
110
|
-
this.accessToken = param.accessToken;
|
|
111
|
-
this.basePath = param.basePath;
|
|
112
|
-
this.baseOptions = param.baseOptions ?? {};
|
|
113
|
-
this.userAgent = param.userAgent === undefined ? "Konfig/8.7.0/typescript" : param.userAgent;
|
|
114
|
-
this.formDataCtor = param.formDataCtor;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Check if the given MIME is a JSON MIME.
|
|
119
|
-
* JSON MIME examples:
|
|
120
|
-
* application/json
|
|
121
|
-
* application/json; charset=UTF8
|
|
122
|
-
* APPLICATION/JSON
|
|
123
|
-
* application/vnd.company+json
|
|
124
|
-
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
125
|
-
* @return True if the given MIME is JSON, false otherwise.
|
|
126
|
-
*/
|
|
127
|
-
public isJsonMime(mime: string): boolean {
|
|
128
|
-
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
129
|
-
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
130
|
-
}
|
|
131
|
-
}
|