Examples of Coupon


Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon

  }

  @Test
  public void toDerivativeAfterLastFixing() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 10, 25);
    final Coupon cpnConverted = CPN_FROM_INDEX_DEFINITION.toDerivative(referenceDate, FIXING_TS);
    final double rate = ((1.0 + PAYMENT_ACCRUAL_FACTORS[0] * FIXING_RATES[1]) * (1.0 + PAYMENT_ACCRUAL_FACTORS[1] * FIXING_RATES[2]) * (1.0 + PAYMENT_ACCRUAL_FACTORS[2] * FIXING_RATES[3]) - 1.0)
        / PAYMENT_ACCRUAL_FACTOR;
    final double paymentTime = TimeCalculator.getTimeBetween(referenceDate, CPN_FROM_INDEX_DEFINITION.getPaymentDate());
    final CouponFixed cpnExpected = new CouponFixed(USDLIBOR1M.getCurrency(), paymentTime, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, rate, ACCRUAL_START_DATES[0], ACCRUAL_END_DATES[NB_SUB_PERIOD - 1]);
    assertEquals("CouponIborCompoundedDefinition: toDerivatives", cpnExpected, cpnConverted);
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon

    final CouponIborCompounding cpnConverted = CPN_FROM_INDEX_DEFINITION.toDerivative(REFERENCE_DATE, new String[] {DSC_NAME, FWD_NAME });
    final CouponIborCompounding cpnExpected = new CouponIborCompounding(USDLIBOR1M.getCurrency(), PAYMENT_TIME, DSC_NAME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, NOTIONAL, USDLIBOR1M,
        PAYMENT_ACCRUAL_FACTORS,
        FIXING_TIMES, ACCRUAL_START_TIMES, FIXING_PERIOD_END_TIMES, FIXING_ACCRUAL_FACTORS, FWD_NAME);
    assertEquals("CouponIborCompoundedDefinition: toDerivatives", cpnExpected, cpnConverted);
    final Coupon cpnConverted2 = CPN_FROM_INDEX_DEFINITION.toDerivative(REFERENCE_DATE, FIXING_TS, new String[] {DSC_NAME, FWD_NAME });
    assertEquals("CouponIborCompoundedDefinition: toDerivatives", cpnExpected, cpnConverted2);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon

    System.arraycopy(TimeCalculator.getTimeBetween(referenceDate, ACCRUAL_START_DATES), 1, fixingPeriodStartTimesLeft, 0, NB_SUB_PERIOD - 1);
    final double[] fixingPeriodEndTimesLeft = new double[NB_SUB_PERIOD - 1];
    System.arraycopy(TimeCalculator.getTimeBetween(referenceDate, FIXING_PERIOD_END_DATES), 1, fixingPeriodEndTimesLeft, 0, NB_SUB_PERIOD - 1);
    final double[] fixingPeriodAccrualFactorsLeft = new double[NB_SUB_PERIOD - 1];
    System.arraycopy(FIXING_ACCRUAL_FACTORS, 1, fixingPeriodAccrualFactorsLeft, 0, NB_SUB_PERIOD - 1);
    final Coupon cpnConverted = CPN_FROM_INDEX_DEFINITION.toDerivative(referenceDate, FIXING_TS, new String[] {DSC_NAME, FWD_NAME });
    final CouponIborCompounding cpnExpected = new CouponIborCompounding(USDLIBOR1M.getCurrency(), paymentTime, DSC_NAME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, accruedNotional, USDLIBOR1M,
        paymentAccrualFactorsLeft, fixingTimesLeft, fixingPeriodStartTimesLeft, fixingPeriodEndTimesLeft, fixingPeriodAccrualFactorsLeft, FWD_NAME);
    assertEquals("CouponIborCompoundedDefinition: toDerivatives", cpnExpected, cpnConverted);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon

    final double[] paymentAccrualFactorsLeft = new double[] {PAYMENT_ACCRUAL_FACTORS[2] };
    final double[] fixingTimesLeft = new double[] {TimeCalculator.getTimeBetween(referenceDate, FIXING_DATES[2]) };
    final double[] fixingPeriodStartTimesLeft = new double[] {TimeCalculator.getTimeBetween(referenceDate, ACCRUAL_START_DATES[2]) };
    final double[] fixingPeriodEndTimesLeft = new double[] {TimeCalculator.getTimeBetween(referenceDate, FIXING_PERIOD_END_DATES[2]) };
    final double[] fixingPeriodAccrualFactorsLeft = new double[] {FIXING_ACCRUAL_FACTORS[2] };
    final Coupon cpnConverted = CPN_FROM_INDEX_DEFINITION.toDerivative(referenceDate, FIXING_TS, new String[] {DSC_NAME, FWD_NAME });
    final CouponIborCompounding cpnExpected = new CouponIborCompounding(USDLIBOR1M.getCurrency(), paymentTime, DSC_NAME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, accruedNotional, USDLIBOR1M,
        paymentAccrualFactorsLeft, fixingTimesLeft, fixingPeriodStartTimesLeft, fixingPeriodEndTimesLeft, fixingPeriodAccrualFactorsLeft, FWD_NAME);
    assertEquals("CouponIborCompoundedDefinition: toDerivatives", cpnExpected, cpnConverted);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon

  @SuppressWarnings("deprecation")
  @Test
  public void toDerivativeAfterLastFixingDeprecated() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 10, 25);
    final Coupon cpnConverted = CPN_FROM_INDEX_DEFINITION.toDerivative(referenceDate, FIXING_TS, new String[] {DSC_NAME, FWD_NAME });
    final double rate = ((1.0 + PAYMENT_ACCRUAL_FACTORS[0] * FIXING_RATES[1]) * (1.0 + PAYMENT_ACCRUAL_FACTORS[1] * FIXING_RATES[2]) * (1.0 + PAYMENT_ACCRUAL_FACTORS[2] * FIXING_RATES[3]) - 1.0)
        / PAYMENT_ACCRUAL_FACTOR;
    final double paymentTime = TimeCalculator.getTimeBetween(referenceDate, CPN_FROM_INDEX_DEFINITION.getPaymentDate());
    final CouponFixed cpnExpected = new CouponFixed(USDLIBOR1M.getCurrency(), paymentTime, DSC_NAME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, rate, ACCRUAL_START_DATES[0],
        ACCRUAL_END_DATES[NB_SUB_PERIOD - 1]);
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.Coupon

    final CouponIborCompoundingSpread cpnConverted = CPN_FROM_INDEX_DEFINITION.toDerivative(REFERENCE_DATE);
    final CouponIborCompoundingSpread cpnExpected = new CouponIborCompoundingSpread(USDLIBOR1M.getCurrency(), PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, NOTIONAL, USDLIBOR1M,
        PAYMENT_ACCRUAL_FACTORS,
        FIXING_TIMES, ACCRUAL_START_TIMES, FIXING_PERIOD_END_TIMES, FIXING_ACCRUAL_FACTORS, SPREAD);
    assertEquals("CouponIborCompoundedSpreadDefinition: toDerivatives", cpnExpected, cpnConverted);
    final Coupon cpnConverted2 = CPN_FROM_INDEX_DEFINITION.toDerivative(REFERENCE_DATE, FIXING_TS);
    assertEquals("CouponIborCompoundedSpreadDefinition: toDerivatives", cpnExpected, cpnConverted2);
  }
