UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

209 lines (202 loc) 10.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExpiredInstrumentApi = void 0; var _ApiClient = require("../ApiClient"); var _ApiGatewayErrorResponse = require("../model/ApiGatewayErrorResponse"); var _GetExpiredFuturesContractResponse = require("../model/GetExpiredFuturesContractResponse"); var _GetExpiriesResponse = require("../model/GetExpiriesResponse"); var _GetHistoricalCandleResponse = require("../model/GetHistoricalCandleResponse"); var _GetOptionContractResponse = require("../model/GetOptionContractResponse"); /* * 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. * */ /** * ExpiredInstrument service. * @module api/ExpiredInstrumentApi * @version v0 */ class ExpiredInstrumentApi { /** * Constructs a new ExpiredInstrumentApi. * @alias module:api/ExpiredInstrumentApi * @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 getExpiredFutureContracts operation. * @callback moduleapi/ExpiredInstrumentApi~getExpiredFutureContractsCallback * @param {String} error Error message, if any. * @param {module:model/GetExpiredFuturesContractResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Expired instruments - Get future contracts * This API provides the functionality to retrieve expired future contracts for a given instrument key and expiry date. * @param {String} instrumentKey Instrument Key of asset * @param {String} expiryDate Expiry date of the instrument * @param {module:api/ExpiredInstrumentApi~getExpiredFutureContractsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getExpiredFutureContracts(instrumentKey, expiryDate, callback) { let postBody = null; // verify the required parameter 'instrumentKey' is set if (instrumentKey === undefined || instrumentKey === null) { throw new Error("Missing the required parameter 'instrumentKey' when calling getExpiredFutureContracts"); } // verify the required parameter 'expiryDate' is set if (expiryDate === undefined || expiryDate === null) { throw new Error("Missing the required parameter 'expiryDate' when calling getExpiredFutureContracts"); } let pathParams = {}; let queryParams = { 'instrument_key': instrumentKey, 'expiry_date': expiryDate }; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = _GetExpiredFuturesContractResponse.GetExpiredFuturesContractResponse; return this.apiClient.callApi('/v2/expired-instruments/future/contract', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getExpiredHistoricalCandleData operation. * @callback moduleapi/ExpiredInstrumentApi~getExpiredHistoricalCandleDataCallback * @param {String} error Error message, if any. * @param {module:model/GetHistoricalCandleResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Expired Historical candle data * Get Expired OHLC values for all instruments across various timeframes. Expired Historical data can be fetched for the following durations. 1minute: last 1 month candles till endDate 30minute: last 1 year candles till endDate day: last 1 year candles till endDate week: last 10 year candles till endDate month: last 10 year candles till endDate * @param {String} expiredInstrumentKey Expired Instrument Key of asset * @param {String} interval Interval to get expired ohlc data * @param {String} toDate to date * @param {String} fromDate from date * @param {module:api/ExpiredInstrumentApi~getExpiredHistoricalCandleDataCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getExpiredHistoricalCandleData(expiredInstrumentKey, interval, toDate, fromDate, callback) { let postBody = null; // verify the required parameter 'expiredInstrumentKey' is set if (expiredInstrumentKey === undefined || expiredInstrumentKey === null) { throw new Error("Missing the required parameter 'expiredInstrumentKey' when calling getExpiredHistoricalCandleData"); } // verify the required parameter 'interval' is set if (interval === undefined || interval === null) { throw new Error("Missing the required parameter 'interval' when calling getExpiredHistoricalCandleData"); } // verify the required parameter 'toDate' is set if (toDate === undefined || toDate === null) { throw new Error("Missing the required parameter 'toDate' when calling getExpiredHistoricalCandleData"); } // verify the required parameter 'fromDate' is set if (fromDate === undefined || fromDate === null) { throw new Error("Missing the required parameter 'fromDate' when calling getExpiredHistoricalCandleData"); } let pathParams = { 'expired_instrument_key': expiredInstrumentKey, 'interval': interval, 'to_date': toDate, 'from_date': fromDate }; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = _GetHistoricalCandleResponse.GetHistoricalCandleResponse; return this.apiClient.callApi('/v2/expired-instruments/historical-candle/{expired_instrument_key}/{interval}/{to_date}/{from_date}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getExpiredOptionContracts operation. * @callback moduleapi/ExpiredInstrumentApi~getExpiredOptionContractsCallback * @param {String} error Error message, if any. * @param {module:model/GetOptionContractResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get expired option contracts * This API provides the functionality to retrieve the expired option contracts * @param {String} instrumentKey Instrument key for an underlying symbol * @param {String} expiryDate Expiry date in format: YYYY-mm-dd * @param {module:api/ExpiredInstrumentApi~getExpiredOptionContractsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getExpiredOptionContracts(instrumentKey, expiryDate, callback) { let postBody = null; // verify the required parameter 'instrumentKey' is set if (instrumentKey === undefined || instrumentKey === null) { throw new Error("Missing the required parameter 'instrumentKey' when calling getExpiredOptionContracts"); } // verify the required parameter 'expiryDate' is set if (expiryDate === undefined || expiryDate === null) { throw new Error("Missing the required parameter 'expiryDate' when calling getExpiredOptionContracts"); } let pathParams = {}; let queryParams = { 'instrument_key': instrumentKey, 'expiry_date': expiryDate }; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = _GetOptionContractResponse.GetOptionContractResponse; return this.apiClient.callApi('/v2/expired-instruments/option/contract', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getExpiries operation. * @callback moduleapi/ExpiredInstrumentApi~getExpiriesResponseCallback * @param {String} error Error message, if any. * @param {module:model/GetExpiriesResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Expired instruments - Get expiries * This API provides the functionality to retrieve expiry dates for a given instrument key. * @param {String} instrumentKey Instrument Key of asset * @param {module:api/ExpiredInstrumentApi~getExpiriesResponseCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getExpiries(instrumentKey, callback) { let postBody = null; // verify the required parameter 'instrumentKey' is set if (instrumentKey === undefined || instrumentKey === null) { throw new Error("Missing the required parameter 'instrumentKey' when calling getExpiries"); } let pathParams = {}; let queryParams = { 'instrument_key': instrumentKey }; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = _GetExpiriesResponse.GetExpiriesResponse; return this.apiClient.callApi('/v2/expired-instruments/expiries', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } } exports.ExpiredInstrumentApi = ExpiredInstrumentApi;