Examples of SwapFixedONDefinition


Examples of com.opengamma.analytics.financial.instrument.swap.SwapFixedONDefinition

    long startTime, endTime;
    final int nbTest = 100;

    final ZonedDateTime referenceDate = TRADE_DATE;
    final Period tenor = Period.ofYears(50);
    SwapFixedONDefinition oidUsd5YDefinition;
    Swap<? extends Payment, ? extends Payment> ois;

    final double[] pv = new double[nbTest];
    final InterestRateCurveSensitivity[] pvcs = new InterestRateCurveSensitivity[nbTest];

    double totalValue = 0.0;

    startTime = System.currentTimeMillis();
    oidUsd5YDefinition = SwapFixedONDefinition.from(START_ACCRUAL_DATE, tenor, NOTIONAL, OIS_USD_GENERATOR, USD_FIXED_RATE, IS_PAYER);
    ois = oidUsd5YDefinition.toDerivative(referenceDate, CURVES_NAMES_2[0], CURVES_NAMES_2[0]);
    endTime = System.currentTimeMillis();
    System.out.println("OIS swap " + tenor + " (construction): " + (endTime - startTime) + " ms");

    startTime = System.currentTimeMillis();
    for (int looptest = 0; looptest < nbTest; looptest++) {
      pv[looptest] = ois.accept(PVC, CURVES_2);
    }
    endTime = System.currentTimeMillis();
    System.out.println(nbTest + " OIS swap " + tenor + " (price): " + (endTime - startTime) + " ms");

    startTime = System.currentTimeMillis();
    for (int looptest = 0; looptest < nbTest; looptest++) {
      pvcs[looptest] = new InterestRateCurveSensitivity(ois.accept(PVCSC, CURVES_2));
    }
    endTime = System.currentTimeMillis();
    System.out.println(nbTest + " OIS swap " + tenor + " (delta): " + (endTime - startTime) + " ms");

    // Performance note: price: 28-Feb-12: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 15 ms for 100 OIS.
    // Performance note: delta: 28-Feb-12: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 115 ms for 100 OIS.
    for (int looptest = 0; looptest < nbTest; looptest++) {
      totalValue += pv[looptest];
    }
    startTime = System.currentTimeMillis();
    oidUsd5YDefinition = SwapFixedONDefinition.from(START_ACCRUAL_DATE, tenor, NOTIONAL, OIS_USD_GENERATOR, USD_FIXED_RATE, IS_PAYER);
    ois = oidUsd5YDefinition.toDerivative(referenceDate, CURVES_NAMES_2[0], CURVES_NAMES_2[0]);
    endTime = System.currentTimeMillis();
    System.out.println("OIS swap " + tenor + " (construction): " + (endTime - startTime) + " ms");

    startTime = System.currentTimeMillis();
    for (int looptest = 0; looptest < nbTest; looptest++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.