Beispiel #1
0
 private CdsCalibrationTrade(CdsTrade underlyingTrade, CdsQuote quote)
 {
     JodaBeanUtils.notNull(underlyingTrade, "underlyingTrade");
     JodaBeanUtils.notNull(quote, "quote");
     this.underlyingTrade = underlyingTrade;
     this.quote           = quote;
 }
Beispiel #2
0
        //-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            CdsTrade             trade    = sut();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().id(TRADE_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.TRADE).productType(ProductType.CDS).currencies(Currency.USD).description("10Y9M Buy USD 1000mm ABC / 5% : 20Dec13-20Sep24").build();

            assertEquals(trade.summarize(), expected);
        }
Beispiel #3
0
        public virtual void test_min_resolve()
        {
            ResolvedCdsTrade test = CdsTrade.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);
        }
Beispiel #4
0
        public virtual void test_min_builder()
        {
            CdsTrade test = CdsTrade.builder().product(PRODUCT).info(TRADE_INFO).build();

            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Info, TRADE_INFO);
            assertFalse(test.UpfrontFee.Present);
        }
Beispiel #5
0
        public virtual void test_full_builder()
        {
            CdsTrade test = sut();

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

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

            coverBeanEquals(test1, test2);
        }
Beispiel #7
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            CdsTrade test1 = sut();

            coverImmutableBean(test1);
            Cds      product = Cds.of(BUY, LEGAL_ENTITY, USD, 1.e9, START_DATE, END_DATE, P3M, SAT_SUN, 0.067);
            CdsTrade test2   = CdsTrade.builder().product(product).info(TradeInfo.empty()).build();

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

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

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

            assertSerialization(test);
        }