snaptrade-typescript-sdk 9.0.166 → 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 +42 -1
- package/dist/api/options-api-generated.d.ts +61 -0
- package/dist/api/options-api-generated.js +91 -0
- package/dist/browser.js +1 -1
- package/dist/configuration.js +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/option-quote.d.ts +80 -0
- package/dist/models/option-quote.js +2 -0
- package/dist/operationParameterMap.js +13 -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)
|
|
@@ -1360,6 +1361,46 @@ Defaults to true. Indicates if request should fetch only executed orders. Set to
|
|
|
1360
1361
|
---
|
|
1361
1362
|
|
|
1362
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
|
+
|
|
1363
1404
|
### `snaptrade.options.getOptionsChain`<a id="snaptradeoptionsgetoptionschain"></a>
|
|
1364
1405
|
|
|
1365
1406
|
Returns the option chain for the specified symbol in the specified account.
|
|
@@ -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
|