示例#1
0
        private void AddParRateForTaibor(DateTime startDate, ParRateElf parRateInfo)
        {
            (DateTime endDate, double days, double daysAct) = GetEndDate(startDate, parRateInfo);
            double zero = 0; //# 零息利率

            #region 取零息利率
            zero = RateAx.零息利率_T_R(parRateInfo.Rate, daysAct);
            #endregion 取零息利率
            this.ParRateList.Add(new ParRateElfEx(parRateInfo, this.TradeDate, endDate, days, daysAct, zero));
        }
示例#2
0
        private void AddParRateForInterbank(DateTime startDate, ParRateElf parRateInfo)
        {
            //# 一定是ON或TN, 央行沒有報TN, 所以會用ON的利率帶進來
            (DateTime endDate, double days, double daysAct) = GetEndDate(startDate, parRateInfo);
            double zero = 0; //# 零息利率

            #region 取零息利率
            if (parRateInfo.Unit == EnumTenorUnit.Day && parRateInfo.Tenor == 2) //# TN
            {
                ParRateElfEx ON = ParRateList.SingleOrDefault(p => p.Tenor == 1 && p.Unit == EnumTenorUnit.Day);
                if (ON == null)
                {
                    throw new Exception("沒有O/N無法計算T/N的零息利率");
                }
                double s = days - ON.Days;
                zero = RateAx.TN零息利率(ON.DF, parRateInfo.Rate, days, s);
            }
            else
            {
                zero = RateAx.零息利率_T_R(parRateInfo.Rate, daysAct);
            }
            #endregion 取零息利率
            this.ParRateList.Add(new ParRateElfEx(parRateInfo, this.TradeDate, endDate, days, daysAct, zero));
        }