snaptrade-typescript-sdk 8.19.0 → 8.20.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.
Files changed (75) hide show
  1. package/README.md +2 -2
  2. package/dist/api/account-information-api-generated.d.ts +525 -0
  3. package/dist/api/account-information-api-generated.js +765 -0
  4. package/dist/api/account-information-api.d.ts +3 -525
  5. package/dist/api/account-information-api.js +17 -1044
  6. package/dist/api/api-status-api-generated.d.ts +69 -0
  7. package/dist/api/api-status-api-generated.js +131 -0
  8. package/dist/api/api-status-api.d.ts +3 -69
  9. package/dist/api/api-status-api.js +17 -198
  10. package/dist/api/authentication-api-generated.d.ts +266 -0
  11. package/dist/api/authentication-api-generated.js +461 -0
  12. package/dist/api/authentication-api.d.ts +3 -266
  13. package/dist/api/authentication-api.js +17 -656
  14. package/dist/api/connections-api-generated.d.ts +274 -0
  15. package/dist/api/connections-api-generated.js +411 -0
  16. package/dist/api/connections-api.d.ts +3 -274
  17. package/dist/api/connections-api.js +17 -578
  18. package/dist/api/error-logs-api-generated.d.ts +93 -0
  19. package/dist/api/error-logs-api-generated.js +152 -0
  20. package/dist/api/error-logs-api.d.ts +3 -93
  21. package/dist/api/error-logs-api.js +17 -235
  22. package/dist/api/options-api-generated.d.ts +368 -0
  23. package/dist/api/options-api-generated.js +530 -0
  24. package/dist/api/options-api.d.ts +3 -368
  25. package/dist/api/options-api.js +17 -725
  26. package/dist/api/reference-data-api-generated.d.ts +467 -0
  27. package/dist/api/reference-data-api-generated.js +872 -0
  28. package/dist/api/reference-data-api.d.ts +3 -467
  29. package/dist/api/reference-data-api.js +17 -1241
  30. package/dist/api/trading-api-generated.d.ts +402 -0
  31. package/dist/api/trading-api-generated.js +613 -0
  32. package/dist/api/trading-api.d.ts +3 -402
  33. package/dist/api/trading-api.js +17 -836
  34. package/dist/api/transactions-and-reporting-api-generated.d.ts +217 -0
  35. package/dist/api/transactions-and-reporting-api-generated.js +287 -0
  36. package/dist/api/transactions-and-reporting-api.d.ts +3 -217
  37. package/dist/api/transactions-and-reporting-api.js +17 -398
  38. package/dist/base.js +10 -31
  39. package/dist/client-custom.js +3 -5
  40. package/dist/client.d.ts +1 -1
  41. package/dist/client.js +17 -35
  42. package/dist/common.js +64 -123
  43. package/dist/configuration.d.ts +1 -1
  44. package/dist/configuration.js +9 -11
  45. package/dist/error.d.ts +56 -0
  46. package/dist/error.js +104 -0
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.js +1 -0
  49. package/dist/jest.config.js +1 -1
  50. package/dist/pagination/page.js +15 -43
  51. package/dist/pagination/pageable.js +32 -88
  52. package/dist/pagination/paginate.js +15 -53
  53. package/dist/requestAfterHook.js +14 -14
  54. package/dist/requestBeforeHook.js +1 -1
  55. package/dist/requestBeforeUrlHook.d.ts +7 -0
  56. package/dist/requestBeforeUrlHook.js +5 -0
  57. package/package.json +2 -2
  58. package/dist/api/account-information-api-custom.d.ts +0 -3
  59. package/dist/api/account-information-api-custom.js +0 -27
  60. package/dist/api/api-status-api-custom.d.ts +0 -3
  61. package/dist/api/api-status-api-custom.js +0 -27
  62. package/dist/api/authentication-api-custom.d.ts +0 -3
  63. package/dist/api/authentication-api-custom.js +0 -27
  64. package/dist/api/connections-api-custom.d.ts +0 -3
  65. package/dist/api/connections-api-custom.js +0 -27
  66. package/dist/api/error-logs-api-custom.d.ts +0 -3
  67. package/dist/api/error-logs-api-custom.js +0 -27
  68. package/dist/api/options-api-custom.d.ts +0 -3
  69. package/dist/api/options-api-custom.js +0 -27
  70. package/dist/api/reference-data-api-custom.d.ts +0 -3
  71. package/dist/api/reference-data-api-custom.js +0 -27
  72. package/dist/api/trading-api-custom.d.ts +0 -3
  73. package/dist/api/trading-api-custom.js +0 -27
  74. package/dist/api/transactions-and-reporting-api-custom.d.ts +0 -3
  75. package/dist/api/transactions-and-reporting-api-custom.js +0 -27
