Exemple #1
0
 public RateMaster(DateTime tradeDate, DateTime endDate, List <ParRateElf> parRateElfList, List <DateTime> holidays)
 {
     this.TradeDate        = tradeDate;
     this.m_parRateElfList = parRateElfList;
     this.m_tradeDateAx    = new TradeDateAx(tradeDate, endDate, holidays);
     this.SpotDate         = m_tradeDateAx.GetSettlementDate(TradeDate, 0).Item1;
 }
Exemple #2
0
        public YieldElf[] GetCurve(int year)
        {
            List <YieldElf> yieldList = new List <YieldElf>();

            //foreach (var item in this.ParRateList)
            //{
            //    (double zero, double FR, double DF, double newZero, double rate) = GetYield_T(item.DaysAct, item.DaysAct - 90 / 365d);
            //    yieldList.Add(new YieldElf(item, FR));
            //}
            for (int i = 0; i < year; i++)
            {
                for (int j = 1; j <= 4; j++)
                {
                    int            tenor     = i * 12 + j * 3; //#每3個月
                    EnumTenorUnit  unit      = EnumTenorUnit.Month;
                    double         rate      = 0;
                    EnumRateMarket market    = EnumRateMarket.None;
                    DateTime       startDate = DateTime.Today;
                    (DateTime endDate, bool isLastDay, double days) = m_tradeDateAx.GetSettlementDate(startDate, (i * 4) + j);
                    double daysAct = days / 365d;
                    (double zero, double fr, double df, double newZero, double swap) = GetYield_T(daysAct);
                    YieldElf yieldElf = new YieldElf(tenor, unit, rate, market, startDate, endDate, days, daysAct, zero, df, fr);
                    bool     exist    = (from item in yieldList
                                         where item.Days == days
                                         select item).Any();
                    if (!exist) //# 如果已經存在就不要加入了
                    {
                        yieldList.Add(yieldElf);
                    }
                }
            }
            var query = (from item in yieldList
                         orderby item.Days
                         select item).ToArray();

            return(query);
        }