UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

178 lines (153 loc) 6.6 kB
/* * OpenAPI definition * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: v0 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 3.0.66 * * Do not edit the class manually. * */ import {ApiClient} from "../ApiClient"; import {ApiGatewayErrorResponse} from '../model/ApiGatewayErrorResponse'; import {GetMarketQuoteLastTradedPriceResponseV3} from '../model/GetMarketQuoteLastTradedPriceResponseV3'; import {GetMarketQuoteOHLCResponseV3} from '../model/GetMarketQuoteOHLCResponseV3'; import {GetMarketQuoteOptionGreekResponseV3} from '../model/GetMarketQuoteOptionGreekResponseV3'; /** * MarketQuoteV3 service. * @module api/MarketQuoteV3Api * @version v0 */ export class MarketQuoteV3Api { /** * Constructs a new MarketQuoteV3Api. * @alias module:api/MarketQuoteV3Api * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instanc e} if unspecified. */ constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; } /** * Callback function to receive the result of the getLtp operation. * @callback moduleapi/MarketQuoteV3Api~getLtpCallback * @param {String} error Error message, if any. * @param {module:model/GetMarketQuoteLastTradedPriceResponseV3{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Market quotes and instruments - LTP quotes. * This API provides the functionality to retrieve the LTP quotes for one or more instruments.This API returns the LTPs of up to 500 instruments in one go. * @param {Object} opts Optional parameters * @param {String} opts.instrumentKey Comma separated list of instrument keys * @param {module:api/MarketQuoteV3Api~getLtpCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getLtp(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'instrument_key': opts['instrumentKey'] }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = GetMarketQuoteLastTradedPriceResponseV3; return this.apiClient.callApi( '/v3/market-quote/ltp', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMarketQuoteOHLC operation. * @callback moduleapi/MarketQuoteV3Api~getMarketQuoteOHLCCallback * @param {String} error Error message, if any. * @param {module:model/GetMarketQuoteOHLCResponseV3{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Market quotes and instruments - OHLC quotes * This API provides the functionality to retrieve the OHLC quotes for one or more instruments.This API returns the OHLC snapshots of up to 500 instruments in one go. * @param {String} interval Interval to get ohlc data * @param {Object} opts Optional parameters * @param {String} opts.instrumentKey Comma separated list of instrument keys * @param {module:api/MarketQuoteV3Api~getMarketQuoteOHLCCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getMarketQuoteOHLC(interval, opts, callback) { opts = opts || {}; let postBody = null; // verify the required parameter 'interval' is set if (interval === undefined || interval === null) { throw new Error("Missing the required parameter 'interval' when calling getMarketQuoteOHLC"); } let pathParams = { }; let queryParams = { 'instrument_key': opts['instrumentKey'],'interval': interval }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = GetMarketQuoteOHLCResponseV3; return this.apiClient.callApi( '/v3/market-quote/ohlc', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMarketQuoteOptionGreek operation. * @callback moduleapi/MarketQuoteV3Api~getMarketQuoteOptionGreekCallback * @param {String} error Error message, if any. * @param {module:model/GetMarketQuoteOptionGreekResponseV3{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Market quotes and instruments - Option Greek * This API provides the functionality to retrieve the Option Greek data for one or more instruments.This API returns the Option Greek data of up to 500 instruments in one go. * @param {Object} opts Optional parameters * @param {String} opts.instrumentKey Comma separated list of instrument keys * @param {module:api/MarketQuoteV3Api~getMarketQuoteOptionGreekCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getMarketQuoteOptionGreek(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'instrument_key': opts['instrumentKey'] }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = GetMarketQuoteOptionGreekResponseV3; return this.apiClient.callApi( '/v3/market-quote/option-greek', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }