snaptrade-typescript-sdk 9.0.187 → 9.0.188

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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/npm-v9.0.187-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/9.0.187)
9
+ [![npm](https://img.shields.io/badge/npm-v9.0.188-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/9.0.188)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -70,6 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
70
70
  * [`snaptrade.trading.getUserAccountOptionQuotes`](#snaptradetradinggetuseraccountoptionquotes)
71
71
  * [`snaptrade.trading.getUserAccountQuotes`](#snaptradetradinggetuseraccountquotes)
72
72
  * [`snaptrade.trading.placeBracketOrder`](#snaptradetradingplacebracketorder)
73
+ * [`snaptrade.trading.placeComplexOrder`](#snaptradetradingplacecomplexorder)
73
74
  * [`snaptrade.trading.placeCryptoOrder`](#snaptradetradingplacecryptoorder)
74
75
  * [`snaptrade.trading.placeForceOrder`](#snaptradetradingplaceforceorder)
75
76
  * [`snaptrade.trading.placeMlegOrder`](#snaptradetradingplacemlegorder)
@@ -2327,6 +2328,78 @@ Number of shares for the order. This can be a decimal for fractional orders. Mus
2327
2328
  ---
2328
2329
 
2329
2330
 
2331
+ ### `snaptrade.trading.placeComplexOrder`<a id="snaptradetradingplacecomplexorder"></a>
2332
+
2333
+ Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable.
2334
+ Only supported on certain brokerages.
2335
+
2336
+ - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled.
2337
+ - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order.
2338
+ - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
2339
+
2340
+
2341
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
2342
+
2343
+ ```typescript
2344
+ const placeComplexOrderResponse = await snaptrade.trading.placeComplexOrder({
2345
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2346
+ userId: "snaptrade-user-123",
2347
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2348
+ type: "OTO",
2349
+ orders: [
2350
+ {
2351
+ order_role: "TRIGGER",
2352
+ action: "BUY",
2353
+ instrument: {
2354
+ symbol: "AAPL",
2355
+ type: "EQUITY",
2356
+ },
2357
+ order_type: "Market",
2358
+ units: 10.5,
2359
+ time_in_force: "Day",
2360
+ price: 31.33,
2361
+ stop: 29.5,
2362
+ },
2363
+ ],
2364
+ client_order_id: "my-order-123",
2365
+ });
2366
+ ```
2367
+
2368
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2369
+
2370
+ ##### type: `string`<a id="type-string"></a>
2371
+
2372
+ The complex order type. - `OCO`: One Cancels the Other — two peer orders. - `OTO`: One Triggers the Other — a trigger order and a conditional order. - `OTOCO`: One Triggers a One Cancels the Other — a trigger order and two peer orders.
2373
+
2374
+ ##### orders: [`ComplexOrderLeg`](./models/complex-order-leg.ts)[]<a id="orders-complexorderlegmodelscomplex-order-legts"></a>
2375
+
2376
+ The orders that make up the complex order. Required counts and roles per type: - `OCO`: exactly 2 orders, both `PEER` - `OTO`: exactly 2 orders, one `TRIGGER` and one `CONDITIONAL` - `OTOCO`: exactly 3 orders, one `TRIGGER` and two `PEER`
2377
+
2378
+ ##### accountId: `string`<a id="accountid-string"></a>
2379
+
2380
+ The ID of the account to execute the trade on.
2381
+
2382
+ ##### userId: `string`<a id="userid-string"></a>
2383
+
2384
+ ##### userSecret: `string`<a id="usersecret-string"></a>
2385
+
2386
+ ##### client_order_id: `string`<a id="client_order_id-string"></a>
2387
+
2388
+ An optional client-provided identifier for this complex order. Passed through to the brokerage and returned in the response.
2389
+
2390
+ #### 🔄 Return<a id="🔄-return"></a>
2391
+
2392
+ [ComplexOrderResponse](./models/complex-order-response.ts)
2393
+
2394
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2395
+
2396
+ `/accounts/{accountId}/trading/complex` `POST`
2397
+
2398
+ [🔙 **Back to Table of Contents**](#table-of-contents)
2399
+
2400
+ ---
2401
+
2402
+
2330
2403
  ### `snaptrade.trading.placeCryptoOrder`<a id="snaptradetradingplacecryptoorder"></a>
2331
2404
 
2332
2405
  Places an order in the specified account.
@@ -4,12 +4,14 @@ import { RequestArgs, BaseAPI } from '../base';
4
4
  import { AccountInformationGetUserAccountOrderDetailRequest } from '../models';
5
5
  import { AccountOrderRecord } from '../models';
6
6
  import { CancelOrderResponse } from '../models';
7
+ import { ComplexOrderResponse } from '../models';
7
8
  import { CryptoOrderForm } from '../models';
8
9
  import { CryptoOrderPreview } from '../models';
9
10
  import { CryptocurrencyPairQuote } from '../models';
10
11
  import { ManualTradeAndImpact } from '../models';
11
12
  import { ManualTradeForm } from '../models';
12
13
  import { ManualTradeFormBracket } from '../models';
14
+ import { ManualTradeFormComplex } from '../models';
13
15
  import { ManualTradeFormWithOptions } from '../models';
14
16
  import { ManualTradeReplaceForm } from '../models';
15
17
  import { MlegOrderResponse } from '../models';
@@ -114,6 +116,17 @@ export declare const TradingApiAxiosParamCreator: (configuration?: Configuration
114
116
  * @throws {RequiredError}
115
117
  */
116
118
  placeBracketOrder: (accountId: string, userId: string, userSecret: string, manualTradeFormBracket: ManualTradeFormBracket, options?: AxiosRequestConfig) => Promise<RequestArgs>;
119
+ /**
120
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
121
+ * @summary Place complex order
122
+ * @param {string} accountId The ID of the account to execute the trade on.
123
+ * @param {string} userId
124
+ * @param {string} userSecret
125
+ * @param {ManualTradeFormComplex} manualTradeFormComplex
126
+ * @param {*} [options] Override http request option.
127
+ * @throws {RequiredError}
128
+ */
129
+ placeComplexOrder: (accountId: string, userId: string, userSecret: string, manualTradeFormComplex: ManualTradeFormComplex, options?: AxiosRequestConfig) => Promise<RequestArgs>;
117
130
  /**
118
131
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
119
132
  * @summary Place crypto order
@@ -262,6 +275,14 @@ export declare const TradingApiFp: (configuration?: Configuration) => {
262
275
  * @throws {RequiredError}
263
276
  */
264
277
  placeBracketOrder(requestParameters: TradingApiPlaceBracketOrderRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AccountOrderRecord>>;
278
+ /**
279
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
280
+ * @summary Place complex order
281
+ * @param {TradingApiPlaceComplexOrderRequest} requestParameters Request parameters.
282
+ * @param {*} [options] Override http request option.
283
+ * @throws {RequiredError}
284
+ */
285
+ placeComplexOrder(requestParameters: TradingApiPlaceComplexOrderRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ComplexOrderResponse>>;
265
286
  /**
266
287
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
267
288
  * @summary Place crypto order
@@ -389,6 +410,14 @@ export declare const TradingApiFactory: (configuration?: Configuration, basePath
389
410
  * @throws {RequiredError}
390
411
  */
391
412
  placeBracketOrder(requestParameters: TradingApiPlaceBracketOrderRequest, options?: AxiosRequestConfig): AxiosPromise<AccountOrderRecord>;
413
+ /**
414
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
415
+ * @summary Place complex order
416
+ * @param {TradingApiPlaceComplexOrderRequest} requestParameters Request parameters.
417
+ * @param {*} [options] Override http request option.
418
+ * @throws {RequiredError}
419
+ */
420
+ placeComplexOrder(requestParameters: TradingApiPlaceComplexOrderRequest, options?: AxiosRequestConfig): AxiosPromise<ComplexOrderResponse>;
392
421
  /**
393
422
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
394
423
  * @summary Place crypto order
@@ -664,6 +693,31 @@ export type TradingApiPlaceBracketOrderRequest = {
664
693
  */
665
694
  readonly userSecret: string;
666
695
  } & ManualTradeFormBracket;
696
+ /**
697
+ * Request parameters for placeComplexOrder operation in TradingApi.
698
+ * @export
699
+ * @interface TradingApiPlaceComplexOrderRequest
700
+ */
701
+ export type TradingApiPlaceComplexOrderRequest = {
702
+ /**
703
+ * The ID of the account to execute the trade on.
704
+ * @type {string}
705
+ * @memberof TradingApiPlaceComplexOrder
706
+ */
707
+ readonly accountId: string;
708
+ /**
709
+ *
710
+ * @type {string}
711
+ * @memberof TradingApiPlaceComplexOrder
712
+ */
713
+ readonly userId: string;
714
+ /**
715
+ *
716
+ * @type {string}
717
+ * @memberof TradingApiPlaceComplexOrder
718
+ */
719
+ readonly userSecret: string;
720
+ } & ManualTradeFormComplex;
667
721
  /**
668
722
  * Request parameters for placeCryptoOrder operation in TradingApi.
669
723
  * @export
@@ -925,6 +979,15 @@ export declare class TradingApiGenerated extends BaseAPI {
925
979
  * @memberof TradingApiGenerated
926
980
  */
927
981
  placeBracketOrder(requestParameters: TradingApiPlaceBracketOrderRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<AccountOrderRecord, any, {}>>;
982
+ /**
983
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
984
+ * @summary Place complex order
985
+ * @param {TradingApiPlaceComplexOrderRequest} requestParameters Request parameters.
986
+ * @param {*} [options] Override http request option.
987
+ * @throws {RequiredError}
988
+ * @memberof TradingApiGenerated
989
+ */
990
+ placeComplexOrder(requestParameters: TradingApiPlaceComplexOrderRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ComplexOrderResponse, any, {}>>;
928
991
  /**
929
992
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
930
993
  * @summary Place crypto order
@@ -522,6 +522,67 @@ const TradingApiAxiosParamCreator = function (configuration) {
522
522
  options: localVarRequestOptions,
523
523
  };
524
524
  }),
525
+ /**
526
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
527
+ * @summary Place complex order
528
+ * @param {string} accountId The ID of the account to execute the trade on.
529
+ * @param {string} userId
530
+ * @param {string} userSecret
531
+ * @param {ManualTradeFormComplex} manualTradeFormComplex
532
+ * @param {*} [options] Override http request option.
533
+ * @throws {RequiredError}
534
+ */
535
+ placeComplexOrder: (accountId, userId, userSecret, manualTradeFormComplex, options = {}) => __awaiter(this, void 0, void 0, function* () {
536
+ // verify required parameter 'accountId' is not null or undefined
537
+ (0, common_1.assertParamExists)('placeComplexOrder', 'accountId', accountId);
538
+ // verify required parameter 'userId' is not null or undefined
539
+ (0, common_1.assertParamExists)('placeComplexOrder', 'userId', userId);
540
+ // verify required parameter 'userSecret' is not null or undefined
541
+ (0, common_1.assertParamExists)('placeComplexOrder', 'userSecret', userSecret);
542
+ // verify required parameter 'manualTradeFormComplex' is not null or undefined
543
+ (0, common_1.assertParamExists)('placeComplexOrder', 'manualTradeFormComplex', manualTradeFormComplex);
544
+ const localVarPath = `/accounts/{accountId}/trading/complex`
545
+ .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId !== undefined ? accountId : `-accountId-`)));
546
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
547
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
548
+ let baseOptions;
549
+ if (configuration) {
550
+ baseOptions = configuration.baseOptions;
551
+ }
552
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
553
+ const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
554
+ const localVarQueryParameter = {};
555
+ // authentication PartnerClientId required
556
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, key: "clientId", keyParamName: "clientId", configuration });
557
+ // authentication PartnerSignature required
558
+ yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, key: "Signature", keyParamName: "signature", configuration });
559
+ // authentication PartnerTimestamp required
560
+ yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, key: "timestamp", keyParamName: "timestamp", configuration });
561
+ if (userId !== undefined) {
562
+ localVarQueryParameter['userId'] = userId;
563
+ }
564
+ if (userSecret !== undefined) {
565
+ localVarQueryParameter['userSecret'] = userSecret;
566
+ }
567
+ localVarHeaderParameter['Content-Type'] = 'application/json';
568
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
569
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
570
+ (0, requestBeforeHook_1.requestBeforeHook)({
571
+ requestBody: manualTradeFormComplex,
572
+ queryParameters: localVarQueryParameter,
573
+ requestConfig: localVarRequestOptions,
574
+ path: localVarPath,
575
+ configuration,
576
+ pathTemplate: '/accounts/{accountId}/trading/complex',
577
+ httpMethod: 'POST'
578
+ });
579
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(manualTradeFormComplex, localVarRequestOptions, configuration);
580
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
581
+ return {
582
+ url: (0, common_1.toPathString)(localVarUrlObj),
583
+ options: localVarRequestOptions,
584
+ };
585
+ }),
525
586
  /**
526
587
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
527
588
  * @summary Place crypto order
@@ -1096,6 +1157,24 @@ const TradingApiFp = function (configuration) {
1096
1157
  return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1097
1158
  });
1098
1159
  },
1160
+ /**
1161
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
1162
+ * @summary Place complex order
1163
+ * @param {TradingApiPlaceComplexOrderRequest} requestParameters Request parameters.
1164
+ * @param {*} [options] Override http request option.
1165
+ * @throws {RequiredError}
1166
+ */
1167
+ placeComplexOrder(requestParameters, options) {
1168
+ return __awaiter(this, void 0, void 0, function* () {
1169
+ const manualTradeFormComplex = {
1170
+ type: requestParameters.type,
1171
+ orders: requestParameters.orders,
1172
+ client_order_id: requestParameters.client_order_id
1173
+ };
1174
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.placeComplexOrder(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, manualTradeFormComplex, options);
1175
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1176
+ });
1177
+ },
1099
1178
  /**
1100
1179
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
1101
1180
  * @summary Place crypto order
@@ -1334,6 +1413,16 @@ const TradingApiFactory = function (configuration, basePath, axios) {
1334
1413
  placeBracketOrder(requestParameters, options) {
1335
1414
  return localVarFp.placeBracketOrder(requestParameters, options).then((request) => request(axios, basePath));
1336
1415
  },
1416
+ /**
1417
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
1418
+ * @summary Place complex order
1419
+ * @param {TradingApiPlaceComplexOrderRequest} requestParameters Request parameters.
1420
+ * @param {*} [options] Override http request option.
1421
+ * @throws {RequiredError}
1422
+ */
1423
+ placeComplexOrder(requestParameters, options) {
1424
+ return localVarFp.placeComplexOrder(requestParameters, options).then((request) => request(axios, basePath));
1425
+ },
1337
1426
  /**
1338
1427
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
1339
1428
  * @summary Place crypto order
@@ -1503,6 +1592,17 @@ class TradingApiGenerated extends base_1.BaseAPI {
1503
1592
  placeBracketOrder(requestParameters, options) {
1504
1593
  return (0, exports.TradingApiFp)(this.configuration).placeBracketOrder(requestParameters, options).then((request) => request(this.axios, this.basePath));
1505
1594
  }
1595
+ /**
1596
+ * Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. Only supported on certain brokerages. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
1597
+ * @summary Place complex order
1598
+ * @param {TradingApiPlaceComplexOrderRequest} requestParameters Request parameters.
1599
+ * @param {*} [options] Override http request option.
1600
+ * @throws {RequiredError}
1601
+ * @memberof TradingApiGenerated
1602
+ */
1603
+ placeComplexOrder(requestParameters, options) {
1604
+ return (0, exports.TradingApiFp)(this.configuration).placeComplexOrder(requestParameters, options).then((request) => request(this.axios, this.basePath));
1605
+ }
1506
1606
  /**
1507
1607
  * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
1508
1608
  * @summary Place crypto order