com.factset.sdk.FactSetGlobalPrices.api.PricesApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of factsetglobalprices Show documentation
Show all versions of factsetglobalprices Show documentation
FactSet SDK for Java - factsetglobalprices
package com.factset.sdk.FactSetGlobalPrices.api;
import com.factset.sdk.FactSetGlobalPrices.ApiException;
import com.factset.sdk.FactSetGlobalPrices.ApiClient;
import com.factset.sdk.FactSetGlobalPrices.ApiResponse;
import com.factset.sdk.FactSetGlobalPrices.Configuration;
import com.factset.sdk.FactSetGlobalPrices.Pair;
import jakarta.ws.rs.core.GenericType;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import com.factset.sdk.FactSetGlobalPrices.models.BatchStatusResponse;
import com.factset.sdk.FactSetGlobalPrices.models.ErrorResponse;
import com.factset.sdk.FactSetGlobalPrices.models.GlobalPricesRequest;
import com.factset.sdk.FactSetGlobalPrices.models.GlobalPricesResponse;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class PricesApi {
private ApiClient apiClient;
public PricesApi() {
this(Configuration.getDefaultApiClient());
}
public PricesApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
private static final Map getGPDPricesResponseTypeMap = new HashMap();
static {
getGPDPricesResponseTypeMap.put(200, new GenericType(){});
getGPDPricesResponseTypeMap.put(202, new GenericType(){});
getGPDPricesResponseTypeMap.put(400, new GenericType(){});
getGPDPricesResponseTypeMap.put(401, new GenericType(){});
getGPDPricesResponseTypeMap.put(403, new GenericType(){});
getGPDPricesResponseTypeMap.put(415, new GenericType(){});
getGPDPricesResponseTypeMap.put(500, new GenericType(){});
}
private static final Map getSecurityPricesForListResponseTypeMap = new HashMap();
static {
getSecurityPricesForListResponseTypeMap.put(200, new GenericType(){});
getSecurityPricesForListResponseTypeMap.put(202, new GenericType(){});
getSecurityPricesForListResponseTypeMap.put(400, new GenericType(){});
getSecurityPricesForListResponseTypeMap.put(401, new GenericType(){});
getSecurityPricesForListResponseTypeMap.put(403, new GenericType(){});
getSecurityPricesForListResponseTypeMap.put(415, new GenericType(){});
getSecurityPricesForListResponseTypeMap.put(500, new GenericType(){});
}
/**
* Wrapper to support GET /factset-global-prices/v1/prices returning different types
* per status code.
*
*
* Responses:
*
* - 200 : {@code GlobalPricesResponse }
Array of Price Objects
*
* - 202 : {@code BatchStatusResponse }
Batch request has been accepted.
*
*
*
* Example:
*
{@code
* GetGPDPricesResponseWrapper response = ...;
* switch (response.statusCode) {
* case 200:
* GlobalPricesResponse data200 = response.getResponse200();
* break;
* case 202:
* BatchStatusResponse data202 = response.getResponse202();
* break;
* }
* }
*/
public static class GetGPDPricesResponseWrapper {
public final int statusCode;
public final Object response;
public GetGPDPricesResponseWrapper(int statusCode, Object response) {
this.statusCode = statusCode;
this.response = response;
}
public int getStatusCode() { return statusCode; }
public Object getResponse() { return response; }
public GlobalPricesResponse getResponse200() throws ApiException {
if (this.statusCode != 200) {
throw new ApiException(500, "Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response");
}
return (GlobalPricesResponse) this.response;
}
public BatchStatusResponse getResponse202() throws ApiException {
if (this.statusCode != 202) {
throw new ApiException(500, "Invalid response getter called. getResponse202 can't return a " + this.statusCode + " response");
}
return (BatchStatusResponse) this.response;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GetGPDPricesResponseWrapper other = (GetGPDPricesResponseWrapper) o;
return this.statusCode == other.statusCode &&
Objects.equals(this.response, other.response);
}
@Override
public int hashCode() {
return Objects.hash(statusCode, response);
}
@Override
public String toString() {
return "class GetGPDPricesResponseWrapper {\n"
+ " statusCode: " + statusCode + "\n"
+ " response: "
+ Objects.toString(response).replace("\n", "\n ")
+ "\n}";
}
}
/**
* Wrapper to support POST /factset-global-prices/v1/prices returning different types
* per status code.
*
*
* Responses:
*
* - 200 : {@code GlobalPricesResponse }
Array of security prices
*
* - 202 : {@code BatchStatusResponse }
Batch request has been accepted.
*
*
*
* Example:
*
{@code
* GetSecurityPricesForListResponseWrapper response = ...;
* switch (response.statusCode) {
* case 200:
* GlobalPricesResponse data200 = response.getResponse200();
* break;
* case 202:
* BatchStatusResponse data202 = response.getResponse202();
* break;
* }
* }
*/
public static class GetSecurityPricesForListResponseWrapper {
public final int statusCode;
public final Object response;
public GetSecurityPricesForListResponseWrapper(int statusCode, Object response) {
this.statusCode = statusCode;
this.response = response;
}
public int getStatusCode() { return statusCode; }
public Object getResponse() { return response; }
public GlobalPricesResponse getResponse200() throws ApiException {
if (this.statusCode != 200) {
throw new ApiException(500, "Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response");
}
return (GlobalPricesResponse) this.response;
}
public BatchStatusResponse getResponse202() throws ApiException {
if (this.statusCode != 202) {
throw new ApiException(500, "Invalid response getter called. getResponse202 can't return a " + this.statusCode + " response");
}
return (BatchStatusResponse) this.response;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GetSecurityPricesForListResponseWrapper other = (GetSecurityPricesForListResponseWrapper) o;
return this.statusCode == other.statusCode &&
Objects.equals(this.response, other.response);
}
@Override
public int hashCode() {
return Objects.hash(statusCode, response);
}
@Override
public String toString() {
return "class GetSecurityPricesForListResponseWrapper {\n"
+ " statusCode: " + statusCode + "\n"
+ " response: "
+ Objects.toString(response).replace("\n", "\n ")
+ "\n}";
}
}
/**
* Get the API client
*
* @return API client
*/
public ApiClient getApiClient() {
return apiClient;
}
/**
* Set the API client
*
* @param apiClient an instance of API client
*/
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Gets end-of-day Open, High, Low, Close for a list of securities.
* Gets security prices', Open, High, Low, Close, Volume, VWAP, Trade Count, and Turn Over for a specified list of securities, date range, currency, and adjustment factors.
* @param ids The requested list of security identifiers. Accepted ID types include Market Tickers, SEDOL, ISINs, CUSIPs, or FactSet Permanent Ids.<p>***ids limit** = 1000 per non-batch request / 2000 per batch request for a single day and 50 per multi-day request. The number of unique currencies present in the requested ids is limited to 50 per request.*</p> *<p>Make note, GET Method URL request lines are also limited to a total length of 8192 bytes (8KB). In cases where the service allows for thousands of ids, which may lead to exceeding this request line limit of 8KB, it's advised for any requests with large request lines to be requested through the respective \"POST\" method.</p>* (required)
* @param startDate The start date requested for a given date range in **YYYY-MM-DD** format. The input start date must be before the input end date. Future dates (T+1) are not accepted in this endpoint. (required)
* @param fields Request available pricing data fields to be included in the response. Default is all fields. All responses will include the _fsymId_, _date_, and _currency_ fields. |field|description| |---|---| |price|Closing Price| |priceOpen|Opening Price| |priceHigh|High Price| |priceLow|Low Price| |volume|Volume| |turnover|Total Trade Value for the Day| |tradeCount|Number of Trades| |vwap|Volume Weighted Average Price| (optional, default to [\"price\",\"priceOpen\",\"priceHigh\",\"priceLow\",\"volume\",\"turnover\",\"tradeCount\",\"vwap\",\"currency\"])
* @param endDate The end date requested for a given date range in **YYYY-MM-DD** format. The input end date must be after the input start date. Future dates (T+1) are not accepted in this endpoint. (optional)
* @param frequency Controls the display frequency of the data returned. * **D** = Daily * **AD** = Actual Daily * **W** = Weekly, based on the last day of the week of the start date. * **M** = Monthly, based on the last trading day of the month. * **AM** = Monthly, based on the start date (e.g., if the start date is June 16, data is displayed for June 16, May 16, April 16 etc.). * **AQ** = Actual Quarterly * **CQ** = Quarterly based on the last trading day of the calendar quarter (March, June, September, or December). * **ASA** = Actual Semi-annual * **CSA** = Calendar Semi-annual * **AY** = Actual Annual, based on the start date. * **CY** = Calendar Annual, based on the last trading day of the calendar year. (optional, default to D)
* @param calendar Calendar of data returned. SEVENDAY includes weekends. (optional, default to FIVEDAY)
* @param currency Currency code for adjusting prices. Default is Local. For a list of currency ISO codes, visit [Online Assistant Page 1470](https://oa.apps.factset.com/pages/1470). (optional)
* @param adjust Controls the split and spinoff adjustments for the prices. * **SPLIT** = Split ONLY Adjusted. This is used by default. * **SPLIT_SPINOFF** = Splits & Spinoff Adjusted. * **UNSPLIT** = No Adjustments. (optional, default to SPLIT)
* @param batch Enables the ability to asynchronously \"batch\" the request, supporting a long-running request for up to 20 minutes. Upon requesting batch=Y, the service will respond with an HTTP Status Code of 202. Once a batch request is submitted, use batch status to see if the job has been completed. Once completed, retrieve the results of the request via batch-result. When using Batch, ids limit is increased to 10000 ids per request, though limits on query string via GET method still apply. It's advised to submit large lists of ids via POST method. <B>Please note that the number of unique currencies present in the requested ids is limited to 50 per request.</B> (optional, default to N)
* @return GetGPDPricesResponseWrapper
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 Array of Price Objects -
202 Batch request has been accepted. * Location - Path to Batch Request result.
400 Bad Request. This can occur for several reasons. Please review the \"message\" for more details. -
401 Unauthenticated USERNAME-SERIAL. Ensure you are logged in and have successfully generated an API KEY for the IP range you are connecting from. For more help, select the **Report Issue** in the top right corner of this Developer Portal specification card and choose Connectivity 401 or 403 Responses. -
403 The USERNAME-SERIAL attempted to request the endpoint is not authorized to access. The request was a legal request, but the server is refusing to respond. Please reach out to FactSet Account Team for assistance with authorization. -
415 Unsupported Media Type. This error may be returned when the caller sends a resource in a format that is not accepted by the server. This can be fixed by ensuring that Content-Type header is set to the correct value. In this instance, \"application/json\" would be the appropriate value. -
500 Internal Server Error. -
*/
public GetGPDPricesResponseWrapper getGPDPrices(java.util.List ids, String startDate, java.util.List fields, String endDate, String frequency, String calendar, String currency, String adjust, String batch) throws ApiException {
return getGPDPricesWithHttpInfo(ids, startDate, fields, endDate, frequency, calendar, currency, adjust, batch).getData();
}
/**
* Gets end-of-day Open, High, Low, Close for a list of securities.
* Gets security prices', Open, High, Low, Close, Volume, VWAP, Trade Count, and Turn Over for a specified list of securities, date range, currency, and adjustment factors.
* @param ids The requested list of security identifiers. Accepted ID types include Market Tickers, SEDOL, ISINs, CUSIPs, or FactSet Permanent Ids.<p>***ids limit** = 1000 per non-batch request / 2000 per batch request for a single day and 50 per multi-day request. The number of unique currencies present in the requested ids is limited to 50 per request.*</p> *<p>Make note, GET Method URL request lines are also limited to a total length of 8192 bytes (8KB). In cases where the service allows for thousands of ids, which may lead to exceeding this request line limit of 8KB, it's advised for any requests with large request lines to be requested through the respective \"POST\" method.</p>* (required)
* @param startDate The start date requested for a given date range in **YYYY-MM-DD** format. The input start date must be before the input end date. Future dates (T+1) are not accepted in this endpoint. (required)
* @param fields Request available pricing data fields to be included in the response. Default is all fields. All responses will include the _fsymId_, _date_, and _currency_ fields. |field|description| |---|---| |price|Closing Price| |priceOpen|Opening Price| |priceHigh|High Price| |priceLow|Low Price| |volume|Volume| |turnover|Total Trade Value for the Day| |tradeCount|Number of Trades| |vwap|Volume Weighted Average Price| (optional, default to [\"price\",\"priceOpen\",\"priceHigh\",\"priceLow\",\"volume\",\"turnover\",\"tradeCount\",\"vwap\",\"currency\"])
* @param endDate The end date requested for a given date range in **YYYY-MM-DD** format. The input end date must be after the input start date. Future dates (T+1) are not accepted in this endpoint. (optional)
* @param frequency Controls the display frequency of the data returned. * **D** = Daily * **AD** = Actual Daily * **W** = Weekly, based on the last day of the week of the start date. * **M** = Monthly, based on the last trading day of the month. * **AM** = Monthly, based on the start date (e.g., if the start date is June 16, data is displayed for June 16, May 16, April 16 etc.). * **AQ** = Actual Quarterly * **CQ** = Quarterly based on the last trading day of the calendar quarter (March, June, September, or December). * **ASA** = Actual Semi-annual * **CSA** = Calendar Semi-annual * **AY** = Actual Annual, based on the start date. * **CY** = Calendar Annual, based on the last trading day of the calendar year. (optional, default to D)
* @param calendar Calendar of data returned. SEVENDAY includes weekends. (optional, default to FIVEDAY)
* @param currency Currency code for adjusting prices. Default is Local. For a list of currency ISO codes, visit [Online Assistant Page 1470](https://oa.apps.factset.com/pages/1470). (optional)
* @param adjust Controls the split and spinoff adjustments for the prices. * **SPLIT** = Split ONLY Adjusted. This is used by default. * **SPLIT_SPINOFF** = Splits & Spinoff Adjusted. * **UNSPLIT** = No Adjustments. (optional, default to SPLIT)
* @param batch Enables the ability to asynchronously \"batch\" the request, supporting a long-running request for up to 20 minutes. Upon requesting batch=Y, the service will respond with an HTTP Status Code of 202. Once a batch request is submitted, use batch status to see if the job has been completed. Once completed, retrieve the results of the request via batch-result. When using Batch, ids limit is increased to 10000 ids per request, though limits on query string via GET method still apply. It's advised to submit large lists of ids via POST method. <B>Please note that the number of unique currencies present in the requested ids is limited to 50 per request.</B> (optional, default to N)
* @return ApiResponse<GetGPDPricesResponseWrapper>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 Array of Price Objects -
202 Batch request has been accepted. * Location - Path to Batch Request result.
400 Bad Request. This can occur for several reasons. Please review the \"message\" for more details. -
401 Unauthenticated USERNAME-SERIAL. Ensure you are logged in and have successfully generated an API KEY for the IP range you are connecting from. For more help, select the **Report Issue** in the top right corner of this Developer Portal specification card and choose Connectivity 401 or 403 Responses. -
403 The USERNAME-SERIAL attempted to request the endpoint is not authorized to access. The request was a legal request, but the server is refusing to respond. Please reach out to FactSet Account Team for assistance with authorization. -
415 Unsupported Media Type. This error may be returned when the caller sends a resource in a format that is not accepted by the server. This can be fixed by ensuring that Content-Type header is set to the correct value. In this instance, \"application/json\" would be the appropriate value. -
500 Internal Server Error. -
*/
public ApiResponse getGPDPricesWithHttpInfo(java.util.List ids, String startDate, java.util.List fields, String endDate, String frequency, String calendar, String currency, String adjust, String batch) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'ids' is set
if (ids == null) {
throw new ApiException(400, "Missing the required parameter 'ids' when calling getGPDPrices");
}
// verify the required parameter 'startDate' is set
if (startDate == null) {
throw new ApiException(400, "Missing the required parameter 'startDate' when calling getGPDPrices");
}
// create path and map variables
String localVarPath = "/factset-global-prices/v1/prices";
// query params
java.util.List localVarQueryParams = new java.util.ArrayList();
java.util.Map localVarHeaderParams = new java.util.HashMap();
java.util.Map localVarCookieParams = new java.util.HashMap();
java.util.Map localVarFormParams = new java.util.HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ids", ids));
localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "fields", fields));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "startDate", startDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "endDate", endDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "frequency", frequency));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "calendar", calendar));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "currency", currency));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "adjust", adjust));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch", batch));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" };
ApiResponse<
Object
> apiResponse = apiClient.invokeAPI("PricesApi.getGPDPrices", localVarPath, "GET", localVarQueryParams, localVarPostBody,
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
localVarAuthNames, getGPDPricesResponseTypeMap, false);
int statusCode = apiResponse.getStatusCode();
GetGPDPricesResponseWrapper responseWrapper = new GetGPDPricesResponseWrapper(
statusCode,
apiResponse.getData()
);
return new ApiResponse(statusCode, apiResponse.getHeaders(), responseWrapper);
}
/**
* Requests end-of-day Open, High, Low, Close for a large list of securities.
* Gets security prices', Open, High, Low, Close, Volume, VWAP, Trade Count, and Turn Over for a specified list of securities, date range, currency, and adjustment factors.
* @param globalPricesRequest Request object for `Prices`. (required)
* @return GetSecurityPricesForListResponseWrapper
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 Array of security prices -
202 Batch request has been accepted. * Location - Path to Batch Request result.
400 Bad Request. This can occur for several reasons. Please review the \"message\" for more details. -
401 Unauthenticated USERNAME-SERIAL. Ensure you are logged in and have successfully generated an API KEY for the IP range you are connecting from. For more help, select the **Report Issue** in the top right corner of this Developer Portal specification card and choose Connectivity 401 or 403 Responses. -
403 The USERNAME-SERIAL attempted to request the endpoint is not authorized to access. The request was a legal request, but the server is refusing to respond. Please reach out to FactSet Account Team for assistance with authorization. -
415 Unsupported Media Type. This error may be returned when the caller sends a resource in a format that is not accepted by the server. This can be fixed by ensuring that Content-Type header is set to the correct value. In this instance, \"application/json\" would be the appropriate value. -
500 Internal Server Error. -
*/
public GetSecurityPricesForListResponseWrapper getSecurityPricesForList(GlobalPricesRequest globalPricesRequest) throws ApiException {
return getSecurityPricesForListWithHttpInfo(globalPricesRequest).getData();
}
/**
* Requests end-of-day Open, High, Low, Close for a large list of securities.
* Gets security prices', Open, High, Low, Close, Volume, VWAP, Trade Count, and Turn Over for a specified list of securities, date range, currency, and adjustment factors.
* @param globalPricesRequest Request object for `Prices`. (required)
* @return ApiResponse<GetSecurityPricesForListResponseWrapper>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 Array of security prices -
202 Batch request has been accepted. * Location - Path to Batch Request result.
400 Bad Request. This can occur for several reasons. Please review the \"message\" for more details. -
401 Unauthenticated USERNAME-SERIAL. Ensure you are logged in and have successfully generated an API KEY for the IP range you are connecting from. For more help, select the **Report Issue** in the top right corner of this Developer Portal specification card and choose Connectivity 401 or 403 Responses. -
403 The USERNAME-SERIAL attempted to request the endpoint is not authorized to access. The request was a legal request, but the server is refusing to respond. Please reach out to FactSet Account Team for assistance with authorization. -
415 Unsupported Media Type. This error may be returned when the caller sends a resource in a format that is not accepted by the server. This can be fixed by ensuring that Content-Type header is set to the correct value. In this instance, \"application/json\" would be the appropriate value. -
500 Internal Server Error. -
*/
public ApiResponse getSecurityPricesForListWithHttpInfo(GlobalPricesRequest globalPricesRequest) throws ApiException {
Object localVarPostBody = globalPricesRequest;
// verify the required parameter 'globalPricesRequest' is set
if (globalPricesRequest == null) {
throw new ApiException(400, "Missing the required parameter 'globalPricesRequest' when calling getSecurityPricesForList");
}
// create path and map variables
String localVarPath = "/factset-global-prices/v1/prices";
// query params
java.util.List localVarQueryParams = new java.util.ArrayList();
java.util.Map localVarHeaderParams = new java.util.HashMap();
java.util.Map localVarCookieParams = new java.util.HashMap();
java.util.Map localVarFormParams = new java.util.HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" };
ApiResponse<
Object
> apiResponse = apiClient.invokeAPI("PricesApi.getSecurityPricesForList", localVarPath, "POST", localVarQueryParams, localVarPostBody,
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
localVarAuthNames, getSecurityPricesForListResponseTypeMap, false);
int statusCode = apiResponse.getStatusCode();
GetSecurityPricesForListResponseWrapper responseWrapper = new GetSecurityPricesForListResponseWrapper(
statusCode,
apiResponse.getData()
);
return new ApiResponse(statusCode, apiResponse.getHeaders(), responseWrapper);
}
}