View Full Code Here

Examples of com.stripe.model.Coupon

    assertTrue(retrievedToken.getUsed());
  }

  @Test
  public void testCouponCreate() throws StripeException {
    Coupon coupon = Coupon.create(getUniqueCouponParams());
    assertEquals(coupon.getDuration(), "once");
  }
View Full Code Here

Examples of org.jquantlib.cashflow.Coupon

        for (final CashFlow flow : Iterables.unmodifiableIterable(cashflows_.listIterator(startIndex))) {
            if (flow.date().ne(paymentDate)) {
                break;
            }
            //TODO: code review: should the last element be excluded?
            final Coupon cp = (Coupon)flow;
            if (cp != null) {
                if (firstCouponFound) {
                    assert(nominal       == cp.nominal() &&
                            accrualPeriod == cp.accrualPeriod() &&
                            //FIXME: implement equals for dayCounters!
                            dc.getClass()            == cp.dayCounter().getClass()):
                                "cannot aggregate accrued amount of two " +
                                "different coupons on "+ paymentDate.toString();
                } else {
                    firstCouponFound = true;
                    nominal = cp.nominal();
                    accrualPeriod = cp.accrualPeriod();
                    dc = cp.dayCounter();
                }
                result += cp.accruedAmount(settlement);
            }

        }
        return result/notional(settlement)*100.0;
        //old implementation....
View Full Code Here

Examples of org.jquantlib.cashflow.Coupon

        notionalSchedule_.clear();
        notionals_.clear();
        Date lastPaymentDate = new Date();
        notionalSchedule_.add(new Date());
        for (int i=0; i<cashflows_.size(); ++i) {
            final Coupon coupon = (Coupon)cashflows_.get(i);
            if (coupon==null){
                continue;
            }
            /*@Real*/final double notional = coupon.nominal();
            // we add the notional only if it is the first one...
            if (notionals_.isEmpty()) {
                notionals_.add(coupon.nominal());
                lastPaymentDate = coupon.date();
            } else if (!Closeness.isClose(notional, notionals_.get(notionals_.size() -1 ))) {
                // ...or if it has changed.
                assert(notional < notionals_.get(notionals_.size()-1)):("increasing coupon notionals");
                notionals_.add(coupon.nominal());
                // in this case, we also add the last valid date for
                // the previous one...
                notionalSchedule_.add(lastPaymentDate);
                // ...and store the candidate for this one.
                lastPaymentDate = coupon.date();
            } else {
                // otherwise, we just extend the valid range of dates
                // for the current notional.
                lastPaymentDate = coupon.date();
            }
        }
        assert!notionals_.isEmpty(): "no coupons provided";
        notionals_.add(0.0);
        notionalSchedule_.add(lastPaymentDate);
View Full Code Here

Examples of org.jquantlib.cashflow.Coupon

        for (final CashFlow flow : Iterables.unmodifiableIterable(cashflows_.listIterator(startIndex))) {
            if (flow.date().ne(paymentDate)) {
                //TODO: Check with Richard, with break, code does not handle multiple CFs on paymentDate.
                continue; //break;
            }
            final Coupon cp = Coupon.class.isAssignableFrom(flow.getClass()) ? (Coupon)flow : null;
            if (cp != null) {
                if (firstCouponFound) {
                    QL.require(nominal == cp.nominal() &&
                            accrualPeriod == cp.accrualPeriod() &&
                            dc.equals(cp.dayCounter()),
                                "cannot aggregate accrued amount of two " +
                                "different coupons on " + paymentDate.toString());
                } else {
                    firstCouponFound = true;
                    nominal = cp.nominal();
                    accrualPeriod = cp.accrualPeriod();
                    dc = cp.dayCounter();
                }
                result += cp.accruedAmount(settlement);
            }
        }
        return result/notional(settlement)*100.0;
    }
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.