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

net.finmath.montecarlo.interestrate.simple.AbstractLIBORMarketModel Maven / Gradle / Ivy

Go to download

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

The newest version!
/*
 * (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
 *
 * Created on 04.02.2004
 */
package net.finmath.montecarlo.interestrate.simple;

import java.time.LocalDateTime;

import net.finmath.montecarlo.BrownianMotion;
import net.finmath.montecarlo.RandomVariableFromDoubleArray;
import net.finmath.montecarlo.interestrate.LIBORModelMonteCarloSimulationModel;
import net.finmath.montecarlo.templatemethoddesign.LogNormalProcess;
import net.finmath.stochastic.RandomVariable;
import net.finmath.time.TimeDiscretization;

/**
 * This class represents an abstract base class for a LIBOR Market Model.
 * Derive from this class and implement initial value, volatility and correlation (via factor loadings).
 *
 * A more flexible / complex version of the model can be created by using {@link net.finmath.montecarlo.interestrate.models.LIBORMarketModelFromCovarianceModel}
 * as an input to an {@link net.finmath.montecarlo.process.EulerSchemeFromProcessModel}.
 * 
 * @author Christian Fries
 * @version 0.6
 * @since finmath-lib 4.1.0
 */
public abstract class AbstractLIBORMarketModel extends LogNormalProcess implements LIBORModelMonteCarloSimulationModel {

	// Discretization of the yield curve into LIBORs
	private final TimeDiscretization liborPeriodDiscretization;

	/**
	 * @param liborPeriodDiscretization2 The tenor
	 * @param brownianMotionLazyInit The Brownian motion (includes the specification of time discretization, number of factors, and number of paths.
	 */
	public AbstractLIBORMarketModel(
			final TimeDiscretization	liborPeriodDiscretization2,
			final BrownianMotion		brownianMotionLazyInit) {
		super(liborPeriodDiscretization2.getNumberOfTimeSteps(), brownianMotionLazyInit);
		liborPeriodDiscretization = liborPeriodDiscretization2;
	}

	//	@Override
	@Override
	public LocalDateTime getReferenceDate() {
		throw new UnsupportedOperationException("This model does not provide a reference date. Reference dates will be mandatory in a future version.");
	}

	@Override
	public abstract Object getCloneWithModifiedSeed(int seed);

	/**
	 * @param timeIndex The time index at which the numeraire is requested.
	 * @return The numeraire at the specified time as RandomVariableFromDoubleArray
	 */
	public abstract RandomVariable getNumeraire(int timeIndex);

	/**
	 * @param time The time at which the numeraire is requested.
	 * @return The numeraire at the specified time as RandomVariableFromDoubleArray
	 */
	@Override
	public RandomVariable getNumeraire(final double time) {
		return getNumeraire(getTimeIndex(time));
	}

	@Override
	public RandomVariable getLIBOR(final int timeIndex, final int liborIndex)
	{
		// This method is just a psynonym - call getProcessValue of super class
		return getProcessValue(timeIndex, liborIndex);
	}

	/**
	 * This method returns the vector of LIBORs at a certain time index.
	 *
	 * @param timeIndex Time index at which the process should be observed
	 * @return The process realizations
	 */
	@Override
	public RandomVariable[] getLIBORs(final int timeIndex)
	{
		final RandomVariable[] randomVariableVector = new RandomVariable[getNumberOfComponents()];
		for(int componentIndex=0; componentIndex




© 2015 - 2024 Weber Informatics LLC | Privacy Policy