@@ -0,0 +1,613 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * SnapTrade
6
+ * Connect brokerage accounts to your app for live positions and trading
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: api@snaptrade.com
10
+ *
11
+ * NOTE: This file is auto generated by Konfig (https://konfigthis.com).
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.TradingApiGenerated = exports.TradingApiFactory = exports.TradingApiFp = exports.TradingApiAxiosParamCreator = void 0;
25
+ const axios_1 = require("axios");
26
+ // Some imports not used depending on template conditions
27
+ // @ts-ignore
28
+ const common_1 = require("../common");
29
+ // @ts-ignore
30
+ const base_1 = require("../base");
31
+ const requestBeforeHook_1 = require("../requestBeforeHook");
32
+ /**
33
+ * TradingApi - axios parameter creator
34
+ * @export
35
+ */
36
+ const TradingApiAxiosParamCreator = function (configuration) {
37
+ return {
38
+ /**
39
+ *
40
+ * @summary Cancel open order in account
41
+ * @param {string} userId
42
+ * @param {string} userSecret
43
+ * @param {string} accountId The ID of the account get positions.
44
+ * @param {TradingCancelUserAccountOrderRequest} tradingCancelUserAccountOrderRequest The Order ID to be canceled
45
+ * @param {*} [options] Override http request option.
46
+ * @throws {RequiredError}
47
+ */
48
+ cancelUserAccountOrder: (userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
49
+ // verify required parameter 'userId' is not null or undefined
50
+ (0, common_1.assertParamExists)('cancelUserAccountOrder', 'userId', userId);
51
+ // verify required parameter 'userSecret' is not null or undefined
52
+ (0, common_1.assertParamExists)('cancelUserAccountOrder', 'userSecret', userSecret);
53
+ // verify required parameter 'accountId' is not null or undefined
54
+ (0, common_1.assertParamExists)('cancelUserAccountOrder', 'accountId', accountId);
55
+ // verify required parameter 'tradingCancelUserAccountOrderRequest' is not null or undefined
56
+ (0, common_1.assertParamExists)('cancelUserAccountOrder', 'tradingCancelUserAccountOrderRequest', tradingCancelUserAccountOrderRequest);
57
+ const localVarPath = `/accounts/{accountId}/orders/cancel`
58
+ .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId !== undefined ? accountId : `-accountId-`)));
59
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
60
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
61
+ let baseOptions;
62
+ if (configuration) {
63
+ baseOptions = configuration.baseOptions;
64
+ }
65
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
66
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
67
+ const localVarQueryParameter = {};
68
+ // authentication PartnerClientId required
69
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "clientId", configuration });
70
+ // authentication PartnerSignature required
71
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, keyParamName: "Signature", configuration });
72
+ // authentication PartnerTimestamp required
73
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "timestamp", configuration });
74
+ if (userId !== undefined) {
75
+ localVarQueryParameter['userId'] = userId;
76
+ }
77
+ if (userSecret !== undefined) {
78
+ localVarQueryParameter['userSecret'] = userSecret;
79
+ }
80
+ localVarHeaderParameter['Content-Type'] = 'application/json';
81
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
82
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
83
+ (0, requestBeforeHook_1.requestBeforeHook)({
84
+ requestBody: tradingCancelUserAccountOrderRequest,
85
+ queryParameters: localVarQueryParameter,
86
+ requestConfig: localVarRequestOptions,
87
+ path: localVarPath,
88
+ configuration
89
+ });
90
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(tradingCancelUserAccountOrderRequest, localVarRequestOptions, configuration);
91
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
92
+ return {
93
+ url: (0, common_1.toPathString)(localVarUrlObj),
94
+ options: localVarRequestOptions,
95
+ };
96
+ }),
97
+ /**
98
+ *
99
+ * @summary Check impact of trades on account.
100
+ * @param {string} userId
101
+ * @param {string} userSecret
102
+ * @param {ManualTradeForm} manualTradeForm
103
+ * @param {*} [options] Override http request option.
104
+ * @throws {RequiredError}
105
+ */
106
+ getOrderImpact: (userId, userSecret, manualTradeForm, options = {}) => __awaiter(this, void 0, void 0, function* () {
107
+ // verify required parameter 'userId' is not null or undefined
108
+ (0, common_1.assertParamExists)('getOrderImpact', 'userId', userId);
109
+ // verify required parameter 'userSecret' is not null or undefined
110
+ (0, common_1.assertParamExists)('getOrderImpact', 'userSecret', userSecret);
111
+ // verify required parameter 'manualTradeForm' is not null or undefined
112
+ (0, common_1.assertParamExists)('getOrderImpact', 'manualTradeForm', manualTradeForm);
113
+ const localVarPath = `/trade/impact`;
114
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
115
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
116
+ let baseOptions;
117
+ if (configuration) {
118
+ baseOptions = configuration.baseOptions;
119
+ }
120
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
121
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
122
+ const localVarQueryParameter = {};
123
+ // authentication PartnerClientId required
124
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "clientId", configuration });
125
+ // authentication PartnerSignature required
126
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, keyParamName: "Signature", configuration });
127
+ // authentication PartnerTimestamp required
128
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "timestamp", configuration });
129
+ if (userId !== undefined) {
130
+ localVarQueryParameter['userId'] = userId;
131
+ }
132
+ if (userSecret !== undefined) {
133
+ localVarQueryParameter['userSecret'] = userSecret;
134
+ }
135
+ localVarHeaderParameter['Content-Type'] = 'application/json';
136
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
137
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
138
+ (0, requestBeforeHook_1.requestBeforeHook)({
139
+ requestBody: manualTradeForm,
140
+ queryParameters: localVarQueryParameter,
141
+ requestConfig: localVarRequestOptions,
142
+ path: localVarPath,
143
+ configuration
144
+ });
145
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(manualTradeForm, localVarRequestOptions, configuration);
146
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
147
+ return {
148
+ url: (0, common_1.toPathString)(localVarUrlObj),
149
+ options: localVarRequestOptions,
150
+ };
151
+ }),
152
+ /**
153
+ *
154
+ * @summary Get symbol quotes
155
+ * @param {string} userId
156
+ * @param {string} userSecret
157
+ * @param {string} symbols List of universal_symbol_id or tickers to get quotes for.
158
+ * @param {string} accountId The ID of the account to get quotes.
159
+ * @param {boolean} [useTicker] Should be set to True if providing tickers.
160
+ * @param {*} [options] Override http request option.
161
+ * @throws {RequiredError}
162
+ */
163
+ getUserAccountQuotes: (userId, userSecret, symbols, accountId, useTicker, options = {}) => __awaiter(this, void 0, void 0, function* () {
164
+ // verify required parameter 'userId' is not null or undefined
165
+ (0, common_1.assertParamExists)('getUserAccountQuotes', 'userId', userId);
166
+ // verify required parameter 'userSecret' is not null or undefined
167
+ (0, common_1.assertParamExists)('getUserAccountQuotes', 'userSecret', userSecret);
168
+ // verify required parameter 'symbols' is not null or undefined
169
+ (0, common_1.assertParamExists)('getUserAccountQuotes', 'symbols', symbols);
170
+ // verify required parameter 'accountId' is not null or undefined
171
+ (0, common_1.assertParamExists)('getUserAccountQuotes', 'accountId', accountId);
172
+ const localVarPath = `/accounts/{accountId}/quotes`
173
+ .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId !== undefined ? accountId : `-accountId-`)));
174
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
175
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
176
+ let baseOptions;
177
+ if (configuration) {
178
+ baseOptions = configuration.baseOptions;
179
+ }
180
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
181
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
182
+ const localVarQueryParameter = {};
183
+ // authentication PartnerClientId required
184
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "clientId", configuration });
185
+ // authentication PartnerSignature required
186
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, keyParamName: "Signature", configuration });
187
+ // authentication PartnerTimestamp required
188
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "timestamp", configuration });
189
+ if (userId !== undefined) {
190
+ localVarQueryParameter['userId'] = userId;
191
+ }
192
+ if (userSecret !== undefined) {
193
+ localVarQueryParameter['userSecret'] = userSecret;
194
+ }
195
+ if (symbols !== undefined) {
196
+ localVarQueryParameter['symbols'] = symbols;
197
+ }
198
+ if (useTicker !== undefined) {
199
+ localVarQueryParameter['use_ticker'] = useTicker;
200
+ }
201
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
202
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
203
+ (0, requestBeforeHook_1.requestBeforeHook)({
204
+ queryParameters: localVarQueryParameter,
205
+ requestConfig: localVarRequestOptions,
206
+ path: localVarPath,
207
+ configuration
208
+ });
209
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
210
+ return {
211
+ url: (0, common_1.toPathString)(localVarUrlObj),
212
+ options: localVarRequestOptions,
213
+ };
214
+ }),
215
+ /**
216
+ *
217
+ * @summary Place a trade with NO validation.
218
+ * @param {string} userId
219
+ * @param {string} userSecret
220
+ * @param {ManualTradeForm} manualTradeForm
221
+ * @param {*} [options] Override http request option.
222
+ * @throws {RequiredError}
223
+ */
224
+ placeForceOrder: (userId, userSecret, manualTradeForm, options = {}) => __awaiter(this, void 0, void 0, function* () {
225
+ // verify required parameter 'userId' is not null or undefined
226
+ (0, common_1.assertParamExists)('placeForceOrder', 'userId', userId);
227
+ // verify required parameter 'userSecret' is not null or undefined
228
+ (0, common_1.assertParamExists)('placeForceOrder', 'userSecret', userSecret);
229
+ // verify required parameter 'manualTradeForm' is not null or undefined
230
+ (0, common_1.assertParamExists)('placeForceOrder', 'manualTradeForm', manualTradeForm);
231
+ const localVarPath = `/trade/place`;
232
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
233
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
234
+ let baseOptions;
235
+ if (configuration) {
236
+ baseOptions = configuration.baseOptions;
237
+ }
238
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
239
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
240
+ const localVarQueryParameter = {};
241
+ // authentication PartnerClientId required
242
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "clientId", configuration });
243
+ // authentication PartnerSignature required
244
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, keyParamName: "Signature", configuration });
245
+ // authentication PartnerTimestamp required
246
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "timestamp", configuration });
247
+ if (userId !== undefined) {
248
+ localVarQueryParameter['userId'] = userId;
249
+ }
250
+ if (userSecret !== undefined) {
251
+ localVarQueryParameter['userSecret'] = userSecret;
252
+ }
253
+ localVarHeaderParameter['Content-Type'] = 'application/json';
254
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
255
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
256
+ (0, requestBeforeHook_1.requestBeforeHook)({
257
+ requestBody: manualTradeForm,
258
+ queryParameters: localVarQueryParameter,
259
+ requestConfig: localVarRequestOptions,
260
+ path: localVarPath,
261
+ configuration
262
+ });
263
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(manualTradeForm, localVarRequestOptions, configuration);
264
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
265
+ return {
266
+ url: (0, common_1.toPathString)(localVarUrlObj),
267
+ options: localVarRequestOptions,
268
+ };
269
+ }),
270
+ /**
271
+ *
272
+ * @summary Place a OCO (One Cancels Other) order
273
+ * @param {string} userId
274
+ * @param {string} userSecret
275
+ * @param {TradingPlaceOCOOrderRequest} tradingPlaceOCOOrderRequest
276
+ * @param {*} [options] Override http request option.
277
+ * @throws {RequiredError}
278
+ */
279
+ placeOCOOrder: (userId, userSecret, tradingPlaceOCOOrderRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
280
+ // verify required parameter 'userId' is not null or undefined
281
+ (0, common_1.assertParamExists)('placeOCOOrder', 'userId', userId);
282
+ // verify required parameter 'userSecret' is not null or undefined
283
+ (0, common_1.assertParamExists)('placeOCOOrder', 'userSecret', userSecret);
284
+ // verify required parameter 'tradingPlaceOCOOrderRequest' is not null or undefined
285
+ (0, common_1.assertParamExists)('placeOCOOrder', 'tradingPlaceOCOOrderRequest', tradingPlaceOCOOrderRequest);
286
+ const localVarPath = `/trade/oco`;
287
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
288
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
289
+ let baseOptions;
290
+ if (configuration) {
291
+ baseOptions = configuration.baseOptions;
292
+ }
293
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
294
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
295
+ const localVarQueryParameter = {};
296
+ // authentication PartnerClientId required
297
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "clientId", configuration });
298
+ // authentication PartnerSignature required
299
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, keyParamName: "Signature", configuration });
300
+ // authentication PartnerTimestamp required
301
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "timestamp", configuration });
302
+ if (userId !== undefined) {
303
+ localVarQueryParameter['userId'] = userId;
304
+ }
305
+ if (userSecret !== undefined) {
306
+ localVarQueryParameter['userSecret'] = userSecret;
307
+ }
308
+ localVarHeaderParameter['Content-Type'] = 'application/json';
309
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
310
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
311
+ (0, requestBeforeHook_1.requestBeforeHook)({
312
+ requestBody: tradingPlaceOCOOrderRequest,
313
+ queryParameters: localVarQueryParameter,
314
+ requestConfig: localVarRequestOptions,
315
+ path: localVarPath,
316
+ configuration
317
+ });
318
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(tradingPlaceOCOOrderRequest, localVarRequestOptions, configuration);
319
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
320
+ return {
321
+ url: (0, common_1.toPathString)(localVarUrlObj),
322
+ options: localVarRequestOptions,
323
+ };
324
+ }),
325
+ /**
326
+ *
327
+ * @summary Place order
328
+ * @param {string} tradeId The ID of trade object obtained from trade/impact endpoint
329
+ * @param {string} userId
330
+ * @param {string} userSecret
331
+ * @param {*} [options] Override http request option.
332
+ * @throws {RequiredError}
333
+ */
334
+ placeOrder: (tradeId, userId, userSecret, options = {}) => __awaiter(this, void 0, void 0, function* () {
335
+ // verify required parameter 'tradeId' is not null or undefined
336
+ (0, common_1.assertParamExists)('placeOrder', 'tradeId', tradeId);
337
+ // verify required parameter 'userId' is not null or undefined
338
+ (0, common_1.assertParamExists)('placeOrder', 'userId', userId);
339
+ // verify required parameter 'userSecret' is not null or undefined
340
+ (0, common_1.assertParamExists)('placeOrder', 'userSecret', userSecret);
341
+ const localVarPath = `/trade/{tradeId}`
342
+ .replace(`{${"tradeId"}}`, encodeURIComponent(String(tradeId !== undefined ? tradeId : `-tradeId-`)));
343
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
344
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
345
+ let baseOptions;
346
+ if (configuration) {
347
+ baseOptions = configuration.baseOptions;
348
+ }
349
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
350
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
351
+ const localVarQueryParameter = {};
352
+ // authentication PartnerClientId required
353
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "clientId", configuration });
354
+ // authentication PartnerSignature required
355
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, keyParamName: "Signature", configuration });
356
+ // authentication PartnerTimestamp required
357
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, keyParamName: "timestamp", configuration });
358
+ if (userId !== undefined) {
359
+ localVarQueryParameter['userId'] = userId;
360
+ }
361
+ if (userSecret !== undefined) {
362
+ localVarQueryParameter['userSecret'] = userSecret;
363
+ }
364
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
365
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
366
+ (0, requestBeforeHook_1.requestBeforeHook)({
367
+ queryParameters: localVarQueryParameter,
368
+ requestConfig: localVarRequestOptions,
369
+ path: localVarPath,
370
+ configuration
371
+ });
372
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
373
+ return {
374
+ url: (0, common_1.toPathString)(localVarUrlObj),
375
+ options: localVarRequestOptions,
376
+ };
377
+ }),
378
+ };
379
+ };
380
+ exports.TradingApiAxiosParamCreator = TradingApiAxiosParamCreator;
381
+ /**
382
+ * TradingApi - functional programming interface
383
+ * @export
384
+ */
385
+ const TradingApiFp = function (configuration) {
386
+ const localVarAxiosParamCreator = (0, exports.TradingApiAxiosParamCreator)(configuration);
387
+ return {
388
+ /**
389
+ *
390
+ * @summary Cancel open order in account
391
+ * @param {TradingApiCancelUserAccountOrderRequest} requestParameters Request parameters.
392
+ * @param {*} [options] Override http request option.
393
+ * @throws {RequiredError}
394
+ */
395
+ cancelUserAccountOrder(requestParameters, options) {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.cancelUserAccountOrder(requestParameters.userId, requestParameters.userSecret, requestParameters.accountId, requestParameters, options);
398
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
399
+ });
400
+ },
401
+ /**
402
+ *
403
+ * @summary Check impact of trades on account.
404
+ * @param {TradingApiGetOrderImpactRequest} requestParameters Request parameters.
405
+ * @param {*} [options] Override http request option.
406
+ * @throws {RequiredError}
407
+ */
408
+ getOrderImpact(requestParameters, options) {
409
+ return __awaiter(this, void 0, void 0, function* () {
410
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderImpact(requestParameters.userId, requestParameters.userSecret, requestParameters, options);
411
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
412
+ });
413
+ },
414
+ /**
415
+ *
416
+ * @summary Get symbol quotes
417
+ * @param {TradingApiGetUserAccountQuotesRequest} requestParameters Request parameters.
418
+ * @param {*} [options] Override http request option.
419
+ * @throws {RequiredError}
420
+ */
421
+ getUserAccountQuotes(requestParameters, options) {
422
+ return __awaiter(this, void 0, void 0, function* () {
423
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getUserAccountQuotes(requestParameters.userId, requestParameters.userSecret, requestParameters.symbols, requestParameters.accountId, requestParameters.useTicker, options);
424
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
425
+ });
426
+ },
427
+ /**
428
+ *
429
+ * @summary Place a trade with NO validation.
430
+ * @param {TradingApiPlaceForceOrderRequest} requestParameters Request parameters.
431
+ * @param {*} [options] Override http request option.
432
+ * @throws {RequiredError}
433
+ */
434
+ placeForceOrder(requestParameters, options) {
435
+ return __awaiter(this, void 0, void 0, function* () {
436
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.placeForceOrder(requestParameters.userId, requestParameters.userSecret, requestParameters, options);
437
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
438
+ });
439
+ },
440
+ /**
441
+ *
442
+ * @summary Place a OCO (One Cancels Other) order
443
+ * @param {TradingApiPlaceOCOOrderRequest} requestParameters Request parameters.
444
+ * @param {*} [options] Override http request option.
445
+ * @throws {RequiredError}
446
+ */
447
+ placeOCOOrder(requestParameters, options) {
448
+ return __awaiter(this, void 0, void 0, function* () {
449
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.placeOCOOrder(requestParameters.userId, requestParameters.userSecret, requestParameters, options);
450
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
451
+ });
452
+ },
453
+ /**
454
+ *
455
+ * @summary Place order
456
+ * @param {TradingApiPlaceOrderRequest} requestParameters Request parameters.
457
+ * @param {*} [options] Override http request option.
458
+ * @throws {RequiredError}
459
+ */
460
+ placeOrder(requestParameters, options) {
461
+ return __awaiter(this, void 0, void 0, function* () {
462
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.placeOrder(requestParameters.tradeId, requestParameters.userId, requestParameters.userSecret, options);
463
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
464
+ });
465
+ },
466
+ };
467
+ };
468
+ exports.TradingApiFp = TradingApiFp;
469
+ /**
470
+ * TradingApi - factory interface
471
+ * @export
472
+ */
473
+ const TradingApiFactory = function (configuration, basePath, axios) {
474
+ const localVarFp = (0, exports.TradingApiFp)(configuration);
475
+ return {
476
+ /**
477
+ *
478
+ * @summary Cancel open order in account
479
+ * @param {TradingApiCancelUserAccountOrderRequest} requestParameters Request parameters.
480
+ * @param {*} [options] Override http request option.
481
+ * @throws {RequiredError}
482
+ */
483
+ cancelUserAccountOrder(requestParameters, options) {
484
+ return localVarFp.cancelUserAccountOrder(requestParameters, options).then((request) => request(axios, basePath));
485
+ },
486
+ /**
487
+ *
488
+ * @summary Check impact of trades on account.
489
+ * @param {TradingApiGetOrderImpactRequest} requestParameters Request parameters.
490
+ * @param {*} [options] Override http request option.
491
+ * @throws {RequiredError}
492
+ */
493
+ getOrderImpact(requestParameters, options) {
494
+ return localVarFp.getOrderImpact(requestParameters, options).then((request) => request(axios, basePath));
495
+ },
496
+ /**
497
+ *
498
+ * @summary Get symbol quotes
499
+ * @param {TradingApiGetUserAccountQuotesRequest} requestParameters Request parameters.
500
+ * @param {*} [options] Override http request option.
501
+ * @throws {RequiredError}
502
+ */
503
+ getUserAccountQuotes(requestParameters, options) {
504
+ return localVarFp.getUserAccountQuotes(requestParameters, options).then((request) => request(axios, basePath));
505
+ },
506
+ /**
507
+ *
508
+ * @summary Place a trade with NO validation.
509
+ * @param {TradingApiPlaceForceOrderRequest} requestParameters Request parameters.
510
+ * @param {*} [options] Override http request option.
511
+ * @throws {RequiredError}
512
+ */
513
+ placeForceOrder(requestParameters, options) {
514
+ return localVarFp.placeForceOrder(requestParameters, options).then((request) => request(axios, basePath));
515
+ },
516
+ /**
517
+ *
518
+ * @summary Place a OCO (One Cancels Other) order
519
+ * @param {TradingApiPlaceOCOOrderRequest} requestParameters Request parameters.
520
+ * @param {*} [options] Override http request option.
521
+ * @throws {RequiredError}
522
+ */
523
+ placeOCOOrder(requestParameters, options) {
524
+ return localVarFp.placeOCOOrder(requestParameters, options).then((request) => request(axios, basePath));
525
+ },
526
+ /**
527
+ *
528
+ * @summary Place order
529
+ * @param {TradingApiPlaceOrderRequest} requestParameters Request parameters.
530
+ * @param {*} [options] Override http request option.
531
+ * @throws {RequiredError}
532
+ */
533
+ placeOrder(requestParameters, options) {
534
+ return localVarFp.placeOrder(requestParameters, options).then((request) => request(axios, basePath));
535
+ },
536
+ };
537
+ };
538
+ exports.TradingApiFactory = TradingApiFactory;
539
+ /**
540
+ * TradingApiGenerated - object-oriented interface
541
+ * @export
542
+ * @class TradingApiGenerated
543
+ * @extends {BaseAPI}
544
+ */
545
+ class TradingApiGenerated extends base_1.BaseAPI {
546
+ /**
547
+ *
548
+ * @summary Cancel open order in account
549
+ * @param {TradingApiCancelUserAccountOrderRequest} requestParameters Request parameters.
550
+ * @param {*} [options] Override http request option.
551
+ * @throws {RequiredError}
552
+ * @memberof TradingApiGenerated
553
+ */
554
+ cancelUserAccountOrder(requestParameters, options) {
555
+ return (0, exports.TradingApiFp)(this.configuration).cancelUserAccountOrder(requestParameters, options).then((request) => request(this.axios, this.basePath));
556
+ }
557
+ /**
558
+ *
559
+ * @summary Check impact of trades on account.
560
+ * @param {TradingApiGetOrderImpactRequest} requestParameters Request parameters.
561
+ * @param {*} [options] Override http request option.
562
+ * @throws {RequiredError}
563
+ * @memberof TradingApiGenerated
564
+ */
565
+ getOrderImpact(requestParameters, options) {
566
+ return (0, exports.TradingApiFp)(this.configuration).getOrderImpact(requestParameters, options).then((request) => request(this.axios, this.basePath));
567
+ }
568
+ /**
569
+ *
570
+ * @summary Get symbol quotes
571
+ * @param {TradingApiGetUserAccountQuotesRequest} requestParameters Request parameters.
572
+ * @param {*} [options] Override http request option.
573
+ * @throws {RequiredError}
574
+ * @memberof TradingApiGenerated
575
+ */
576
+ getUserAccountQuotes(requestParameters, options) {
577
+ return (0, exports.TradingApiFp)(this.configuration).getUserAccountQuotes(requestParameters, options).then((request) => request(this.axios, this.basePath));
578
+ }
579
+ /**
580
+ *
581
+ * @summary Place a trade with NO validation.
582
+ * @param {TradingApiPlaceForceOrderRequest} requestParameters Request parameters.
583
+ * @param {*} [options] Override http request option.
584
+ * @throws {RequiredError}
585
+ * @memberof TradingApiGenerated
586
+ */
587
+ placeForceOrder(requestParameters, options) {
588
+ return (0, exports.TradingApiFp)(this.configuration).placeForceOrder(requestParameters, options).then((request) => request(this.axios, this.basePath));
589
+ }
590
+ /**
591
+ *
592
+ * @summary Place a OCO (One Cancels Other) order
593
+ * @param {TradingApiPlaceOCOOrderRequest} requestParameters Request parameters.
594
+ * @param {*} [options] Override http request option.
595
+ * @throws {RequiredError}
596
+ * @memberof TradingApiGenerated
597
+ */
598
+ placeOCOOrder(requestParameters, options) {
599
+ return (0, exports.TradingApiFp)(this.configuration).placeOCOOrder(requestParameters, options).then((request) => request(this.axios, this.basePath));
600
+ }
601
+ /**
602
+ *
603
+ * @summary Place order
604
+ * @param {TradingApiPlaceOrderRequest} requestParameters Request parameters.
605
+ * @param {*} [options] Override http request option.
606
+ * @throws {RequiredError}
607
+ * @memberof TradingApiGenerated
608
+ */
609
+ placeOrder(requestParameters, options) {
610
+ return (0, exports.TradingApiFp)(this.configuration).placeOrder(requestParameters, options).then((request) => request(this.axios, this.basePath));
611
+ }
612
+ }
613
+ exports.TradingApiGenerated = TradingApiGenerated;