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

Examples of com.opengamma.analytics.financial.interestrate.bond.definition.BillSecurity


    final double deltaTolerancePrice = 1.0E+2;
    //Testing note: Sensitivity is for a movement of 1. 1E+2 = 0.01 unit for a 1 bp move.
    final double deltaShift = 1.0E-6;
    // Credit curve sensitivity
    final String bumpedCurveName = "Bumped Curve";
    final BillSecurity billBumped = BILL_IAM_SEC_DEFINITION.toDerivative(REFERENCE_DATE, NAME_CURVES[0], bumpedCurveName);
    final double[] nodeTimes = new double[] {billBumped.getEndTime() };
    final double[] sensi = SensitivityFiniteDifference.curveSensitivity(billBumped, CURVE_BUNDLE, NAME_CURVES[1], bumpedCurveName, nodeTimes, deltaShift, METHOD_SECURITY);
    final List<DoublesPair> sensiPv = pvcsComputed.getSensitivities().get(NAME_CURVES[1]);
    for (int loopnode = 0; loopnode < sensi.length; loopnode++) {
      final DoublesPair pairPv = sensiPv.get(loopnode);
      assertEquals("Bill Security: curve sensitivity - Node " + loopnode, nodeTimes[loopnode], pairPv.getFirst(), 1E-8);
View Full Code Here


    ArgumentChecker.isTrue(!date.isAfter(_endDate), "Reference date {} is after end date {}", date, _endDate);
    double settlementTime = TimeCalculator.getTimeBetween(date, settlementDate);
    settlementTime = Math.max(settlementTime, 0.0);
    final double endTime = TimeCalculator.getTimeBetween(date, _endDate);
    final double accrualFactor = _dayCount.getDayCountFraction(settlementDate, _endDate, _calendar);
    return new BillSecurity(_currency, settlementTime, endTime, _notional, _yieldConvention, accrualFactor, _issuer, yieldCurveNames[1], yieldCurveNames[0]);
  }
View Full Code Here

    ArgumentChecker.isTrue(!date.isAfter(_endDate), "Reference date {} is after end date {}", date, _endDate);
    double settlementTime = TimeCalculator.getTimeBetween(date, settlementDate);
    settlementTime = Math.max(settlementTime, 0.0);
    final double endTime = TimeCalculator.getTimeBetween(date, _endDate);
    final double accrualFactor = _dayCount.getDayCountFraction(settlementDate, _endDate, _calendar);
    return new BillSecurity(_currency, settlementTime, endTime, _notional, _yieldConvention, accrualFactor, _issuer);
  }
View Full Code Here

  @Deprecated
  @Override
  public BillTransaction toDerivative(final ZonedDateTime date, final String... yieldCurveNames) {
    ArgumentChecker.notNull(date, "Reference date");
    ArgumentChecker.notNull(yieldCurveNames, "Yield curve names");
    final BillSecurity purchased = _underlying.toDerivative(date, _settlementDate, yieldCurveNames);
    final BillSecurity standard = _underlying.toDerivative(date, yieldCurveNames);
    final double amount = (_settlementDate.isBefore(date)) ? 0.0 : _settlementAmount;
    return new BillTransaction(purchased, _quantity, amount, standard);
  }
View Full Code Here

  }

  @Override
  public BillTransaction toDerivative(final ZonedDateTime date) {
    ArgumentChecker.notNull(date, "Reference date");
    final BillSecurity purchased = _underlying.toDerivative(date, _settlementDate);
    final BillSecurity standard = _underlying.toDerivative(date);
    final double amount = (_settlementDate.isBefore(date)) ? 0.0 : _settlementAmount;
    return new BillTransaction(purchased, _quantity, amount, standard);
  }
View Full Code Here

   */
  public void toDerivativeDeprecated() {
    final String dsc = "EUR Discounting";
    final String credit = "EUR BELGIUM GOVT";
    final ZonedDateTime standardSettlementDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, SETTLEMENT_DAYS, CALENDAR);
    final BillSecurity securityConverted1 = BILL_SEC_DEFINITION.toDerivative(REFERENCE_DATE, standardSettlementDate, dsc, credit);
    final double standardSettlementTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, standardSettlementDate);
    final double endTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, END_DATE);
    final double accrualFactorStandard = ACT360.getDayCountFraction(standardSettlementDate, END_DATE);
    final BillSecurity securityExpected1 = new BillSecurity(EUR, standardSettlementTime, endTime, NOTIONAL, YIELD_CONVENTION, accrualFactorStandard, ISSUER_BEL, credit, dsc);
    assertEquals("Bill Security Definition: toDerivative", securityExpected1, securityConverted1);
    final BillSecurity securityConverted2 = BILL_SEC_DEFINITION.toDerivative(REFERENCE_DATE, dsc, credit);
    assertEquals("Bill Security Definition: toDerivative", securityExpected1, securityConverted2);
    final ZonedDateTime otherSettlementDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, SETTLEMENT_DAYS + 1, CALENDAR);
    final BillSecurity securityConverted3 = BILL_SEC_DEFINITION.toDerivative(REFERENCE_DATE, otherSettlementDate, dsc, credit);
    final double otherSettlementTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, otherSettlementDate);
    final double accrualFactorOther = ACT360.getDayCountFraction(otherSettlementDate, END_DATE);
    final BillSecurity securityExpected3 = new BillSecurity(EUR, otherSettlementTime, endTime, NOTIONAL, YIELD_CONVENTION, accrualFactorOther, ISSUER_BEL, credit, dsc);
    assertEquals("Bill Security Definition: toDerivative", securityExpected3, securityConverted3);
  }
