Ejemplo n.º 1
0
        //Note: stopping time does not fine-tuned option-time-value pricing mode yet.
        protected override double StoppingTime(IOption option, IMarketCondition[] markets)
        {
            var trade = (BarrierOption)option;

            if (_useFourier)
            {
                var calculator = new BarrierOptionFourierPvPricer(trade, markets[0]);
                return(calculator.StoppingTime());
            }
            else
            {
                var calculator = new BarrierOptionPvPricer(trade, markets[0]);
                return(calculator.StoppingTime());
            }
        }
Ejemplo n.º 2
0
        protected override double CalcPv(IOption option, IMarketCondition market, double timeIncrement = 0.0)
        {
            if (!(option is BarrierOption))
            {
                throw new PricingBaseException("");
            }
            var trade        = (BarrierOption)option;
            var exerciseDate = trade.ExerciseDates.Last();
            var maturityDate = trade.UnderlyingMaturityDate;

            double pv = double.NaN;

            if (_useFourier)
            {
                var barrierCalculator = new BarrierOptionFourierPvPricer(trade, market, timeIncrement: timeIncrement);
                pv = barrierCalculator.Pv();
            }
            else
            {
                var barrierCalculator = new BarrierOptionPvPricer(trade, market, timeIncrement: timeIncrement);
                pv = barrierCalculator.Pv();
            }
            return(pv * trade.ParticipationRate * trade.Notional);
        }