UNPKG

@gitchrisqueen/tdameritrade-api-js-client

Version:
132 lines (114 loc) 3.71 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 GetQuoteResponse from '../model/GetQuoteResponse'; /** * Quotes service. * @module api/QuotesApi * @version 0.1.4 */ export default class QuotesApi { /** * Constructs a new QuotesApi. * @alias module:api/QuotesApi * @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 Quotes * Get quote for one or more symbols * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetQuoteResponse} and HTTP response */ marketdataQuotesGETWithHttpInfo(opts) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'apikey': opts['apikey'], 'symbol': opts['symbol'] }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = GetQuoteResponse; return this.apiClient.callApi( '/marketdata/quotes', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Quotes * Get quote for one or more symbols * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetQuoteResponse} */ marketdataQuotesGET(opts) { return this.marketdataQuotesGETWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get Quote * Get quote for a 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/GetQuoteResponse} and HTTP response */ marketdataSymbolQuotesGETWithHttpInfo(symbol, opts) { opts = opts || {}; let postBody = null; let pathParams = { 'symbol': symbol }; let queryParams = { 'apikey': opts['apikey'] }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = GetQuoteResponse; return this.apiClient.callApi( '/marketdata/{symbol}/quotes', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Quote * Get quote for a symbol * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetQuoteResponse} */ marketdataSymbolQuotesGET(symbol, opts) { return this.marketdataSymbolQuotesGETWithHttpInfo(symbol, opts) .then(function(response_and_data) { return response_and_data.data; }); } }