Exemplo n.º 1
0
        public MaxBasketPathPricer(SparseVector underlying,
                                   double discountFactor, bool useAntitheticVariance)
            : base(discountFactor, useAntitheticVariance)
        {
            if (underlying.Min() <= 0.0)
            {
                throw new ArgumentException(nameof(underlying));
            }

            _underlying = underlying;
        }
Exemplo n.º 2
0
        private void InitializeGenerator(IContinuousRng generator, Matrix covariance)
        {
            SparseVector diagonal = covariance.Diagonal;

            if (Count != diagonal.Length)
            {
                throw new ArgumentException("TODO: Covariance matrix does not match number of assets");
            }
            if (diagonal.Min() < 0.0)
            {
                throw new ArgumentException("TODO: Covariance matrix contains negative variance.");
            }
            ArrayGenerator = new RandomArrayGenerator(generator, covariance);
        }
Exemplo n.º 3
0
        ///<summary>
        ///</summary>
        ///<param name="optionType"></param>
        ///<param name="underlying"></param>
        ///<param name="strike"></param>
        ///<param name="discountFactor"></param>
        ///<param name="useAntitheticVariance"></param>
        ///<exception cref="ArgumentException"></exception>
        public BasketPathPricer(Option.Type optionType, SparseVector underlying,
                                double strike, double discountFactor, bool useAntitheticVariance)
            : base(discountFactor, useAntitheticVariance)
        {
            if (underlying.Min() <= 0.0)
            {
                throw new ArgumentException("TODO: Price of underlying(s) must be positive.");
            }

            if (strike <= 0.0)
            {
                throw new ArgumentException("TODO: Strike price must be positive.");
            }

            _optionType = optionType;
            _underlying = underlying;
            _strike     = strike;
        }