}
private List<FactorExposure> convertToFactorExposure(List<FactorExposureData> factorExposureDataList) {
List<FactorExposure> results = new ArrayList<FactorExposure>();
for (FactorExposureData exposure : factorExposureDataList) {
HistoricalTimeSeriesInfoSearchRequest exposureSearchRequest = new HistoricalTimeSeriesInfoSearchRequest();
exposureSearchRequest.addExternalId(exposure.getExposureExternalId());
exposureSearchRequest.setDataField("EXPOSURE");
HistoricalTimeSeriesInfoSearchResult exposureSearchResult = data().getHistoricalTimeSeriesMaster().search(exposureSearchRequest);
HistoricalTimeSeries exposureHTS = null;
if (exposureSearchResult.getFirstInfo() != null) {
exposureHTS = data().getHistoricalTimeSeriesMaster().getTimeSeries(exposureSearchResult.getFirstInfo().getTimeSeriesObjectId(), VersionCorrection.LATEST);
}
HistoricalTimeSeriesInfoSearchRequest convexitySearchRequest = new HistoricalTimeSeriesInfoSearchRequest();
convexitySearchRequest.addExternalId(exposure.getExposureExternalId());
convexitySearchRequest.setDataField("CONVEXITY");
HistoricalTimeSeriesInfoSearchResult convexitySearchResult = data().getHistoricalTimeSeriesMaster().search(convexitySearchRequest);
HistoricalTimeSeries convexityHTS = null;
if (convexitySearchResult.getFirstInfo() != null) {
convexityHTS = data().getHistoricalTimeSeriesMaster().getTimeSeries(convexitySearchResult.getFirstInfo().getTimeSeriesObjectId(), VersionCorrection.LATEST);
}
HistoricalTimeSeriesInfoSearchRequest priceSearchRequest = new HistoricalTimeSeriesInfoSearchRequest();
priceSearchRequest.addExternalId(exposure.getExposureExternalId());
priceSearchRequest.setDataField("PX_LAST");
HistoricalTimeSeriesInfoSearchResult priceSearchResult = data().getHistoricalTimeSeriesMaster().search(priceSearchRequest);
HistoricalTimeSeries priceHTS = null;
if (priceSearchResult.getFirstInfo() != null) {
priceHTS = data().getHistoricalTimeSeriesMaster().getTimeSeries(priceSearchResult.getFirstInfo().getTimeSeriesObjectId(), VersionCorrection.LATEST);
}