View Full Code Here

  /**
   * Tests the toDerivative methods.
   */
  public void toDerivative() {
    final ZonedDateTime standardSettlementDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, SETTLEMENT_DAYS, CALENDAR);
    final BillSecurity securityConverted1 = BILL_SEC_DEFINITION.toDerivative(REFERENCE_DATE, standardSettlementDate);
    final double standardSettlementTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, standardSettlementDate);
    final double endTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, END_DATE);
    final double accrualFactorStandard = ACT360.getDayCountFraction(standardSettlementDate, END_DATE);
    final BillSecurity securityExpected1 = new BillSecurity(EUR, standardSettlementTime, endTime, NOTIONAL, YIELD_CONVENTION, accrualFactorStandard, ISSUER_BEL);
    assertEquals("Bill Security Definition: toDerivative", securityExpected1, securityConverted1);
    final BillSecurity securityConverted2 = BILL_SEC_DEFINITION.toDerivative(REFERENCE_DATE);
    assertEquals("Bill Security Definition: toDerivative", securityExpected1, securityConverted2);
    final ZonedDateTime otherSettlementDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, SETTLEMENT_DAYS + 1, CALENDAR);
    final BillSecurity securityConverted3 = BILL_SEC_DEFINITION.toDerivative(REFERENCE_DATE, otherSettlementDate);
    final double otherSettlementTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, otherSettlementDate);
    final double accrualFactorOther = ACT360.getDayCountFraction(otherSettlementDate, END_DATE);
    final BillSecurity securityExpected3 = new BillSecurity(EUR, otherSettlementTime, endTime, NOTIONAL, YIELD_CONVENTION, accrualFactorOther, ISSUER_BEL);
    assertEquals("Bill Security Definition: toDerivative", securityExpected3, securityConverted3);
  }
View Full Code Here

   * Tests the toDerivative methods.
   */
  public void toDerivativeStandardDeprecated() {
    final ZonedDateTime referenceDateStandard = ScheduleCalculator.getAdjustedDate(SETTLE_DATE, -SETTLEMENT_DAYS, CALENDAR);
    final BillTransaction transactionConverted1 = BILL_TRA_DEFINITION.toDerivative(referenceDateStandard, DSC_NAME, CREDIT_NAME);
    final BillSecurity purchased1 = BILL_SEC_DEFINITION.toDerivative(referenceDateStandard, SETTLE_DATE, DSC_NAME, CREDIT_NAME);
    final BillSecurity standard1 = BILL_SEC_DEFINITION.toDerivative(referenceDateStandard, DSC_NAME, CREDIT_NAME);
    final BillTransaction transactionExpected1 = new BillTransaction(purchased1, QUANTITY, SETTLE_AMOUT, standard1);
    assertEquals("Bill Transaction: toDerivatives", transactionExpected1, transactionConverted1);
  }
View Full Code Here

   * Tests the toDerivative methods.
   */
  public void toDerivativeEarlyDeprecated() {
    final ZonedDateTime referenceDateEarly = ScheduleCalculator.getAdjustedDate(SETTLE_DATE, -(SETTLEMENT_DAYS + 1), CALENDAR);
    final BillTransaction transactionConverted2 = BILL_TRA_DEFINITION.toDerivative(referenceDateEarly, DSC_NAME, CREDIT_NAME);
    final BillSecurity purchased2 = BILL_SEC_DEFINITION.toDerivative(referenceDateEarly, SETTLE_DATE, DSC_NAME, CREDIT_NAME);
    final BillSecurity standard2 = BILL_SEC_DEFINITION.toDerivative(referenceDateEarly, DSC_NAME, CREDIT_NAME);
    final BillTransaction transactionExpected2 = new BillTransaction(purchased2, QUANTITY, SETTLE_AMOUT, standard2);
    assertEquals("Bill Transaction: toDerivatives", transactionExpected2, transactionConverted2);
  }
View Full Code Here

   * Tests the toDerivative methods.
   */
  public void toDerivativeAtSettleDeprecated() {
    final ZonedDateTime referenceDate = SETTLE_DATE;
    final BillTransaction transactionConverted = BILL_TRA_DEFINITION.toDerivative(referenceDate, DSC_NAME, CREDIT_NAME);
    final BillSecurity purchased = BILL_SEC_DEFINITION.toDerivative(referenceDate, SETTLE_DATE, DSC_NAME, CREDIT_NAME);
    final BillSecurity standard = BILL_SEC_DEFINITION.toDerivative(referenceDate, DSC_NAME, CREDIT_NAME);
    final BillTransaction transactionExpected = new BillTransaction(purchased, QUANTITY, SETTLE_AMOUT, standard);
    assertEquals("Bill Transaction: toDerivatives", transactionExpected, transactionConverted);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.bond.definition.BillSecurity

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.