private CdsIndexCalibrationTrade(CdsIndexTrade underlyingTrade, CdsQuote quote)
 {
     JodaBeanUtils.notNull(underlyingTrade, "underlyingTrade");
     JodaBeanUtils.notNull(quote, "quote");
     this.underlyingTrade = underlyingTrade;
     this.quote           = quote;
 }
        //-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            CdsIndexTrade        trade    = sut();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().id(TRADE_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.TRADE).productType(ProductType.CDS_INDEX).currencies(Currency.USD).description("10Y9M Buy USD 1000mm AA-INDEX / 5% : 20Dec13-20Sep24").build();

            assertEquals(trade.summarize(), expected);
        }
        public virtual void test_min_resolve()
        {
            ResolvedCdsIndexTrade test = CdsIndexTrade.builder().product(PRODUCT).info(TRADE_INFO).build().resolve(REF_DATA);

            assertEquals(test.Product, PRODUCT.resolve(REF_DATA));
            assertEquals(test.Info, TRADE_INFO);
            assertFalse(test.UpfrontFee.Present);
        }
        public virtual void test_min_builder()
        {
            CdsIndexTrade test = CdsIndexTrade.builder().product(PRODUCT).info(TRADE_INFO).build();

            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Info, TRADE_INFO);
            assertFalse(test.UpfrontFee.Present);
        }
        public virtual void test_full_builder()
        {
            CdsIndexTrade test = sut();

            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Info, TRADE_INFO);
            assertEquals(test.UpfrontFee.get(), UPFRONT);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage_trade()
        {
            CdsIndexCalibrationTrade test1 = CdsIndexCalibrationTrade.of(TRADE, QUOTE1);

            coverImmutableBean(test1);
            CdsIndexCalibrationTrade test2 = CdsIndexCalibrationTrade.of(CdsIndexTrade.builder().product(PRODUCT).info(TRADE_INFO).build(), QUOTE2);

            coverBeanEquals(test1, test2);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            CdsIndexTrade test1 = sut();

            coverImmutableBean(test1);
            CdsIndex      product = CdsIndex.of(BUY, INDEX_ID, LEGAL_ENTITIES, USD, 1.e9, START_DATE, END_DATE, P6M, SAT_SUN, 0.067);
            CdsIndexTrade test2   = CdsIndexTrade.builder().product(product).info(TradeInfo.empty()).build();

            coverBeanEquals(test1, test2);
        }
Esempio n. 8
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         CdsIndexTrade other = (CdsIndexTrade)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(upfrontFee, other.upfrontFee));
     }
     return(false);
 }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case -823800825:         // underlyingTrade
                    this.underlyingTrade = (CdsIndexTrade)newValue;
                    break;

                case 107953788:         // quote
                    this.quote = (CdsQuote)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates an instance.
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="quote">  the quote </param>
 /// <returns> the instance </returns>
 public static CdsIndexCalibrationTrade of(CdsIndexTrade trade, CdsQuote quote)
 {
     return(new CdsIndexCalibrationTrade(trade, quote));
 }
 //-------------------------------------------------------------------------
 internal virtual CdsIndexTrade sut()
 {
     return(CdsIndexTrade.builder().product(PRODUCT).upfrontFee(UPFRONT).info(TRADE_INFO).build());
 }
        public virtual void test_serialization()
        {
            CdsIndexTrade test = sut();

            assertSerialization(test);
        }