Package com.opengamma.analytics.financial.model.interestrate.definition

Examples of com.opengamma.analytics.financial.model.interestrate.definition.VasicekDataBundle


  public void test() {
    final YieldCurve shortRate = YieldCurve.from(ConstantDoublesCurve.from(0.05));
    final double longRate = 0.06;
    final double speed = 0.01;
    final VolatilityCurve sigma = new VolatilityCurve(ConstantDoublesCurve.from(0.01));
    VasicekDataBundle data = new VasicekDataBundle(shortRate, sigma, TODAY, longRate, speed);
    assertEquals(MODEL.getDiscountBondFunction(START, START).evaluate(data), 1, 0);
    data = new VasicekDataBundle(shortRate, new VolatilityCurve(ConstantDoublesCurve.from(0)), TODAY, longRate, speed);
    final double factor = (1 - Math.exp(-speed * YEARS));
    final double lnA = longRate * (factor / speed - YEARS);
    assertEquals(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data), Math.exp(lnA - data.getShortRate(0) * factor / speed), 0);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.interestrate.definition.VasicekDataBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.