snaptrade-typescript-sdk 9.0.165 → 9.0.167
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 +115 -1
- package/dist/api/options-api-generated.d.ts +61 -0
- package/dist/api/options-api-generated.js +91 -0
- package/dist/api/trading-api-generated.d.ts +62 -0
- package/dist/api/trading-api-generated.js +103 -0
- package/dist/browser.js +1 -1
- package/dist/configuration.js +1 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/option-impact.d.ts +20 -0
- package/dist/models/option-impact.js +2 -0
- package/dist/models/option-quote.d.ts +80 -0
- package/dist/models/option-quote.js +2 -0
- package/dist/operationParameterMap.js +44 -0
- package/package.json +1 -1
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
|
-
[](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/9.0.167)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -46,6 +46,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
46
46
|
* [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
|
|
47
47
|
* [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
|
|
48
48
|
* [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
|
|
49
|
+
* [`snaptrade.options.getOptionQuote`](#snaptradeoptionsgetoptionquote)
|
|
49
50
|
* [`snaptrade.options.getOptionsChain`](#snaptradeoptionsgetoptionschain)
|
|
50
51
|
* [`snaptrade.options.listOptionHoldings`](#snaptradeoptionslistoptionholdings)
|
|
51
52
|
* [`snaptrade.referenceData.getCurrencyExchangeRatePair`](#snaptradereferencedatagetcurrencyexchangeratepair)
|
|
@@ -63,6 +64,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
63
64
|
* [`snaptrade.trading.cancelOrder`](#snaptradetradingcancelorder)
|
|
64
65
|
* [`snaptrade.trading.cancelUserAccountOrder`](#snaptradetradingcanceluseraccountorder)
|
|
65
66
|
* [`snaptrade.trading.getCryptocurrencyPairQuote`](#snaptradetradinggetcryptocurrencypairquote)
|
|
67
|
+
* [`snaptrade.trading.getOptionImpact`](#snaptradetradinggetoptionimpact)
|
|
66
68
|
* [`snaptrade.trading.getOrderImpact`](#snaptradetradinggetorderimpact)
|
|
67
69
|
* [`snaptrade.trading.getUserAccountQuotes`](#snaptradetradinggetuseraccountquotes)
|
|
68
70
|
* [`snaptrade.trading.placeBracketOrder`](#snaptradetradingplacebracketorder)
|
|
@@ -1359,6 +1361,46 @@ Defaults to true. Indicates if request should fetch only executed orders. Set to
|
|
|
1359
1361
|
---
|
|
1360
1362
|
|
|
1361
1363
|
|
|
1364
|
+
### `snaptrade.options.getOptionQuote`<a id="snaptradeoptionsgetoptionquote"></a>
|
|
1365
|
+
|
|
1366
|
+
Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol.
|
|
1367
|
+
|
|
1368
|
+
OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1372
|
+
|
|
1373
|
+
```typescript
|
|
1374
|
+
const getOptionQuoteResponse = await snaptrade.options.getOptionQuote({
|
|
1375
|
+
userId: "snaptrade-user-123",
|
|
1376
|
+
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1377
|
+
symbol: "AAPL 251219C00150000",
|
|
1378
|
+
});
|
|
1379
|
+
```
|
|
1380
|
+
|
|
1381
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1382
|
+
|
|
1383
|
+
##### userId: `string`<a id="userid-string"></a>
|
|
1384
|
+
|
|
1385
|
+
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
1386
|
+
|
|
1387
|
+
##### symbol: `string`<a id="symbol-string"></a>
|
|
1388
|
+
|
|
1389
|
+
The OCC-formatted option symbol.
|
|
1390
|
+
|
|
1391
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1392
|
+
|
|
1393
|
+
[OptionQuote](./models/option-quote.ts)
|
|
1394
|
+
|
|
1395
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1396
|
+
|
|
1397
|
+
`/marketData/options/quotes` `GET`
|
|
1398
|
+
|
|
1399
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1400
|
+
|
|
1401
|
+
---
|
|
1402
|
+
|
|
1403
|
+
|
|
1362
1404
|
### `snaptrade.options.getOptionsChain`<a id="snaptradeoptionsgetoptionschain"></a>
|
|
1363
1405
|
|
|
1364
1406
|
Returns the option chain for the specified symbol in the specified account.
|
|
@@ -1914,6 +1956,78 @@ const getCryptocurrencyPairQuoteResponse =
|
|
|
1914
1956
|
---
|
|
1915
1957
|
|
|
1916
1958
|
|
|
1959
|
+
### `snaptrade.trading.getOptionImpact`<a id="snaptradetradinggetoptionimpact"></a>
|
|
1960
|
+
|
|
1961
|
+
Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it.
|
|
1962
|
+
Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1966
|
+
|
|
1967
|
+
```typescript
|
|
1968
|
+
const getOptionImpactResponse = await snaptrade.trading.getOptionImpact({
|
|
1969
|
+
userId: "snaptrade-user-123",
|
|
1970
|
+
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1971
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1972
|
+
order_type: "MARKET",
|
|
1973
|
+
time_in_force: "Day",
|
|
1974
|
+
limit_price: "",
|
|
1975
|
+
stop_price: "",
|
|
1976
|
+
price_effect: "DEBIT",
|
|
1977
|
+
legs: [
|
|
1978
|
+
{
|
|
1979
|
+
instrument: {
|
|
1980
|
+
symbol: "PBI 250718C00006000",
|
|
1981
|
+
instrument_type: "OPTION",
|
|
1982
|
+
},
|
|
1983
|
+
action: "BUY_TO_OPEN",
|
|
1984
|
+
units: 1,
|
|
1985
|
+
},
|
|
1986
|
+
],
|
|
1987
|
+
});
|
|
1988
|
+
```
|
|
1989
|
+
|
|
1990
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1991
|
+
|
|
1992
|
+
##### order_type: [`MlegOrderTypeStrict`](./models/mleg-order-type-strict.ts)<a id="order_type-mlegordertypestrictmodelsmleg-order-type-strictts"></a>
|
|
1993
|
+
|
|
1994
|
+
The type of order to place.
|
|
1995
|
+
|
|
1996
|
+
##### time_in_force: [`TimeInForceStrict`](./models/time-in-force-strict.ts)<a id="time_in_force-timeinforcestrictmodelstime-in-force-strictts"></a>
|
|
1997
|
+
|
|
1998
|
+
The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
|
1999
|
+
|
|
2000
|
+
##### legs: [`MlegLeg`](./models/mleg-leg.ts)[]<a id="legs-mleglegmodelsmleg-legts"></a>
|
|
2001
|
+
|
|
2002
|
+
##### userId: `string`<a id="userid-string"></a>
|
|
2003
|
+
|
|
2004
|
+
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
2005
|
+
|
|
2006
|
+
##### accountId: `string`<a id="accountid-string"></a>
|
|
2007
|
+
|
|
2008
|
+
##### limit_price: `string`<a id="limit_price-string"></a>
|
|
2009
|
+
|
|
2010
|
+
The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
|
2011
|
+
|
|
2012
|
+
##### stop_price: `string`<a id="stop_price-string"></a>
|
|
2013
|
+
|
|
2014
|
+
The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
|
2015
|
+
|
|
2016
|
+
##### price_effect: [`MlegPriceEffectStrict`](./models/mleg-price-effect-strict.ts)<a id="price_effect-mlegpriceeffectstrictmodelsmleg-price-effect-strictts"></a>
|
|
2017
|
+
|
|
2018
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
2019
|
+
|
|
2020
|
+
[OptionImpact](./models/option-impact.ts)
|
|
2021
|
+
|
|
2022
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
2023
|
+
|
|
2024
|
+
`/accounts/{accountId}/trading/options/impact` `POST`
|
|
2025
|
+
|
|
2026
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
2027
|
+
|
|
2028
|
+
---
|
|
2029
|
+
|
|
2030
|
+
|
|
1917
2031
|
### `snaptrade.trading.getOrderImpact`<a id="snaptradetradinggetorderimpact"></a>
|
|
1918
2032
|
|
|
1919
2033
|
Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
@@ -2,12 +2,23 @@ import { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
|
2
2
|
import { Configuration } from '../configuration';
|
|
3
3
|
import { RequestArgs, BaseAPI } from '../base';
|
|
4
4
|
import { OptionChainInner } from '../models';
|
|
5
|
+
import { OptionQuote } from '../models';
|
|
5
6
|
import { OptionsPosition } from '../models';
|
|
6
7
|
/**
|
|
7
8
|
* OptionsApi - axios parameter creator
|
|
8
9
|
* @export
|
|
9
10
|
*/
|
|
10
11
|
export declare const OptionsApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
12
|
+
/**
|
|
13
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
14
|
+
* @summary Get option quote
|
|
15
|
+
* @param {string} userId
|
|
16
|
+
* @param {string} userSecret
|
|
17
|
+
* @param {string} symbol The OCC-formatted option symbol.
|
|
18
|
+
* @param {*} [options] Override http request option.
|
|
19
|
+
* @throws {RequiredError}
|
|
20
|
+
*/
|
|
21
|
+
getOptionQuote: (userId: string, userSecret: string, symbol: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
11
22
|
/**
|
|
12
23
|
* Returns the option chain for the specified symbol in the specified account.
|
|
13
24
|
* @summary Get the options chain for a symbol
|
|
@@ -35,6 +46,14 @@ export declare const OptionsApiAxiosParamCreator: (configuration?: Configuration
|
|
|
35
46
|
* @export
|
|
36
47
|
*/
|
|
37
48
|
export declare const OptionsApiFp: (configuration?: Configuration) => {
|
|
49
|
+
/**
|
|
50
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
51
|
+
* @summary Get option quote
|
|
52
|
+
* @param {OptionsApiGetOptionQuoteRequest} requestParameters Request parameters.
|
|
53
|
+
* @param {*} [options] Override http request option.
|
|
54
|
+
* @throws {RequiredError}
|
|
55
|
+
*/
|
|
56
|
+
getOptionQuote(requestParameters: OptionsApiGetOptionQuoteRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OptionQuote>>;
|
|
38
57
|
/**
|
|
39
58
|
* Returns the option chain for the specified symbol in the specified account.
|
|
40
59
|
* @summary Get the options chain for a symbol
|
|
@@ -57,6 +76,14 @@ export declare const OptionsApiFp: (configuration?: Configuration) => {
|
|
|
57
76
|
* @export
|
|
58
77
|
*/
|
|
59
78
|
export declare const OptionsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
79
|
+
/**
|
|
80
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
81
|
+
* @summary Get option quote
|
|
82
|
+
* @param {OptionsApiGetOptionQuoteRequest} requestParameters Request parameters.
|
|
83
|
+
* @param {*} [options] Override http request option.
|
|
84
|
+
* @throws {RequiredError}
|
|
85
|
+
*/
|
|
86
|
+
getOptionQuote(requestParameters: OptionsApiGetOptionQuoteRequest, options?: AxiosRequestConfig): AxiosPromise<OptionQuote>;
|
|
60
87
|
/**
|
|
61
88
|
* Returns the option chain for the specified symbol in the specified account.
|
|
62
89
|
* @summary Get the options chain for a symbol
|
|
@@ -74,6 +101,31 @@ export declare const OptionsApiFactory: (configuration?: Configuration, basePath
|
|
|
74
101
|
*/
|
|
75
102
|
listOptionHoldings(requestParameters: OptionsApiListOptionHoldingsRequest, options?: AxiosRequestConfig): AxiosPromise<Array<OptionsPosition>>;
|
|
76
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Request parameters for getOptionQuote operation in OptionsApi.
|
|
106
|
+
* @export
|
|
107
|
+
* @interface OptionsApiGetOptionQuoteRequest
|
|
108
|
+
*/
|
|
109
|
+
export type OptionsApiGetOptionQuoteRequest = {
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @type {string}
|
|
113
|
+
* @memberof OptionsApiGetOptionQuote
|
|
114
|
+
*/
|
|
115
|
+
readonly userId: string;
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @type {string}
|
|
119
|
+
* @memberof OptionsApiGetOptionQuote
|
|
120
|
+
*/
|
|
121
|
+
readonly userSecret: string;
|
|
122
|
+
/**
|
|
123
|
+
* The OCC-formatted option symbol.
|
|
124
|
+
* @type {string}
|
|
125
|
+
* @memberof OptionsApiGetOptionQuote
|
|
126
|
+
*/
|
|
127
|
+
readonly symbol: string;
|
|
128
|
+
};
|
|
77
129
|
/**
|
|
78
130
|
* Request parameters for getOptionsChain operation in OptionsApi.
|
|
79
131
|
* @export
|
|
@@ -137,6 +189,15 @@ export type OptionsApiListOptionHoldingsRequest = {
|
|
|
137
189
|
* @extends {BaseAPI}
|
|
138
190
|
*/
|
|
139
191
|
export declare class OptionsApiGenerated extends BaseAPI {
|
|
192
|
+
/**
|
|
193
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
194
|
+
* @summary Get option quote
|
|
195
|
+
* @param {OptionsApiGetOptionQuoteRequest} requestParameters Request parameters.
|
|
196
|
+
* @param {*} [options] Override http request option.
|
|
197
|
+
* @throws {RequiredError}
|
|
198
|
+
* @memberof OptionsApiGenerated
|
|
199
|
+
*/
|
|
200
|
+
getOptionQuote(requestParameters: OptionsApiGetOptionQuoteRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<OptionQuote, any>>;
|
|
140
201
|
/**
|
|
141
202
|
* Returns the option chain for the specified symbol in the specified account.
|
|
142
203
|
* @summary Get the options chain for a symbol
|
|
@@ -35,6 +35,63 @@ const requestBeforeHook_1 = require("../requestBeforeHook");
|
|
|
35
35
|
*/
|
|
36
36
|
const OptionsApiAxiosParamCreator = function (configuration) {
|
|
37
37
|
return {
|
|
38
|
+
/**
|
|
39
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
40
|
+
* @summary Get option quote
|
|
41
|
+
* @param {string} userId
|
|
42
|
+
* @param {string} userSecret
|
|
43
|
+
* @param {string} symbol The OCC-formatted option symbol.
|
|
44
|
+
* @param {*} [options] Override http request option.
|
|
45
|
+
* @throws {RequiredError}
|
|
46
|
+
*/
|
|
47
|
+
getOptionQuote: (userId, userSecret, symbol, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
// verify required parameter 'userId' is not null or undefined
|
|
49
|
+
(0, common_1.assertParamExists)('getOptionQuote', 'userId', userId);
|
|
50
|
+
// verify required parameter 'userSecret' is not null or undefined
|
|
51
|
+
(0, common_1.assertParamExists)('getOptionQuote', 'userSecret', userSecret);
|
|
52
|
+
// verify required parameter 'symbol' is not null or undefined
|
|
53
|
+
(0, common_1.assertParamExists)('getOptionQuote', 'symbol', symbol);
|
|
54
|
+
const localVarPath = `/marketData/options/quotes`;
|
|
55
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
56
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
57
|
+
let baseOptions;
|
|
58
|
+
if (configuration) {
|
|
59
|
+
baseOptions = configuration.baseOptions;
|
|
60
|
+
}
|
|
61
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
|
|
62
|
+
const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
|
|
63
|
+
const localVarQueryParameter = {};
|
|
64
|
+
// authentication PartnerClientId required
|
|
65
|
+
yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, key: "clientId", keyParamName: "clientId", configuration });
|
|
66
|
+
// authentication PartnerSignature required
|
|
67
|
+
yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, key: "Signature", keyParamName: "signature", configuration });
|
|
68
|
+
// authentication PartnerTimestamp required
|
|
69
|
+
yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, key: "timestamp", keyParamName: "timestamp", configuration });
|
|
70
|
+
if (userId !== undefined) {
|
|
71
|
+
localVarQueryParameter['userId'] = userId;
|
|
72
|
+
}
|
|
73
|
+
if (userSecret !== undefined) {
|
|
74
|
+
localVarQueryParameter['userSecret'] = userSecret;
|
|
75
|
+
}
|
|
76
|
+
if (symbol !== undefined) {
|
|
77
|
+
localVarQueryParameter['symbol'] = symbol;
|
|
78
|
+
}
|
|
79
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
80
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
81
|
+
(0, requestBeforeHook_1.requestBeforeHook)({
|
|
82
|
+
queryParameters: localVarQueryParameter,
|
|
83
|
+
requestConfig: localVarRequestOptions,
|
|
84
|
+
path: localVarPath,
|
|
85
|
+
configuration,
|
|
86
|
+
pathTemplate: '/marketData/options/quotes',
|
|
87
|
+
httpMethod: 'GET'
|
|
88
|
+
});
|
|
89
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
90
|
+
return {
|
|
91
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
92
|
+
options: localVarRequestOptions,
|
|
93
|
+
};
|
|
94
|
+
}),
|
|
38
95
|
/**
|
|
39
96
|
* Returns the option chain for the specified symbol in the specified account.
|
|
40
97
|
* @summary Get the options chain for a symbol
|
|
@@ -161,6 +218,19 @@ exports.OptionsApiAxiosParamCreator = OptionsApiAxiosParamCreator;
|
|
|
161
218
|
const OptionsApiFp = function (configuration) {
|
|
162
219
|
const localVarAxiosParamCreator = (0, exports.OptionsApiAxiosParamCreator)(configuration);
|
|
163
220
|
return {
|
|
221
|
+
/**
|
|
222
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
223
|
+
* @summary Get option quote
|
|
224
|
+
* @param {OptionsApiGetOptionQuoteRequest} requestParameters Request parameters.
|
|
225
|
+
* @param {*} [options] Override http request option.
|
|
226
|
+
* @throws {RequiredError}
|
|
227
|
+
*/
|
|
228
|
+
getOptionQuote(requestParameters, options) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.getOptionQuote(requestParameters.userId, requestParameters.userSecret, requestParameters.symbol, options);
|
|
231
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
232
|
+
});
|
|
233
|
+
},
|
|
164
234
|
/**
|
|
165
235
|
* Returns the option chain for the specified symbol in the specified account.
|
|
166
236
|
* @summary Get the options chain for a symbol
|
|
@@ -197,6 +267,16 @@ exports.OptionsApiFp = OptionsApiFp;
|
|
|
197
267
|
const OptionsApiFactory = function (configuration, basePath, axios) {
|
|
198
268
|
const localVarFp = (0, exports.OptionsApiFp)(configuration);
|
|
199
269
|
return {
|
|
270
|
+
/**
|
|
271
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
272
|
+
* @summary Get option quote
|
|
273
|
+
* @param {OptionsApiGetOptionQuoteRequest} requestParameters Request parameters.
|
|
274
|
+
* @param {*} [options] Override http request option.
|
|
275
|
+
* @throws {RequiredError}
|
|
276
|
+
*/
|
|
277
|
+
getOptionQuote(requestParameters, options) {
|
|
278
|
+
return localVarFp.getOptionQuote(requestParameters, options).then((request) => request(axios, basePath));
|
|
279
|
+
},
|
|
200
280
|
/**
|
|
201
281
|
* Returns the option chain for the specified symbol in the specified account.
|
|
202
282
|
* @summary Get the options chain for a symbol
|
|
@@ -227,6 +307,17 @@ exports.OptionsApiFactory = OptionsApiFactory;
|
|
|
227
307
|
* @extends {BaseAPI}
|
|
228
308
|
*/
|
|
229
309
|
class OptionsApiGenerated extends base_1.BaseAPI {
|
|
310
|
+
/**
|
|
311
|
+
* Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
|
|
312
|
+
* @summary Get option quote
|
|
313
|
+
* @param {OptionsApiGetOptionQuoteRequest} requestParameters Request parameters.
|
|
314
|
+
* @param {*} [options] Override http request option.
|
|
315
|
+
* @throws {RequiredError}
|
|
316
|
+
* @memberof OptionsApiGenerated
|
|
317
|
+
*/
|
|
318
|
+
getOptionQuote(requestParameters, options) {
|
|
319
|
+
return (0, exports.OptionsApiFp)(this.configuration).getOptionQuote(requestParameters, options).then((request) => request(this.axios, this.basePath));
|
|
320
|
+
}
|
|
230
321
|
/**
|
|
231
322
|
* Returns the option chain for the specified symbol in the specified account.
|
|
232
323
|
* @summary Get the options chain for a symbol
|
|
@@ -14,6 +14,7 @@ import { ManualTradeFormWithOptions } from '../models';
|
|
|
14
14
|
import { ManualTradeReplaceForm } from '../models';
|
|
15
15
|
import { MlegOrderResponse } from '../models';
|
|
16
16
|
import { MlegTradeForm } from '../models';
|
|
17
|
+
import { OptionImpact } from '../models';
|
|
17
18
|
import { OrderUpdatedResponse } from '../models';
|
|
18
19
|
import { SymbolsQuotesInner } from '../models';
|
|
19
20
|
import { TradingSearchCryptocurrencyPairInstruments200Response } from '../models';
|
|
@@ -57,6 +58,17 @@ export declare const TradingApiAxiosParamCreator: (configuration?: Configuration
|
|
|
57
58
|
* @throws {RequiredError}
|
|
58
59
|
*/
|
|
59
60
|
getCryptocurrencyPairQuote: (userId: string, userSecret: string, accountId: string, instrumentSymbol: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
61
|
+
/**
|
|
62
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
63
|
+
* @summary Get option order impact
|
|
64
|
+
* @param {string} userId
|
|
65
|
+
* @param {string} userSecret
|
|
66
|
+
* @param {string} accountId
|
|
67
|
+
* @param {MlegTradeForm} mlegTradeForm
|
|
68
|
+
* @param {*} [options] Override http request option.
|
|
69
|
+
* @throws {RequiredError}
|
|
70
|
+
*/
|
|
71
|
+
getOptionImpact: (userId: string, userSecret: string, accountId: string, mlegTradeForm: MlegTradeForm, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
60
72
|
/**
|
|
61
73
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
62
74
|
* @summary Check equity order impact
|
|
@@ -198,6 +210,14 @@ export declare const TradingApiFp: (configuration?: Configuration) => {
|
|
|
198
210
|
* @throws {RequiredError}
|
|
199
211
|
*/
|
|
200
212
|
getCryptocurrencyPairQuote(requestParameters: TradingApiGetCryptocurrencyPairQuoteRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CryptocurrencyPairQuote>>;
|
|
213
|
+
/**
|
|
214
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
215
|
+
* @summary Get option order impact
|
|
216
|
+
* @param {TradingApiGetOptionImpactRequest} requestParameters Request parameters.
|
|
217
|
+
* @param {*} [options] Override http request option.
|
|
218
|
+
* @throws {RequiredError}
|
|
219
|
+
*/
|
|
220
|
+
getOptionImpact(requestParameters: TradingApiGetOptionImpactRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OptionImpact>>;
|
|
201
221
|
/**
|
|
202
222
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
203
223
|
* @summary Check equity order impact
|
|
@@ -309,6 +329,14 @@ export declare const TradingApiFactory: (configuration?: Configuration, basePath
|
|
|
309
329
|
* @throws {RequiredError}
|
|
310
330
|
*/
|
|
311
331
|
getCryptocurrencyPairQuote(requestParameters: TradingApiGetCryptocurrencyPairQuoteRequest, options?: AxiosRequestConfig): AxiosPromise<CryptocurrencyPairQuote>;
|
|
332
|
+
/**
|
|
333
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
334
|
+
* @summary Get option order impact
|
|
335
|
+
* @param {TradingApiGetOptionImpactRequest} requestParameters Request parameters.
|
|
336
|
+
* @param {*} [options] Override http request option.
|
|
337
|
+
* @throws {RequiredError}
|
|
338
|
+
*/
|
|
339
|
+
getOptionImpact(requestParameters: TradingApiGetOptionImpactRequest, options?: AxiosRequestConfig): AxiosPromise<OptionImpact>;
|
|
312
340
|
/**
|
|
313
341
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
314
342
|
* @summary Check equity order impact
|
|
@@ -471,6 +499,31 @@ export type TradingApiGetCryptocurrencyPairQuoteRequest = {
|
|
|
471
499
|
*/
|
|
472
500
|
readonly instrumentSymbol: string;
|
|
473
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Request parameters for getOptionImpact operation in TradingApi.
|
|
504
|
+
* @export
|
|
505
|
+
* @interface TradingApiGetOptionImpactRequest
|
|
506
|
+
*/
|
|
507
|
+
export type TradingApiGetOptionImpactRequest = {
|
|
508
|
+
/**
|
|
509
|
+
*
|
|
510
|
+
* @type {string}
|
|
511
|
+
* @memberof TradingApiGetOptionImpact
|
|
512
|
+
*/
|
|
513
|
+
readonly userId: string;
|
|
514
|
+
/**
|
|
515
|
+
*
|
|
516
|
+
* @type {string}
|
|
517
|
+
* @memberof TradingApiGetOptionImpact
|
|
518
|
+
*/
|
|
519
|
+
readonly userSecret: string;
|
|
520
|
+
/**
|
|
521
|
+
*
|
|
522
|
+
* @type {string}
|
|
523
|
+
* @memberof TradingApiGetOptionImpact
|
|
524
|
+
*/
|
|
525
|
+
readonly accountId: string;
|
|
526
|
+
} & MlegTradeForm;
|
|
474
527
|
/**
|
|
475
528
|
* Request parameters for getOrderImpact operation in TradingApi.
|
|
476
529
|
* @export
|
|
@@ -768,6 +821,15 @@ export declare class TradingApiGenerated extends BaseAPI {
|
|
|
768
821
|
* @memberof TradingApiGenerated
|
|
769
822
|
*/
|
|
770
823
|
getCryptocurrencyPairQuote(requestParameters: TradingApiGetCryptocurrencyPairQuoteRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CryptocurrencyPairQuote, any>>;
|
|
824
|
+
/**
|
|
825
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
826
|
+
* @summary Get option order impact
|
|
827
|
+
* @param {TradingApiGetOptionImpactRequest} requestParameters Request parameters.
|
|
828
|
+
* @param {*} [options] Override http request option.
|
|
829
|
+
* @throws {RequiredError}
|
|
830
|
+
* @memberof TradingApiGenerated
|
|
831
|
+
*/
|
|
832
|
+
getOptionImpact(requestParameters: TradingApiGetOptionImpactRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<OptionImpact, any>>;
|
|
771
833
|
/**
|
|
772
834
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
773
835
|
* @summary Check equity order impact
|
|
@@ -217,6 +217,67 @@ const TradingApiAxiosParamCreator = function (configuration) {
|
|
|
217
217
|
options: localVarRequestOptions,
|
|
218
218
|
};
|
|
219
219
|
}),
|
|
220
|
+
/**
|
|
221
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
222
|
+
* @summary Get option order impact
|
|
223
|
+
* @param {string} userId
|
|
224
|
+
* @param {string} userSecret
|
|
225
|
+
* @param {string} accountId
|
|
226
|
+
* @param {MlegTradeForm} mlegTradeForm
|
|
227
|
+
* @param {*} [options] Override http request option.
|
|
228
|
+
* @throws {RequiredError}
|
|
229
|
+
*/
|
|
230
|
+
getOptionImpact: (userId, userSecret, accountId, mlegTradeForm, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
// verify required parameter 'userId' is not null or undefined
|
|
232
|
+
(0, common_1.assertParamExists)('getOptionImpact', 'userId', userId);
|
|
233
|
+
// verify required parameter 'userSecret' is not null or undefined
|
|
234
|
+
(0, common_1.assertParamExists)('getOptionImpact', 'userSecret', userSecret);
|
|
235
|
+
// verify required parameter 'accountId' is not null or undefined
|
|
236
|
+
(0, common_1.assertParamExists)('getOptionImpact', 'accountId', accountId);
|
|
237
|
+
// verify required parameter 'mlegTradeForm' is not null or undefined
|
|
238
|
+
(0, common_1.assertParamExists)('getOptionImpact', 'mlegTradeForm', mlegTradeForm);
|
|
239
|
+
const localVarPath = `/accounts/{accountId}/trading/options/impact`
|
|
240
|
+
.replace(`{${"accountId"}}`, encodeURIComponent(String(accountId !== undefined ? accountId : `-accountId-`)));
|
|
241
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
242
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
243
|
+
let baseOptions;
|
|
244
|
+
if (configuration) {
|
|
245
|
+
baseOptions = configuration.baseOptions;
|
|
246
|
+
}
|
|
247
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
248
|
+
const localVarHeaderParameter = configuration && !(0, common_1.isBrowser)() ? { "User-Agent": configuration.userAgent } : {};
|
|
249
|
+
const localVarQueryParameter = {};
|
|
250
|
+
// authentication PartnerClientId required
|
|
251
|
+
yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, key: "clientId", keyParamName: "clientId", configuration });
|
|
252
|
+
// authentication PartnerSignature required
|
|
253
|
+
yield (0, common_1.setApiKeyToObject)({ object: localVarHeaderParameter, key: "Signature", keyParamName: "signature", configuration });
|
|
254
|
+
// authentication PartnerTimestamp required
|
|
255
|
+
yield (0, common_1.setApiKeyToObject)({ object: localVarQueryParameter, key: "timestamp", keyParamName: "timestamp", configuration });
|
|
256
|
+
if (userId !== undefined) {
|
|
257
|
+
localVarQueryParameter['userId'] = userId;
|
|
258
|
+
}
|
|
259
|
+
if (userSecret !== undefined) {
|
|
260
|
+
localVarQueryParameter['userSecret'] = userSecret;
|
|
261
|
+
}
|
|
262
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
263
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
264
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
265
|
+
(0, requestBeforeHook_1.requestBeforeHook)({
|
|
266
|
+
requestBody: mlegTradeForm,
|
|
267
|
+
queryParameters: localVarQueryParameter,
|
|
268
|
+
requestConfig: localVarRequestOptions,
|
|
269
|
+
path: localVarPath,
|
|
270
|
+
configuration,
|
|
271
|
+
pathTemplate: '/accounts/{accountId}/trading/options/impact',
|
|
272
|
+
httpMethod: 'POST'
|
|
273
|
+
});
|
|
274
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(mlegTradeForm, localVarRequestOptions, configuration);
|
|
275
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
276
|
+
return {
|
|
277
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
278
|
+
options: localVarRequestOptions,
|
|
279
|
+
};
|
|
280
|
+
}),
|
|
220
281
|
/**
|
|
221
282
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
222
283
|
* @summary Check equity order impact
|
|
@@ -879,6 +940,27 @@ const TradingApiFp = function (configuration) {
|
|
|
879
940
|
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
880
941
|
});
|
|
881
942
|
},
|
|
943
|
+
/**
|
|
944
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
945
|
+
* @summary Get option order impact
|
|
946
|
+
* @param {TradingApiGetOptionImpactRequest} requestParameters Request parameters.
|
|
947
|
+
* @param {*} [options] Override http request option.
|
|
948
|
+
* @throws {RequiredError}
|
|
949
|
+
*/
|
|
950
|
+
getOptionImpact(requestParameters, options) {
|
|
951
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
952
|
+
const mlegTradeForm = {
|
|
953
|
+
order_type: requestParameters.order_type,
|
|
954
|
+
time_in_force: requestParameters.time_in_force,
|
|
955
|
+
limit_price: requestParameters.limit_price,
|
|
956
|
+
stop_price: requestParameters.stop_price,
|
|
957
|
+
price_effect: requestParameters.price_effect,
|
|
958
|
+
legs: requestParameters.legs
|
|
959
|
+
};
|
|
960
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.getOptionImpact(requestParameters.userId, requestParameters.userSecret, requestParameters.accountId, mlegTradeForm, options);
|
|
961
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
962
|
+
});
|
|
963
|
+
},
|
|
882
964
|
/**
|
|
883
965
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
884
966
|
* @summary Check equity order impact
|
|
@@ -1128,6 +1210,16 @@ const TradingApiFactory = function (configuration, basePath, axios) {
|
|
|
1128
1210
|
getCryptocurrencyPairQuote(requestParameters, options) {
|
|
1129
1211
|
return localVarFp.getCryptocurrencyPairQuote(requestParameters, options).then((request) => request(axios, basePath));
|
|
1130
1212
|
},
|
|
1213
|
+
/**
|
|
1214
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
1215
|
+
* @summary Get option order impact
|
|
1216
|
+
* @param {TradingApiGetOptionImpactRequest} requestParameters Request parameters.
|
|
1217
|
+
* @param {*} [options] Override http request option.
|
|
1218
|
+
* @throws {RequiredError}
|
|
1219
|
+
*/
|
|
1220
|
+
getOptionImpact(requestParameters, options) {
|
|
1221
|
+
return localVarFp.getOptionImpact(requestParameters, options).then((request) => request(axios, basePath));
|
|
1222
|
+
},
|
|
1131
1223
|
/**
|
|
1132
1224
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
1133
1225
|
* @summary Check equity order impact
|
|
@@ -1272,6 +1364,17 @@ class TradingApiGenerated extends base_1.BaseAPI {
|
|
|
1272
1364
|
getCryptocurrencyPairQuote(requestParameters, options) {
|
|
1273
1365
|
return (0, exports.TradingApiFp)(this.configuration).getCryptocurrencyPairQuote(requestParameters, options).then((request) => request(this.axios, this.basePath));
|
|
1274
1366
|
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
|
|
1369
|
+
* @summary Get option order impact
|
|
1370
|
+
* @param {TradingApiGetOptionImpactRequest} requestParameters Request parameters.
|
|
1371
|
+
* @param {*} [options] Override http request option.
|
|
1372
|
+
* @throws {RequiredError}
|
|
1373
|
+
* @memberof TradingApiGenerated
|
|
1374
|
+
*/
|
|
1375
|
+
getOptionImpact(requestParameters, options) {
|
|
1376
|
+
return (0, exports.TradingApiFp)(this.configuration).getOptionImpact(requestParameters, options).then((request) => request(this.axios, this.basePath));
|
|
1377
|
+
}
|
|
1275
1378
|
/**
|
|
1276
1379
|
* Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
|
1277
1380
|
* @summary Check equity order impact
|