コード例 #1
0
        //-------------------------------------------------------------------------
        public virtual void test_parSpread_noFixing()
        {
            double            parSpread = PRICER.parSpread(RDEPOSIT, IMM_PROV_NOFIX);
            IborFixingDeposit deposit0  = DEPOSIT.toBuilder().fixedRate(RATE + parSpread).build();
            CurrencyAmount    pv0       = PRICER.presentValue(deposit0.resolve(REF_DATA), IMM_PROV_NOFIX);

            assertEquals(pv0.Amount, 0, TOLERANCE_RATE);
            double parSpread2 = PRICER.parSpread(RDEPOSIT, IMM_PROV_NOFIX);

            assertEquals(parSpread, parSpread2, TOLERANCE_RATE);
        }
        //-------------------------------------------------------------------------
        public virtual void test_parSpread()
        {
            double psTrade   = PRICER_TRADE.parSpread(RDEPOSIT_TRADE, IMM_PROV);
            double psProduct = PRICER_PRODUCT.parSpread(RDEPOSIT_PRODUCT, IMM_PROV);

            assertEquals(psTrade, psProduct, TOLERANCE_RATE);
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates the spread to be added to the deposit rate to have a zero present value.
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="provider">  the rates provider </param>
 /// <returns> the par spread </returns>
 public virtual double parSpread(ResolvedIborFixingDepositTrade trade, RatesProvider provider)
 {
     return(productPricer.parSpread(trade.Product, provider));
 }