示例#1
0
        public Dictionary <string, IPriceCurve> GetDeltaScenarios(double bumpSize, DateTime?LastDateToBump)
        {
            var o     = new Dictionary <string, IPriceCurve>();
            var cSpot = new ContangoPriceCurve(BuildDate, Spot + bumpSize, SpotDate, PillarDates, Contangos, _currencyProvider, Basis)
            {
                SpotCalendar = SpotCalendar,
                SpotLag      = SpotLag
            };

            o.Add("Spot", cSpot);
            return(o);
        }
示例#2
0
        public IPriceCurve RebaseDate(DateTime newAnchorDate)
        {
            var newSpotDate = newAnchorDate.SpotDate(SpotLag, SpotCalendar, SpotCalendar);
            var newSpot     = GetPriceForDate(newSpotDate);
            var fwds        = PillarDates.Select(p => GetPriceForDate(p)).ToArray();
            var times       = PillarDates.Select(p => newSpotDate.CalculateYearFraction(p, Basis)).ToArray();
            var newCtgos    = fwds.Select((f, ix) => times[ix] == 0 ? 0.0 : (f / newSpot - 1.0) / times[ix]).ToArray();

            var o = new ContangoPriceCurve(newAnchorDate, newSpot, newSpotDate, PillarDates, newCtgos, _currencyProvider, Basis, PillarLabels)
            {
                AssetId      = AssetId,
                Currency     = Currency,
                Name         = Name,
                SpotCalendar = SpotCalendar,
                SpotLag      = SpotLag
            };

            return(o);
        }