internal static FixedCouponBond sut2() { BusinessDayAdjustment adj = BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN); PeriodicSchedule sche = PeriodicSchedule.of(START_DATE, END_DATE, Frequency.P12M, adj, StubConvention.SHORT_INITIAL, true); return(FixedCouponBond.builder().securityId(SECURITY_ID2).dayCount(DayCounts.ACT_360).fixedRate(0.005).legalEntityId(LegalEntityId.of("OG-Ticker", "BUN EUR 2")).currency(GBP).notional(1.0e6).accrualSchedule(sche).settlementDateOffset(DaysAdjustment.ofBusinessDays(2, SAT_SUN)).yieldConvention(FixedCouponBondYieldConvention.GB_BUMP_DMO).build()); }
static BondFuturesJpyEnd2EndTest() { for (int i = 0; i < NB_UND_BONDS; ++i) { PeriodicSchedule periodSchedule = PeriodicSchedule.of(START_DATE[i], MATURITY_DATE[i], Frequency.P6M, BUSINESS_ADJUST, StubConvention.SHORT_INITIAL, false); FixedCouponBond product = FixedCouponBond.builder().securityId(SecurityId.of(BOND_SECURITY_ID[i])).dayCount(DAY_COUNT).fixedRate(UND_RATES[i] * ONE_PERCENT).legalEntityId(ISSUER_ID).currency(JPY).notional(NOTIONAL).accrualSchedule(periodSchedule).settlementDateOffset(SETTLEMENT_DAYS).yieldConvention(YIELD_CONVENTION).build(); UND_BOND[i] = product; } UND_BOND_SEP = new FixedCouponBond[NB_UND_BONDS - 2]; Array.Copy(UND_BOND, 2, UND_BOND_SEP, 0, NB_UND_BONDS - 2); UND_BOND_JUN = new FixedCouponBond[NB_UND_BONDS - 1]; Array.Copy(UND_BOND, 1, UND_BOND_JUN, 0, NB_UND_BONDS - 1); double[] timeIssuer = new double[] { 0.25136612021857924, 0.4972677595628415, 1.0139980537465378, 2.013998053746538, 2.857833670184894, 3.857833670184894, 4.860655737704918, 5.857833670184894, 7.104409012650647, 7.857833670184894, 8.857923497267759, 9.863313122239688, 14.857833670184894, 19.857833670184895, 29.857833670184895, 39.11262819073284 }; double[] rateIssuer = new double[] { -0.0013117084834668065, -0.0010851901424876163, -0.0020906775838723216, -0.0022137102045172784, -0.0022695678374162888, -0.0023424568490920798, -0.0021603059162879916, -0.0021667343131861225, -0.0018285921969274823, -0.001355094018965514, -6.763044056712535E-4, 1.9555294306801752E-4, 0.003944125562941363, 0.008054233458390252, 0.012276105941434846, 0.013537766297065804 }; double[] timeRepo = new double[] { 0.00273224043715847, 0.01912568306010929, 0.040983606557377046, 0.05737704918032787, 0.07923497267759563, 0.2459016393442623, 0.4972677595628415, 1.0002994236095515 }; double[] rateRepo = new double[] { 2.599662058772748E-4, -8.403529976927196E-4, -0.0010105103936934236, -0.0011506617573950931, -0.0012708071334455143, -0.00146106683851595, -0.0014710815100096722, -0.001481096281798276 }; CurveMetadata metaIssuer = Curves.zeroRates(ISSUER_CURVE_NAME, ACT_ACT_ISDA); InterpolatedNodalCurve curveIssuer = InterpolatedNodalCurve.of(metaIssuer, DoubleArray.copyOf(timeIssuer), DoubleArray.copyOf(rateIssuer), INTERPOLATOR); DiscountFactors dscIssuer = ZeroRateDiscountFactors.of(JPY, VALUATION, curveIssuer); CurveMetadata metaRepo = Curves.zeroRates(REPO_CURVE_NAME, ACT_ACT_ISDA); InterpolatedNodalCurve curve = InterpolatedNodalCurve.of(metaRepo, DoubleArray.copyOf(timeRepo), DoubleArray.copyOf(rateRepo), INTERPOLATOR); DiscountFactors dscRepo = ZeroRateDiscountFactors.of(JPY, VALUATION, curve); LED_PROVIDER = ImmutableLegalEntityDiscountingProvider.builder().issuerCurves(ImmutableMap.of(Pair.of(GROUP_ISSUER, JPY), dscIssuer)).issuerCurveGroups(ImmutableMap.of(ISSUER_ID, GROUP_ISSUER)).repoCurves(ImmutableMap.of(Pair.of(GROUP_REPO, JPY), dscRepo)).repoCurveGroups(ImmutableMap.of(ISSUER_ID, GROUP_REPO)).build(); }
static BondFutureTest() { for (int i = 0; i < NB_BOND; ++i) { LocalDate endDate = START_DATE[i].plus(BOND_TENOR[i]); PeriodicSchedule periodSchedule = PeriodicSchedule.of(START_DATE[i], endDate, Frequency.P6M, BUSINESS_ADJUST, StubConvention.SHORT_INITIAL, false); FixedCouponBond product = FixedCouponBond.builder().securityId(SecurityId.of("OG-Test", "Bond " + i)).dayCount(DAY_COUNT).fixedRate(RATE[i]).legalEntityId(ISSUER_ID).currency(USD).notional(NOTIONAL).accrualSchedule(periodSchedule).settlementDateOffset(SETTLEMENT_DAYS).yieldConvention(YIELD_CONVENTION).exCouponPeriod(EX_COUPON).build(); BOND_PRODUCT[i] = product; RESOLVED_BASKET[i] = product.resolve(REF_DATA); } }
public virtual void test_builder_fail() { assertThrowsIllegalArg(() => FixedCouponBond.builder().securityId(SECURITY_ID).dayCount(DAY_COUNT).fixedRate(FIXED_RATE).legalEntityId(LEGAL_ENTITY).currency(EUR).notional(NOTIONAL).accrualSchedule(PERIOD_SCHEDULE).settlementDateOffset(DATE_OFFSET).yieldConvention(YIELD_CONVENTION).exCouponPeriod(DaysAdjustment.ofBusinessDays(EX_COUPON_DAYS, EUTA, BUSINESS_ADJUST)).build()); assertThrowsIllegalArg(() => FixedCouponBond.builder().securityId(SECURITY_ID).dayCount(DAY_COUNT).fixedRate(FIXED_RATE).legalEntityId(LEGAL_ENTITY).currency(EUR).notional(NOTIONAL).accrualSchedule(PERIOD_SCHEDULE).settlementDateOffset(DaysAdjustment.ofBusinessDays(-3, EUTA)).yieldConvention(YIELD_CONVENTION).build()); }
//------------------------------------------------------------------------- internal static FixedCouponBond sut() { return(FixedCouponBond.builder().securityId(SECURITY_ID).dayCount(DAY_COUNT).fixedRate(FIXED_RATE).legalEntityId(LEGAL_ENTITY).currency(EUR).notional(NOTIONAL).accrualSchedule(PERIOD_SCHEDULE).settlementDateOffset(DATE_OFFSET).yieldConvention(YIELD_CONVENTION).exCouponPeriod(EX_COUPON).build()); }