All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.modelling.modelfactory.AnalyticModelFactory Maven / Gradle / Ivy

Go to download

finmath lib is a Mathematical Finance Library in Java. It provides algorithms and methodologies related to mathematical finance.

There is a newer version: 6.0.19
Show newest version
package net.finmath.modelling.modelfactory;

import java.time.LocalDate;
import java.util.Map;

import net.finmath.marketdata.model.AnalyticModelFromCurvesAndVols;
import net.finmath.marketdata.model.curves.Curve;
import net.finmath.marketdata.model.volatilities.VolatilitySurface;
import net.finmath.modelling.DescribedModel;
import net.finmath.modelling.DescribedProduct;
import net.finmath.modelling.ModelFactory;
import net.finmath.modelling.ProductDescriptor;
import net.finmath.modelling.descriptor.AnalyticModelDescriptor;
import net.finmath.modelling.productfactory.InterestRateAnalyticProductFactory;

/**
 * Factory to build an described analytic model from a descriptor.
 *
 * @author Christian Fries
 * @author Roland Bachl
 *
 */
public class AnalyticModelFactory implements ModelFactory {

	@Override
	public DescribedModel getModelFromDescriptor(final AnalyticModelDescriptor descriptor) {
		return new DescribedAnalyticModel(descriptor.getReferenceDate(), descriptor.getCurvesMap(), descriptor.getVolatilitySurfaceMap());
	}

	/**
	 * Class extending {@link net.finmath.marketdata.model.AnalyticModelFromCurvesAndVols} with the functionality of a described model.
	 *
	 * @author Christian Fries
	 * @author Roland Bachl
	 *
	 */
	public static class DescribedAnalyticModel extends AnalyticModelFromCurvesAndVols implements DescribedModel {

		private static final long serialVersionUID = -2884913997994052340L;

		public DescribedAnalyticModel(final LocalDate referenceDate, final Map curvesMap, final Map volatilitySurfaceMap) {
			super(referenceDate, curvesMap, volatilitySurfaceMap);
		}

		@Override
		public AnalyticModelDescriptor getDescriptor() {
			return new AnalyticModelDescriptor(getReferenceDate(), getCurves(), getVolatilitySurfaces());
		}

		@Override
		public DescribedProduct getProductFromDescriptor(final ProductDescriptor productDescriptor) {

			return new InterestRateAnalyticProductFactory(getReferenceDate()).getProductFromDescriptor(productDescriptor);

		}

	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy