UNPKG

@gitchrisqueen/tdameritrade-api-js-client

Version:
101 lines (89 loc) 2.99 kB
/** * TD Ameritrade API - OAuth2 * This is replication of the TD Ameritrade API. * * OpenAPI spec version: 0.1.4 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * */ import ApiClient from "../ApiClient"; import ErrorObject from '../model/ErrorObject'; import OptionChain from '../model/OptionChain'; import Strategy from '../model/Strategy'; /** * OptionChains service. * @module api/OptionChainsApi * @version 0.1.4 */ export default class OptionChainsApi { /** * Constructs a new OptionChainsApi. * @alias module:api/OptionChainsApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; } /** * Get Option Chain * Get option chain for an optionable Symbol * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OptionChain} and HTTP response */ marketdataChainsGETWithHttpInfo(opts) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'apikey': opts['apikey'], 'symbol': opts['symbol'], 'contractType': opts['contractType'], 'strikeCount': opts['strikeCount'], 'includeQuotes': opts['includeQuotes'], 'strategy': opts['strategy'], 'interval': opts['interval'], 'strike': opts['strike'], 'range': opts['range'], 'fromDate': opts['fromDate'], 'toDate': opts['toDate'], 'volatility': opts['volatility'], 'underlyingPrice': opts['underlyingPrice'], 'interestRate': opts['interestRate'], 'daysToExpiration': opts['daysToExpiration'], 'expMonth': opts['expMonth'], 'optionType': opts['optionType'] }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = OptionChain; return this.apiClient.callApi( '/marketdata/chains', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Option Chain * Get option chain for an optionable Symbol * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OptionChain} */ marketdataChainsGET(opts) { return this.marketdataChainsGETWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } }