net.finmath.montecarlo.interestrate.simple.AbstractLIBORMarketModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-lib Show documentation
Show all versions of finmath-lib Show documentation
finmath lib is a Mathematical Finance Library in Java.
It provides algorithms and methodologies related to mathematical finance.
/*
* (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.BrownianMotionLazyInit;
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).
*
* @author Christian Fries
* @version 0.5
* @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 BrownianMotionLazyInit 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