UNPKG

@factset/sdk-formula

Version:

Formula client library for JavaScript

165 lines (157 loc) 9.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.GetTimeSeriesDataForListResponseWrapper = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _BatchStatusResponse = _interopRequireDefault(require("../model/BatchStatusResponse")); var _ErrorDetail = _interopRequireDefault(require("../model/ErrorDetail")); var _TimeSeriesRequest = _interopRequireDefault(require("../model/TimeSeriesRequest")); var _TimeSeriesResponse = _interopRequireDefault(require("../model/TimeSeriesResponse")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * FactSet Formula API * **FactSet Formula API** FactSet's Formula API is a modern, flexible, formula-based API that enables users to access FactSet's wide range of financial data and content. The API offers two endpoints, one optimized for time-series analysis and one designed for cross-sectional analysis, providing users a simplified interface into FactSet's expansive offering. By providing two endpoints, it allows for the optimization of user workflows, while reducing complexity. Leverage the power and flexibility of the Formula API to - * Pull data from across most content sets that a user has access to in a single request * Include business logic and mathematical operations in request * Submit a dynamic universe in both endpoints * Return the fsymId to easily combine with other FactSet content / products * Set the trading calendar * Define custom display names **Formula API Request Builder** The Formula API Request Builder provides users everything they need to form a Formula API request. In the Request Builder, you can select identifiers, build a universe expression, select FQL or Screening formulas, easily apply business logic and mathematical functions to the FQL or Screening formulas, specify optional parameters, and construct a GET or POST request. The Request Builder eliminates the need to have previous FQL and Screening knowledge and allows you to quickly find your desired data items and form the request. The Formula API Request Builder can be accessed by navigating to [https://developer.factset.com/formula-api-request-builder](https://developer.factset.com/formula-api-request-builder) and logging in using your FactSet.net ID. When using the Request Builder to construct requests for the one of the Formula API's endpoints, be sure to toggle to the correct endpoint at the top of the page. **How to Check the Health and Availability of the Formula API** Please use the below endpoint to check the health and availability of the Formula API. You must be authorized for this API to use the Health endpoint. [https://api.factset.com/formula-api/health](https://api.factset.com/formula-api/health) **How to Programmatically Download API Specification File** You can download the FactSet Formula API Specification File in .yaml. using the \"Download Spec\" button to the right of the version number. This specification can then be used for Codegen to create your own SDKs. * * The version of the OpenAPI document: 1.13.0 * Contact: api@factset.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. * */ /** * TimeSeries service. * @module api/TimeSeriesApi */ class TimeSeriesApi { /** * Constructs a new TimeSeriesApi. * @alias module:api/TimeSeriesApi * @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.default.instance; } /** * Retrieve data items (FQL formulas) for a list of identifiers or defined universe. * The `/time-series` endpoint is closely aligned with FactSet's powerful data retrieval language **FactSet Query Language (FQL)** which is optimized for time-series analysis. FQL can also perform sophisticated statistical, mathematical, logical, and other complex operations on the data. This endpoint has a unique **TIMESERIES** data object that pairs the requested data with FactSet provided dates. This helps reduce the need for additional data requests and reduces the work required by users. The `/time-series` endpoint supports Long Running asynchronous requests up to **30 minutes** via the `batch` parameter. *This feature is available to Individual Users subscribed to the Performance Package and Performance Package Plus Performance Tiers and all Production Users. If you are unsure which Performance Tier you are subscribed to or you would like to gain access to the batch capabilities, please contact your FactSet Account Team or \"Report Issue\" above and our support teams can assist.* * @param {module:model/TimeSeriesRequest} timeSeriesRequest * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TimeSeriesResponse} and HTTP response */ getTimeSeriesDataForListWithHttpInfo(timeSeriesRequest) { let postBody = timeSeriesRequest; // verify the required parameter 'timeSeriesRequest' is set if (timeSeriesRequest === undefined || timeSeriesRequest === null) { throw new Error("Missing the required parameter 'timeSeriesRequest' when calling getTimeSeriesDataForList"); } let pathParams = {}; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['FactSetApiKey', 'FactSetOAuth2']; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = GetTimeSeriesDataForListResponseWrapperTypeMap; return this.apiClient.callApi('/time-series', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null); } /** * Retrieve data items (FQL formulas) for a list of identifiers or defined universe. * The `/time-series` endpoint is closely aligned with FactSet's powerful data retrieval language **FactSet Query Language (FQL)** which is optimized for time-series analysis. FQL can also perform sophisticated statistical, mathematical, logical, and other complex operations on the data. This endpoint has a unique **TIMESERIES** data object that pairs the requested data with FactSet provided dates. This helps reduce the need for additional data requests and reduces the work required by users. The `/time-series` endpoint supports Long Running asynchronous requests up to **30 minutes** via the `batch` parameter. *This feature is available to Individual Users subscribed to the Performance Package and Performance Package Plus Performance Tiers and all Production Users. If you are unsure which Performance Tier you are subscribed to or you would like to gain access to the batch capabilities, please contact your FactSet Account Team or \"Report Issue\" above and our support teams can assist.* * @param {module:model/TimeSeriesRequest} timeSeriesRequest * @return { Promise.< GetTimeSeriesDataForListResponseWrapper > } a Promise, with data of type {@link GetTimeSeriesDataForListResponseWrapper } */ getTimeSeriesDataForList(timeSeriesRequest) { return this.getTimeSeriesDataForListWithHttpInfo(timeSeriesRequest).then(function (response_and_data) { return response_and_data.data; }); } } exports.default = TimeSeriesApi; const GetTimeSeriesDataForListResponseWrapperTypeMap = { 200: _TimeSeriesResponse.default, 202: _BatchStatusResponse.default, 400: _ErrorDetail.default, 401: _ErrorDetail.default, 403: _ErrorDetail.default, 404: _ErrorDetail.default, 405: _ErrorDetail.default, 406: _ErrorDetail.default, 408: _ErrorDetail.default, 413: _ErrorDetail.default, 415: _ErrorDetail.default, 429: _ErrorDetail.default, 500: _ErrorDetail.default, 501: _ErrorDetail.default, 503: _ErrorDetail.default, _createResponseWrapper(statusCode, response) { return new GetTimeSeriesDataForListResponseWrapper(statusCode, response); } }; /** * Wrapper to support POST /time-series returning different types * per status code. * * <p> * Responses: * <ul> * <li>200 : {@code TimeSeriesResponse }<br>Gets an array of &#x60;Response Objects&#x60; for a list of IDs and FQL formulas.</li> * * <li>202 : {@code BatchStatusResponse }<br>Batch request has been accepted.</li> * </ul> * * </p> * Example: * <pre>{@code * const response = ...; * switch (response.statusCode) { * case 200: * TimeSeriesResponse data200 = response.getResponse200(); * break; * case 202: * BatchStatusResponse data202 = response.getResponse202(); * break; * } * }</pre> * * @alias module:GetTimeSeriesDataForListResponseWrapper * @class */ class GetTimeSeriesDataForListResponseWrapper { /** * @param {number} statusCode * @param {*} response */ constructor(statusCode, response) { /** * @type {number} */ this.statusCode = statusCode; /** * @type {*} */ this.response = response; } /** * @returns { TimeSeriesResponse } */ getResponse200() { if (this.statusCode !== 200) { throw new Error("Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response"); } return this.response; } /** * @returns { BatchStatusResponse } */ getResponse202() { if (this.statusCode !== 202) { throw new Error("Invalid response getter called. getResponse202 can't return a " + this.statusCode + " response"); } return this.response; } } exports.GetTimeSeriesDataForListResponseWrapper = GetTimeSeriesDataForListResponseWrapper;