Package org.jquantlib.quotes

Examples of org.jquantlib.quotes.SimpleQuote


            throw new UnsupportedOperationException("Work in progress");

        final Calendar calendar = new Target();
        final Date today = Date.todaysDate();
        final DayCounter dayCount = new Actual365Fixed();
        final Handle<Quote> stateVariable = new Handle(new SimpleQuote(s0_.doubleValue()));
        final Handle<YieldTermStructure> riskFreeRate = new Handle(new FlatForward(today, r_.doubleValue(), dayCount));

        final Handle<YieldTermStructure> dividendYield = new Handle(new FlatForward(today, 0.0, dayCount));

        final Handle<BlackVolTermStructure> volatility = new Handle(new BlackConstantVol(today, calendar, sigma_.doubleValue(),dayCount));
View Full Code Here



        final Exercise europeanExercise = new EuropeanExercise(exerciseDate);
        final Exercise americanExercise = new AmericanExercise(settlementDate,exerciseDate);

        final Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(underlying));
        final Handle<YieldTermStructure> flatTermStructure = new Handle<YieldTermStructure>(
                new FlatForward(settlementDate, riskFreeRate, dayCounter));
        final Handle<YieldTermStructure> flatDividendTS = new Handle<YieldTermStructure>(
                new FlatForward(settlementDate, dividendYield, dayCounter));
        final Handle<BlackVolTermStructure> flatVolTS = new Handle<BlackVolTermStructure>(
                new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));

        final BlackScholesMertonProcess stochasticProcess = new BlackScholesMertonProcess(
                underlyingH, flatDividendTS, flatTermStructure, flatVolTS);

        final int timeSteps = 801;

        final Handle<Quote> creditSpread = new Handle<Quote>(new SimpleQuote(spreadRate));

        //XXX rate and discountCurve not being used in original QuantLib/C++ sources
        // final Quote rate = new SimpleQuote(riskFreeRate);
        //
        // final Handle<YieldTermStructure> discountCurve = new Handle<YieldTermStructure>(
