Ejemplo n.º 1
0
        private static AnalyticsBondStaticData ConvertCarbonBondStaticToAnalyticBondStatic(ICarbonClient client, ITimeSeries data)
        {
            var result = new AnalyticsBondStaticData
            {
                Id = client.GetSingleStaticDataInternal<string>(data, "isin"),
                MaturityDate = client.GetSingleStaticDataInternal<DateTime>(data, "maturityDt"),
                EffectiveDate = client.GetSingleStaticDataInternal<DateTime>(data, "effectiveDt")
            };

            //  Check if there is a more recent effective date due to subsequent auctions.
            DateTime latestEffectiveDate;
            object o = data.GetCarbonBondMostRecentEffectiveDate();
            if (o is DateTime)
                latestEffectiveDate = (DateTime)o;
            else
                latestEffectiveDate = result.EffectiveDate;
            result.FirstCouponDate = client.GetSingleStaticDataInternal<DateTime>(data, "firstCpnDt");
            result.Coupon = client.GetSingleStaticDataInternal<double>(data, "cpnRate");

            return DecorateAnalyticsBondStaticData(result, latestEffectiveDate);
        }