UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

226 lines (198 loc) 8.89 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 {GetHistoricalCandleResponse} from '../model/GetHistoricalCandleResponse'; import {GetIntraDayCandleResponse} from '../model/GetIntraDayCandleResponse'; /** * HistoryV3 service. * @module api/HistoryV3Api * @version v0 */ export class HistoryV3Api { /** * Constructs a new HistoryV3Api. * @alias module:api/HistoryV3Api * @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 getHistoricalCandleData operation. * @callback moduleapi/HistoryV3Api~getHistoricalCandleDataCallback * @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. */ /** * Historical candle data * Get OHLC values for all instruments for the present trading day with expanded interval options. * @param {String} instrumentKey * @param {String} unit * @param {Number} interval * @param {String} toDate * @param {module:api/HistoryV3Api~getHistoricalCandleDataCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getHistoricalCandleData(instrumentKey, unit, interval, toDate, 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 getHistoricalCandleData"); } // verify the required parameter 'unit' is set if (unit === undefined || unit === null) { throw new Error("Missing the required parameter 'unit' when calling getHistoricalCandleData"); } // verify the required parameter 'interval' is set if (interval === undefined || interval === null) { throw new Error("Missing the required parameter 'interval' when calling getHistoricalCandleData"); } // verify the required parameter 'toDate' is set if (toDate === undefined || toDate === null) { throw new Error("Missing the required parameter 'toDate' when calling getHistoricalCandleData"); } let pathParams = { 'instrumentKey': instrumentKey,'unit': unit,'interval': interval,'to_date': toDate }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = GetHistoricalCandleResponse; return this.apiClient.callApi( '/v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getHistoricalCandleData1 operation. * @callback moduleapi/HistoryV3Api~getHistoricalCandleData1Callback * @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. */ /** * Historical candle data * Get OHLC values for all instruments for the present trading day with expanded interval options * @param {String} instrumentKey * @param {String} unit * @param {Number} interval * @param {String} toDate * @param {String} fromDate * @param {module:api/HistoryV3Api~getHistoricalCandleData1Callback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getHistoricalCandleData1(instrumentKey, unit, interval, toDate, fromDate, 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 getHistoricalCandleData1"); } // verify the required parameter 'unit' is set if (unit === undefined || unit === null) { throw new Error("Missing the required parameter 'unit' when calling getHistoricalCandleData1"); } // verify the required parameter 'interval' is set if (interval === undefined || interval === null) { throw new Error("Missing the required parameter 'interval' when calling getHistoricalCandleData1"); } // verify the required parameter 'toDate' is set if (toDate === undefined || toDate === null) { throw new Error("Missing the required parameter 'toDate' when calling getHistoricalCandleData1"); } // verify the required parameter 'fromDate' is set if (fromDate === undefined || fromDate === null) { throw new Error("Missing the required parameter 'fromDate' when calling getHistoricalCandleData1"); } let pathParams = { 'instrumentKey': instrumentKey,'unit': unit,'interval': interval,'to_date': toDate,'from_date': fromDate }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = GetHistoricalCandleResponse; return this.apiClient.callApi( '/v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date}/{from_date}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getIntraDayCandleData operation. * @callback moduleapi/HistoryV3Api~getIntraDayCandleDataCallback * @param {String} error Error message, if any. * @param {module:model/GetIntraDayCandleResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Intra day candle data * Get OHLC values for all instruments for the present trading day * @param {String} instrumentKey * @param {String} unit * @param {Number} interval * @param {module:api/HistoryV3Api~getIntraDayCandleDataCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getIntraDayCandleData(instrumentKey, unit, interval, 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 getIntraDayCandleData"); } // verify the required parameter 'unit' is set if (unit === undefined || unit === null) { throw new Error("Missing the required parameter 'unit' when calling getIntraDayCandleData"); } // verify the required parameter 'interval' is set if (interval === undefined || interval === null) { throw new Error("Missing the required parameter 'interval' when calling getIntraDayCandleData"); } let pathParams = { 'instrumentKey': instrumentKey,'unit': unit,'interval': interval }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = []; let accepts = ['application/json', '*/*']; let returnType = GetIntraDayCandleResponse; return this.apiClient.callApi( '/v3/historical-candle/intraday/{instrumentKey}/{unit}/{interval}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }