Base class for market observables.
Inheritance: QLNet.Patterns.DefaultObservable, IQuote
示例#1
0
 public FlatForward(Date referenceDate, double forward, DayCounter dayCounter, Compounding compounding, Frequency frequency)
     : base(referenceDate, new Calendar(), dayCounter)
 {
     forward_ = new SimpleQuote(forward);
     compounding_ = compounding;
     frequency_ = frequency;
 }
示例#2
0
        public FlatForward(Date referenceDate, Quote forward, DayCounter dayCounter, Compounding compounding, Frequency frequency)
            : base(referenceDate, new Calendar(), dayCounter)
        {
            forward_ = forward;
            compounding_ = compounding;
            frequency_ = frequency;

            forward_.registerWith(update);
        }
 public ZeroSpreadedTermStructure(Handle<YieldTermStructure> h, Quote spread, Compounding comp, Frequency freq, DayCounter dc) {
     originalCurve_ = h;
     spread_ = spread;
     comp_ = comp;
     freq_ = freq;
     dc_ = dc;
     //QL_REQUIRE(h->dayCounter()==dc_,
     //           "spread daycounter (" << dc_ <<
     //           ") must be the same of the curve to be spreaded (" <<
     //           originalCurve_->dayCounter() <<
     //           ")");
     originalCurve_.registerWith(update);
     spread_.registerWith(update);
 }
示例#4
0
 public static YieldTermStructure flatRate(Date today, Quote forward, DayCounter dc)
 {
     return new FlatForward(today, forward, dc);
 }
示例#5
0
 //philippe2009_17
 public static BlackVolTermStructure flatVol(Quote vol, DayCounter dc)
 {
     return new BlackConstantVol(0, new NullCalendar(), new Handle<Quote>(vol), dc);
 }
示例#6
0
 public static YieldTermStructure flatRate(Quote forward, DayCounter dc)
 {
     return new FlatForward(0, new NullCalendar(), forward, dc);
 }
示例#7
0
        public FlatForward(int settlementDays, Calendar calendar, Quote forward, DayCounter dayCounter, Compounding compounding, Frequency frequency)
            : base(settlementDays, calendar, dayCounter)
        {
            forward_ = forward;
            compounding_ = compounding;
            frequency_ = frequency;

            forward_.registerWith(update);
        }
示例#8
0
 public FlatForward(int settlementDays, Calendar calendar, Quote forward, DayCounter dayCounter, Compounding compounding)
     : this(settlementDays, calendar, forward, dayCounter, compounding, Frequency.Annual)
 {
 }
示例#9
0
 public FlatForward(Date referenceDate, Quote forward, DayCounter dayCounter, Compounding compounding)
     : this(referenceDate, forward, dayCounter, compounding, Frequency.Annual)
 {
 }
示例#10
0
 // constructors
 public FlatForward(Date referenceDate, Quote forward, DayCounter dayCounter)
     : this(referenceDate, forward, dayCounter, Compounding.Continuous, Frequency.Annual)
 {
 }
示例#11
0
        public FlatForward(int settlementDays, Calendar calendar, double forward, DayCounter dayCounter,
							Compounding compounding, Frequency frequency)
            : base(settlementDays, calendar, dayCounter)
        {
            forward_ = new SimpleQuote(forward);
            compounding_ = compounding;
            frequency_ = frequency;
        }
示例#12
0
 GeneralizedBlackScholesProcess makeProcess(Quote u, YieldTermStructure q, YieldTermStructure r, BlackVolTermStructure vol)
 {
     return new BlackScholesMertonProcess(new Handle<Quote>(u), new Handle<YieldTermStructure>(q),
                                       new Handle<YieldTermStructure>(r), new Handle<BlackVolTermStructure>(vol));
 }
示例#13
0
        VanillaOption makeOption(StrikedTypePayoff payoff, Exercise exercise, Quote u, YieldTermStructure q,
            YieldTermStructure r, BlackVolTermStructure vol, EngineType engineType, int binomialSteps, int samples)
        {
            GeneralizedBlackScholesProcess stochProcess = makeProcess(u, q, r, vol);

             IPricingEngine engine;
             switch (engineType)
             {
            case EngineType.Analytic:
               engine = new AnalyticEuropeanEngine(stochProcess);
               break;
            case EngineType.JR:
               engine = new BinomialVanillaEngine<JarrowRudd>(stochProcess, binomialSteps);
               break;
            case EngineType.CRR:
               engine = new BinomialVanillaEngine<CoxRossRubinstein>(stochProcess, binomialSteps);
               break;
            case EngineType.EQP:
               engine = new BinomialVanillaEngine<AdditiveEQPBinomialTree>(stochProcess, binomialSteps);
               break;
            case EngineType.TGEO:
               engine = new BinomialVanillaEngine<Trigeorgis>(stochProcess, binomialSteps);
               break;
            case EngineType.TIAN:
               engine = new BinomialVanillaEngine<Tian>(stochProcess, binomialSteps);
               break;
            case EngineType.LR:
               engine = new BinomialVanillaEngine<LeisenReimer>(stochProcess, binomialSteps);
               break;
            case EngineType.JOSHI:
               engine = new BinomialVanillaEngine<Joshi4>(stochProcess, binomialSteps);
               break;
            case EngineType.FiniteDifferences:
               engine = new FDEuropeanEngine(stochProcess, binomialSteps, samples);
               break;
            case EngineType.Integral:
               engine = new IntegralEngine(stochProcess);
               break;
            //case EngineType.PseudoMonteCarlo:
            //  engine = MakeMCEuropeanEngine<PseudoRandom>(stochProcess)
            //      .withSteps(1)
            //      .withSamples(samples)
            //      .withSeed(42);
            //  break;
            //case EngineType.QuasiMonteCarlo:
            //  engine = MakeMCEuropeanEngine<LowDiscrepancy>(stochProcess)
            //      .withSteps(1)
            //      .withSamples(samples);
            //  break;
            default:
               throw new ArgumentException("unknown engine type");
             }

             VanillaOption option = new EuropeanOption(payoff, exercise);
             option.setPricingEngine(engine);
             return option;
        }
 public ZeroSpreadedTermStructure(Handle<YieldTermStructure> h, Quote spread)
     : this(h, spread, Compounding.Continuous, Frequency.NoFrequency, new DayCounter()) { }