Esempio n. 1
0
        static public IMarketEnvironment CreateDFandVolCurves(string curveName, string volcurveName, DateTime baseDate, Double[] times, Double[] dfs, Double[] voltimes, Double[] volstrikes, Double[,] vols)
        {
            var market       = new MarketEnvironment();
            var interpMethod = InterpolationMethodHelper.Parse("LinearInterpolation");
            var curve        = new SimpleDiscountFactorCurve(baseDate, interpMethod, true, times, dfs);
            var volcurve     = new SimpleVolatilitySurface(baseDate, interpMethod, true, voltimes, volstrikes, vols);

            market.AddPricingStructure(curveName, curve);
            market.AddPricingStructure(volcurveName, volcurve);
            return(market);
        }
        ///<summary>
        /// Creates a market environment for use in calculations.
        ///</summary>
        ///<param name="marketName">The name of the market environment.</param>
        ///<param name="curve">The curve.</param>
        ///<returns></returns>
        public static IMarketEnvironment Create(string marketName, IPricingStructure curve)
        {
            var environment = new MarketEnvironment(marketName);
            var name        = (PricingStructureIdentifier)curve.GetPricingStructureId();

            environment.AddPricingStructure(name.UniqueIdentifier, curve);
            return(environment);
        }
Esempio n. 3
0
        static public IMarketEnvironment CreateSimpleInflationCurve(string curveName, DateTime baseDate, Double[] times, Double[] dfs)
        {
            var market       = new MarketEnvironment();
            var interpMethod = InterpolationMethodHelper.Parse("LinearInterpolation");
            var curve        = new SimpleDiscountFactorCurve(baseDate, interpMethod, true, times, dfs);

            market.AddPricingStructure(curveName, curve);
            return(market);
        }
        ///<summary>
        /// Creates a market environment for use in calculations.
        ///</summary>
        ///<param name="marketName">The name of the market environment.</param>
        ///<param name="curve">The curve.</param>
        ///<returns></returns>
        public static IMarketEnvironment Create(string marketName, List <IPricingStructure> curve)
        {
            var environment = new MarketEnvironment(marketName);

            foreach (var structure in curve)
            {
                var name = (PricingStructureIdentifier)structure.GetPricingStructureId();
                environment.AddPricingStructure(name.UniqueIdentifier, structure);
            }
            return(environment);
        }