public virtual void test_withInfo() { BillSecurity @base = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); SecurityInfo info = SecurityInfo.of(SECURITY_ID, SecurityPriceInfo.ofCurrencyMinorUnit(CCY)); BillSecurity expected = BillSecurity.builder().dayCount(DAY_COUNT).info(info).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); assertEquals(@base.withInfo(info), expected); }
//------------------------------------------------------------------------- public virtual void coverage() { BillSecurity test1 = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); coverImmutableBean(test1); BillSecurity test2 = BillSecurity.builder().dayCount(DayCounts.ACT_365F).info(SecurityInfo.of(SecurityId.of("OG-Test", "ID2"), PRICE_INFO)).legalEntityId(LegalEntityId.of("OG-Ticker", "LE2")).notional(AdjustablePayment.of(CurrencyAmount.of(CCY, 10), MATURITY_DATE_ADJ)).settlementDateOffset(DaysAdjustment.ofBusinessDays(2, EUTA, BUSINESS_ADJUST)).yieldConvention(BillYieldConvention.INTEREST_AT_MATURITY).build(); coverBeanEquals(test1, test2); }
//------------------------------------------------------------------------- public virtual void test_createProduct() { BillSecurity @base = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); Bill expectedProduct = Bill.builder().dayCount(DAY_COUNT).securityId(SECURITY_ID).dayCount(DAY_COUNT).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); assertEquals(@base.createProduct(ReferenceData.empty()), expectedProduct); TradeInfo tradeInfo = TradeInfo.of(date(2016, 6, 30)); BillTrade expectedTrade = BillTrade.builder().info(tradeInfo).product(expectedProduct).quantity(100).price(1.235).build(); assertEquals(@base.createTrade(tradeInfo, 100, 1.235, ReferenceData.empty()), expectedTrade); }
public virtual void test_createPosition() { BillSecurity test = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); Bill product = Bill.builder().dayCount(DAY_COUNT).securityId(SECURITY_ID).dayCount(DAY_COUNT).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); PositionInfo positionInfo = PositionInfo.empty(); BillPosition expectedPosition1 = BillPosition.builder().info(positionInfo).product(product).longQuantity(100).build(); assertEquals(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1); BillPosition expectedPosition2 = BillPosition.builder().info(positionInfo).product(product).longQuantity(100).shortQuantity(50).build(); assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { BillSecurity other = (BillSecurity)obj; return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(dayCount, other.dayCount) && JodaBeanUtils.equal(yieldConvention, other.yieldConvention) && JodaBeanUtils.equal(legalEntityId, other.legalEntityId) && JodaBeanUtils.equal(settlementDateOffset, other.settlementDateOffset)); } return(false); }
public virtual void test_builder() { BillSecurity test = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); assertEquals(test.Currency, CCY); assertEquals(test.DayCount, DAY_COUNT); assertEquals(test.Info, INFO); assertEquals(test.LegalEntityId, LEGAL_ENTITY); assertEquals(test.Notional, NOTIONAL); assertEquals(test.SecurityId, SECURITY_ID); assertEquals(test.SettlementDateOffset, SETTLE); assertEquals(test.UnderlyingIds, ImmutableSet.of()); assertEquals(test.YieldConvention, YIELD_CONVENTION); }
public virtual void test_builder_fail() { assertThrowsIllegalArg(() => BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(DaysAdjustment.ofBusinessDays(-1, USNY, BUSINESS_ADJUST)).yieldConvention(YIELD_CONVENTION).build()); assertThrowsIllegalArg(() => BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(AdjustablePayment.of(CurrencyAmount.of(CCY, -2_000_000), MATURITY_DATE_ADJ)).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build()); }
public virtual void test_serialization() { BillSecurity test = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); assertSerialization(test); }