View Full Code Here

            final Date settlement,
            final Handle<YieldTermStructure> discountCurve) {

        assert(freq!=Frequency.NoFrequency && freq != Frequency.Once):"invalid frequency:" + freq.toString();

        final Handle<Quote> zSpreadQuoteHandle = new Handle<Quote>(new SimpleQuote(
                zSpread));

        final ZeroSpreadedTermStructure spreadedCurve = new ZeroSpreadedTermStructure(
                discountCurve, zSpreadQuoteHandle, comp, freq, dc);
        /* @Real */double price = 0.0;
View Full Code Here

        final StopClock clock = new StopClock();
        clock.startClock();

        System.out.println("//==========================================FlatForward termstructure===================");
        final SimpleQuote interestRateQuote = new SimpleQuote(0.3);
        final RelinkableHandle<Quote>  handleToInterestRateQuote = new RelinkableHandle<Quote>(interestRateQuote);
        final YieldTermStructure flatforward = new FlatForward(2,new UnitedStates(Market.NYSE),handleToInterestRateQuote,new Actual365Fixed(), Compounding.Continuous,Frequency.Daily);

        final Date today  = Date.todaysDate();
        final Date date10 = today.clone().addAssign(10);
        final Date date20 = today.clone().addAssign(20);
        final Date date30 = today.clone().addAssign(30);
        final Date date40 = today.clone().addAssign(40);
        final Date date50 = today.clone().addAssign(50);


        //Calculating discount factor
        System.out.println("The discount factor for the date 30 days from today is = "+flatforward.discount(date30.clone()));

        //Calculating forward rate
        System.out.println("The forward rate between the date 30 days from today to 50 days from today is = "+flatforward.forwardRate(date30.clone(), date50.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        //Calculating parRate for the dates as shown below-
        final Date[] dates = { date10.clone(), date20.clone(), date30.clone(), date40.clone(), date50.clone() };
        System.out.println("The par rate for the bond having coupon dates as shown above is = "+flatforward.parRate(dates, Frequency.Semiannual, false));

        //Calculating zero rate
        System.out.println("The zero rate for the bond having coupon date as 10 days from today = "+flatforward.zeroRate(date10.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        System.out.println("//==========================================ForwardSpreadedTermStructure==================");
        //As the name suggests this termstructure adds a spread to the forward rates it calculates by getting the spread rate
        //from the spread rate quote
        final SimpleQuote spreadRateQuote = new SimpleQuote(0.2);
        final RelinkableHandle<Quote>  handleToSpreadRateQuote = new RelinkableHandle<Quote>(spreadRateQuote);

        final ForwardRateStructure forwardSpreadedTermStructure = new ForwardSpreadedTermStructure(new RelinkableHandle<YieldTermStructure>(flatforward),handleToSpreadRateQuote);

        //Calculating discount factor.This termstructure adds the spread as specified by the spread quote and then calculates the discount.
View Full Code Here

            final BarrierType barrierType = BarrierType.DownOut;
            final double barrier = 70.0;
            final double rebate = 0.0;
            final Option.Type type = Option.Type.Put;
            final double underlyingValue = 100;
            final Handle<SimpleQuote> underlying = new Handle<SimpleQuote>(new SimpleQuote(underlyingValue));

            final double strike = 100.0;
            final Handle<SimpleQuote> riskFreeRate = new Handle<SimpleQuote>(new SimpleQuote(0.04));
            final Handle<SimpleQuote> volatility = new Handle<SimpleQuote>(new SimpleQuote(0.20));
            final Date maturity = today.add(Period.ONE_YEAR_FORWARD);

            System.out.println("\n");

            //write column headings - we don't need these values ...
View Full Code Here

        Exercise europeanExercise = new EuropeanExercise(maturityDate);
        Payoff payoff = new PlainVanillaPayoff(type, strike);

        final Calendar calendar = new Target();
        Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(underlying));
        Handle<YieldTermStructure> flatDividendTS = new Handle<YieldTermStructure>(new FlatForward(settlementDate, dividendYield, dayCounter));
        Handle<YieldTermStructure> flatTermStructure = new Handle<YieldTermStructure>(new FlatForward(settlementDate, riskFreeRate, dayCounter));
        Handle<BlackVolTermStructure> flatVolTS = new Handle<BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));

        GeneralizedBlackScholesProcess stochasticProcess = new BlackScholesMertonProcess(underlyingH, flatDividendTS, flatTermStructure, flatVolTS);
View Full Code Here

      vars.settlement = vars.calendar.advance(vars.today,  vars.settlementDays, TimeUnit.Days);

      // market elements
      vars.rates = new SimpleQuote[vars.swaps];
      for (int i=0; i<vars.swaps; i++) {
          vars.rates[i] = new SimpleQuote(swapData[i].rate/100);
      }

      // rate helpers
      vars.instruments = new RateHelper[vars.swaps];
View Full Code Here

    static public YieldTermStructure flatRate(final Date today, final Quote forward, final DayCounter dc) {
        return new FlatForward(today, new Handle<Quote>(forward), dc);
    }

    static public YieldTermStructure flatRate(final Date today, final/* @Rate */double forward, final DayCounter dc) {
        return flatRate(today, new SimpleQuote(forward), dc);
    }
View Full Code Here

    static public YieldTermStructure flatRate(final Quote forward, final DayCounter dc) {
        return new FlatForward(0, new NullCalendar(), new Handle<Quote>(forward), dc);
    }

    static public YieldTermStructure flatRate(final/* @Rate */double forward, final DayCounter dc) {
        return flatRate(new SimpleQuote(forward), dc);
    }
View Full Code Here

    static public BlackVolTermStructure flatVol(final Date today, final Quote vol, final DayCounter dc) {
        return new BlackConstantVol(today, new NullCalendar(), new Handle<Quote>(vol), dc);
    }

    static public BlackVolTermStructure flatVol(final Date today, final/* @Volatility */double vol, final DayCounter dc) {
        return flatVol(today, new SimpleQuote(vol), dc);
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.quotes.SimpleQuote

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.