Beispiel #1
0
        /// <summary>
        /// Computes the shifted quarterly cash forward rate for a specific future time.
        /// </summary>
        /// <param name="forwardDate"></param>
        /// <param name="discount">Discount factors used.</param>
        /// <param name="shift">Shifts used.</param>
        /// <returns></returns>
        public static double ShiftedCashForwardRate(int forwardDate, QuarterlyDiscounts discount, QuarterlyShifts shift)
        {
            double rate = 4 * (discount.Get(forwardDate) / discount.Get(forwardDate + 1) - 1);

            rate += shift.Get(forwardDate);
            return(rate);
        }
Beispiel #2
0
        /// <summary>
        /// The "shift" of the swap rate, or shifted swap rate - actual swap rate.
        /// </summary>
        /// <param name="expiry"></param>
        /// <param name="tenor"></param>
        /// <param name="discount"></param>
        /// <param name="shift"></param>
        /// <returns></returns>
        public static double SwapShift(int expiry, int tenor, QuarterlyDiscounts discount, QuarterlyShifts shift)
        {
            double numerator   = 0;
            double denominator = 0;

            for (int i = 0; i < tenor; i++)
            {
                double forward = ForwardContract(expiry, expiry + i + 1, discount);
                numerator   += forward * shift.Get(expiry + i);
                denominator += forward;
            }
            return(numerator / denominator);
        }
Beispiel #3
0
        /// <summary>
        /// Computes the swap rate of a quarterly swap.
        /// </summary>
        /// <param name="expiry">Expiry time in quarters.</param>
        /// <param name="tenor">Length of the swap in quarters.</param>
        /// <param name="discount">Discount factors used.</param>
        /// <returns></returns>
        public static double SwapRate(int expiry, int tenor, QuarterlyDiscounts discount)
        {
            double numerator   = 0;
            double denominator = 0;

            for (int i = 0; i < tenor; i++)
            {
                double forward = ForwardContract(expiry, expiry + i + 1, discount);
                numerator   += forward * CashForwardRate(expiry + i, discount);
                denominator += forward;
            }
            return(numerator / denominator);
        }
Beispiel #4
0
        /// <summary>
        /// Computes the quarterly cash forward rate for a specific future time.
        /// </summary>
        /// <param name="forwardDate"></param>
        /// <param name="discount">Discount factors used.</param>
        /// <returns></returns>
        public static double CashForwardRate(int forwardDate, QuarterlyDiscounts discount)
        {
            double rate = 4 * (discount.Get(forwardDate) / discount.Get(forwardDate + 1) - 1);

            return(rate);
        }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="paymentDate">Contract payment time, in quarters.</param>
 /// <param name="settleDate">Delivery time, in quarters.</param>
 /// <param name="discount">Discount factors used.</param>
 /// <returns></returns>
 public static double ForwardContract(int paymentDate, int settleDate, QuarterlyDiscounts discount)
 {
     return(discount.Get(settleDate) / discount.Get(paymentDate));
 }