UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

145 lines (139 loc) 6.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MarketQuoteV3Api = void 0; var _ApiClient = require("../ApiClient"); var _ApiGatewayErrorResponse = require("../model/ApiGatewayErrorResponse"); var _GetMarketQuoteLastTradedPriceResponseV = require("../model/GetMarketQuoteLastTradedPriceResponseV3"); var _GetMarketQuoteOHLCResponseV = require("../model/GetMarketQuoteOHLCResponseV3"); var _GetMarketQuoteOptionGreekResponseV = require("../model/GetMarketQuoteOptionGreekResponseV3"); /* * 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. * */ /** * MarketQuoteV3 service. * @module api/MarketQuoteV3Api * @version v0 */ 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.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 = _GetMarketQuoteLastTradedPriceResponseV.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 = _GetMarketQuoteOHLCResponseV.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 = _GetMarketQuoteOptionGreekResponseV.GetMarketQuoteOptionGreekResponseV3; return this.apiClient.callApi('/v3/market-quote/option-greek', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } } exports.MarketQuoteV3Api = MarketQuoteV3Api;