GJR-GARCH option pricing engine

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

GJR-GARCH option pricing engine

Yee Man Chan
Hi

   I recently finished my implementation of
GJR-GARCH(1,1) option pricing model for European
options using QMC with Brownian Bridge.

   I find that you guys don't have this pricing model.
Do you mind if I implement this for Quantlib? If so,
how should I proceed?

Have a great day!
Yee Man


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio
Hi Yee Man,

On Thu, 2008-03-06 at 17:20 -0800, Yee Man Chan wrote:
>    I recently finished my implementation of
> GJR-GARCH(1,1) option pricing model for European
> options using QMC with Brownian Bridge.
>
>    I find that you guys don't have this pricing model.
> Do you mind if I implement this for Quantlib?

I'll be happy if you do.

> If so, how should I proceed?

You can send me the files and I'll add them to the repository.
You should code your model as a pricing engine; if you're not yet
familiar with our pricing framework, you can read chapter 2 at
<http://luigi.ballabio.googlepages.com/qlbook> for an introduction.
Also, it should use the existing facilities for random-number
generation. As an example, you can look at the current MC engine for
European options in <ql/pricingengines/vanilla/mceuropeanengine.hpp>.

Later,
        Luigi


--

Every solution breeds new problems.
-- unknown



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
Hi Luigi

   Thanks for your reply. Are you still at Stanford?
Maybe we can hang out one day.

   I will start coding then. It shouldn't be too hard.
I can just copy the Heston code and change the
stochastic process for volatility. I also have an
implementation for analytical approximation of
GJR-GARCH option pricing model as described in Duan
2004 paper.

   Do you guys give out remote CVS access for
developers? That's what I got for my previous open
source contribution. If this is not how it works here,
I am ok sending files directly to Luigi.

Have a great day!
Yee Man

   

--- Luigi Ballabio <[hidden email]> wrote:

> Hi Yee Man,
>
> On Thu, 2008-03-06 at 17:20 -0800, Yee Man Chan
> wrote:
> >    I recently finished my implementation of
> > GJR-GARCH(1,1) option pricing model for European
> > options using QMC with Brownian Bridge.
> >
> >    I find that you guys don't have this pricing
> model.
> > Do you mind if I implement this for Quantlib?
>
> I'll be happy if you do.
>
> > If so, how should I proceed?
>
> You can send me the files and I'll add them to the
> repository.
> You should code your model as a pricing engine; if
> you're not yet
> familiar with our pricing framework, you can read
> chapter 2 at
> <http://luigi.ballabio.googlepages.com/qlbook> for
> an introduction.
> Also, it should use the existing facilities for
> random-number
> generation. As an example, you can look at the
> current MC engine for
> European options in
> <ql/pricingengines/vanilla/mceuropeanengine.hpp>.
>
> Later,
> Luigi
>
>
> --
>
> Every solution breeds new problems.
> -- unknown
>
>
>



      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
Attached is my gjrgarchprocess.hpp. Basically I just
modified hestonprocess.hpp to suit my needs.

The naming convention of the model parameters follows
the Hull 2005 book.

I am not quite sure what kind of code is within \f[ ].
Can someone tell me?

Also, any comments and questions are welcome.

Thanks
Yee Man

--- Yee Man Chan <[hidden email]> wrote:

> Hi Luigi
>
>    Thanks for your reply. Are you still at Stanford?
> Maybe we can hang out one day.
>
>    I will start coding then. It shouldn't be too
> hard.
> I can just copy the Heston code and change the
> stochastic process for volatility. I also have an
> implementation for analytical approximation of
> GJR-GARCH option pricing model as described in Duan
> 2004 paper.
>
>    Do you guys give out remote CVS access for
> developers? That's what I got for my previous open
> source contribution. If this is not how it works
> here,
> I am ok sending files directly to Luigi.
>
> Have a great day!
> Yee Man
>
>    
>
> --- Luigi Ballabio <[hidden email]> wrote:
>
> > Hi Yee Man,
> >
> > On Thu, 2008-03-06 at 17:20 -0800, Yee Man Chan
> > wrote:
> > >    I recently finished my implementation of
> > > GJR-GARCH(1,1) option pricing model for European
> > > options using QMC with Brownian Bridge.
> > >
> > >    I find that you guys don't have this pricing
> > model.
> > > Do you mind if I implement this for Quantlib?
> >
> > I'll be happy if you do.
> >
> > > If so, how should I proceed?
> >
> > You can send me the files and I'll add them to the
> > repository.
> > You should code your model as a pricing engine; if
> > you're not yet
> > familiar with our pricing framework, you can read
> > chapter 2 at
> > <http://luigi.ballabio.googlepages.com/qlbook> for
> > an introduction.
> > Also, it should use the existing facilities for
> > random-number
> > generation. As an example, you can look at the
> > current MC engine for
> > European options in
> > <ql/pricingengines/vanilla/mceuropeanengine.hpp>.
> >
> > Later,
> > Luigi
> >
> >
> > --
> >
> > Every solution breeds new problems.
> > -- unknown
> >
> >
> >
>
>
>
>      
>
____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio
> 2008.
>
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

gjrgarchprocess.hpp (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio
On Tue, 2008-03-11 at 16:39 -0700, Yee Man Chan wrote:
> Attached is my gjrgarchprocess.hpp. Basically I just
> modified hestonprocess.hpp to suit my needs.

Yee Man,
        thanks for the contribution. I'll try and have a look at it as soon as
I get some time.

> I am not quite sure what kind of code is within \f[ ].
> Can someone tell me?

It's LaTeX formulas. If you're not familiar with LaTeX, send me the
formulas in some format and I'll write the LaTeX code.

> Also, any comments and questions are welcome.

It would be nice to have a test case exercising your process. May you
write one? Or at least, do you have an example of input data and their
expected output?

Luigi


--

Discontent is the first necessity of progress.
-- Thomas A. Edison



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
Hi Luigi

>
> > I am not quite sure what kind of code is within
> \f[ ].
> > Can someone tell me?
>
> It's LaTeX formulas. If you're not familiar with
> LaTeX, send me the
> formulas in some format and I'll write the LaTeX
> code.

Oh I see. I think I will learn a bit of it and write
something out. The formula for the stochastic
volatility process is fairly convoluted when market
price of risk (lambda) is non-zero. I think you can
compare what I write in the cpp file to fix my latex
code in the hpp.

>
> > Also, any comments and questions are welcome.
>
> It would be nice to have a test case exercising your
> process. May you
> write one? Or at least, do you have an example of
> input data and their
> expected output?
>

Of course I am going to write a test case.

Attached is the Duan et al (2006) paper published in
Journal of Computational Finance. It has 1M run Monte
Carlo numbers we can check for the program's validity.

I am going to use QuantLib's QMC/Brownian Bridge code
to do the test case. I hope they don't disappoint. ;)

Yee Man

> Luigi
>
>
> --
>
> Discontent is the first necessity of progress.
> -- Thomas A. Edison
>
>
>

      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

jour_comp_fin_2.pdf (307K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio
On Thu, 2008-03-13 at 10:08 -0700, Yee Man Chan wrote:
> > It would be nice to have a test case exercising your
> > process. May you write one?
> >
>
> Of course I am going to write a test case.

Ok, thanks.

Luigi

P.S. I never went to Stanford...


--

Hofstadter's Law:
It always takes longer than you expect, even when you take
Hofstadter's Law into account.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
How do I add files to the Makefile such that they can
be compiled?

I tried to modify Makefile.am but it didn't work...

Thanks
Yee Man
--- Luigi Ballabio <[hidden email]> wrote:

> On Thu, 2008-03-13 at 10:08 -0700, Yee Man Chan
> wrote:
> > > It would be nice to have a test case exercising
> your
> > > process. May you write one?
> > >
> >
> > Of course I am going to write a test case.
>
> Ok, thanks.
>
> Luigi
>
> P.S. I never went to Stanford...
>
>
> --
>
> Hofstadter's Law:
> It always takes longer than you expect, even when
> you take
> Hofstadter's Law into account.
>
>
>



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio
On Tue, 2008-03-25 at 18:56 -0700, Yee Man Chan wrote:
> How do I add files to the Makefile such that they can
> be compiled?
>
> I tried to modify Makefile.am but it didn't work...

Modifying Makefile.am should work. What did you do?

Luigi


--

A child of five would understand this. Send someone to fetch a child of
five.
-- Groucho Marx



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
I added my files to Makefile.am in ql/models/equity
and then I type make but all.hpp doesn't change and no
object files are created

Then I go to the root directory and then type make but
nothing happened either.

Yee Man

--- Luigi Ballabio <[hidden email]> wrote:

> On Tue, 2008-03-25 at 18:56 -0700, Yee Man Chan
> wrote:
> > How do I add files to the Makefile such that they
> can
> > be compiled?
> >
> > I tried to modify Makefile.am but it didn't
> work...
>
> Modifying Makefile.am should work. What did you do?
>
> Luigi
>
>
> --
>
> A child of five would understand this. Send someone
> to fetch a child of
> five.
> -- Groucho Marx
>
>
>



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio
On Wed, 2008-03-26 at 09:39 -0700, Yee Man Chan wrote:
> I added my files to Makefile.am in ql/models/equity
> and then I type make but all.hpp doesn't change and no
> object files are created

You probably need automake and autoconf (and possibly libtool.)
There might be packages available for your distribution. Otherwise
you'll have to download them from the GNU site and install them.

Luigi


--

Ninety percent of everything is crap.
--- Theodore Sturgeon



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
In reply to this post by Luigi Ballabio
I think I fixed it now. The automake on my Linux box
is 1.9.5 but your am files were generated by 1.9.6. So
I went to aclocal.m4 and changed it to 1.9.5 and now
it compiles.

Yee Man
--- Luigi Ballabio <[hidden email]> wrote:

> On Tue, 2008-03-25 at 18:56 -0700, Yee Man Chan
> wrote:
> > How do I add files to the Makefile such that they
> can
> > be compiled?
> >
> > I tried to modify Makefile.am but it didn't
> work...
>
> Modifying Makefile.am should work. What did you do?
>
> Luigi
>
>
> --
>
> A child of five would understand this. Send someone
> to fetch a child of
> five.
> -- Groucho Marx
>
>
>



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
In reply to this post by Luigi Ballabio

I finally get my code (including a simple test case
that is based on test-suite/hestonmodel.cpp) to
compile . I added a line to call my test case in
test-suite/quantlibtestsuite.cpp.

I then ran test-suite/quantlib-test-suite. It gave me
one line of error but no print out from the
BOOST_MESSAGE calls I made. Where can I see the print
outs such that I can debug my code?

Thanks
Yee Man

--- Luigi Ballabio <[hidden email]> wrote:

> On Wed, 2008-03-26 at 09:39 -0700, Yee Man Chan
> wrote:
> > I added my files to Makefile.am in
> ql/models/equity
> > and then I type make but all.hpp doesn't change
> and no
> > object files are created
>
> You probably need automake and autoconf (and
> possibly libtool.)
> There might be packages available for your
> distribution. Otherwise
> you'll have to download them from the GNU site and
> install them.
>
> Luigi
>
>
> --
>
> Ninety percent of everything is crap.
> --- Theodore Sturgeon
>
>
>



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio
On Wed, 2008-03-26 at 17:44 -0700, Yee Man Chan wrote:
> I finally get my code (including a simple test case
> that is based on test-suite/hestonmodel.cpp) to
> compile . I added a line to call my test case in
> test-suite/quantlibtestsuite.cpp.
>
> I then ran test-suite/quantlib-test-suite. It gave me
> one line of error but no print out from the
> BOOST_MESSAGE calls I made. Where can I see the print
> outs such that I can debug my code?

You should set the environment variable

BOOST_TEST_LOG_LEVEL=message

If you run the tests with 'make check', it is done for you.

Luigi


--

Hofstadter's Law:
It always takes longer than you expect, even when you take
Hofstadter's Law into account.



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
Hi Luigi

   I am done coding now. The files are attached in
this email and the next.
   I am sure the analytic pricing engine I implemented
is correct. But the algorithm is O(n^3) where n is the
number of days till expiry, so it is very slow when
number of days is large. It took me 20min to run the
36 test cases in Duan et al's paper.

    I can speed it up quite a bit if I can re-use some
intermediate results when some parameters are the
same. But this requires me to introduce some data
members to AnalyticGJRGARCHengine and assign values to
them during calculate(). But calculate() is a const
function, so I can't really do that. What do you think
I should do?

   I find that my MC results are a bit lower than my
analytic approximation. I think it is due to the fact
that I am using the following code to set maturity

    Date exDate = today + 10; // 10 days maturity
    boost::shared_ptr<Exercise> exercise(new
EuropeanExercise(exDate));

   I find that the time is a bit less than 10 days
when I call
process->time(arguments_.exercise->lastDate()) and
multiply it by 365.0. Do you know how I can get almost
10 days here? Thanks

Attached files are:
test-suite/gjrgarchmodel.hpp
test-suite/gjrgarchmodel.cpp
ql/processes/gjrgarchprocess.hpp
ql/processes/gjrgarhprocess.cpp

    Let me know if there are any questions and
comments

Yee Man

PS More files in another email

> > BOOST_MESSAGE calls I made. Where can I see the
> print
> > outs such that I can debug my code?
>
> You should set the environment variable
>
> BOOST_TEST_LOG_LEVEL=message
>
> If you run the tests with 'make check', it is done
> for you.
>
> Luigi
 

>
> --
>
> Hofstadter's Law:
> It always takes longer than you expect, even when
> you take
> Hofstadter's Law into account.
>
>
>

      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

gjrgarchmodel.cpp (6K) Download Attachment
gjrgarchmodel.hpp (1K) Download Attachment
gjrgarchprocess.hpp (5K) Download Attachment
gjrgarchprocess.cpp (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan
In reply to this post by Luigi Ballabio
Attached files:
ql/models/equity/gjrgarchmodel.hpp
ql/models/equity/gjrgarchmodel.cpp
ql/pricingengines/vanilla/analyticgjrgarchengine.hpp
ql/pricingengines/vanilla/analyticgjrgarchengine.cpp
ql/pricingengines/vanilla/mceuropeangjrgarchengine.hpp

Yee Man

--- Luigi Ballabio <[hidden email]> wrote:

> On Wed, 2008-03-26 at 17:44 -0700, Yee Man Chan
> wrote:
> > I finally get my code (including a simple test
> case
> > that is based on test-suite/hestonmodel.cpp) to
> > compile . I added a line to call my test case in
> > test-suite/quantlibtestsuite.cpp.
> >
> > I then ran test-suite/quantlib-test-suite. It gave
> me
> > one line of error but no print out from the
> > BOOST_MESSAGE calls I made. Where can I see the
> print
> > outs such that I can debug my code?
>
> You should set the environment variable
>
> BOOST_TEST_LOG_LEVEL=message
>
> If you run the tests with 'make check', it is done
> for you.
>
> Luigi
>
>
> --
>
> Hofstadter's Law:
> It always takes longer than you expect, even when
> you take
> Hofstadter's Law into account.
>
>
>

      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

analyticgjrgarchengine.cpp (12K) Download Attachment
analyticgjrgarchengine.hpp (2K) Download Attachment
mceuropeangjrgarchengine.hpp (12K) Download Attachment
gjrgarchmodel.cpp (4K) Download Attachment
gjrgarchmodel.hpp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Chris Kenyon-2
In reply to this post by Yee Man Chan

Hi,

re:
"
    I can speed it up quite a bit if I can re-use some
intermediate results when some parameters are the
same. But this requires me to introduce some data
members to AnalyticGJRGARCHengine and assign values to
them during calculate(). But calculate() is a const
function, so I can't really do that. What do you think
I should do?
"

If you need some local data, then declare it mutable (=never const),
this overrides the const in calculate().  Use with care:
http://www.highprogrammer.com/alan/rants/mutable.html
This is done elsewhere in QL.

Regards,
Chris

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan

Hi Chris

   Thanks for your hint. I added the code to re-use
intermediate results in the analytic GJR-GARCH engine.

   I also fixed a bug in gjrgarchprocess.

   Please update my previously sent files with these
five attached files

Attached files:
test-suite/gjrgarchmodel.cpp
ql/processes/gjrgarchprocess.hpp
ql/processes/gjrgarchprocess.cpp
ql/pricingengines/vanilla/analyticgjrgarchengine.hpp
ql/pricingengines/vanilla/analyticgjrgarchengine.cpp

Yee Man

--- Chris Kenyon <[hidden email]> wrote:

>
> Hi,
>
> re:
> "
>     I can speed it up quite a bit if I can re-use
> some
> intermediate results when some parameters are the
> same. But this requires me to introduce some data
> members to AnalyticGJRGARCHengine and assign values
> to
> them during calculate(). But calculate() is a const
> function, so I can't really do that. What do you
> think
> I should do?
> "
>
> If you need some local data, then declare it mutable
> (=never const),
> this overrides the const in calculate().  Use with
> care:
>
http://www.highprogrammer.com/alan/rants/mutable.html
> This is done elsewhere in QL.
>
> Regards,
> Chris
>
> >
-------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
>
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace>
_______________________________________________
> QuantLib-dev mailing list
> [hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

gjrgarchmodel.cpp (10K) Download Attachment
gjrgarchprocess.cpp (11K) Download Attachment
gjrgarchprocess.hpp (5K) Download Attachment
analyticgjrgarchengine.cpp (13K) Download Attachment
analyticgjrgarchengine.hpp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Yee Man Chan

Any updates to the status of my GJR-GARCH
contribution? I haven't heard anything for a week.

Thanks
Yee Man

--- Yee Man Chan <[hidden email]> wrote:

>
> Hi Chris
>
>    Thanks for your hint. I added the code to re-use
> intermediate results in the analytic GJR-GARCH
> engine.
>
>    I also fixed a bug in gjrgarchprocess.
>
>    Please update my previously sent files with these
> five attached files
>
> Attached files:
> test-suite/gjrgarchmodel.cpp
> ql/processes/gjrgarchprocess.hpp
> ql/processes/gjrgarchprocess.cpp
> ql/pricingengines/vanilla/analyticgjrgarchengine.hpp
> ql/pricingengines/vanilla/analyticgjrgarchengine.cpp
>
> Yee Man
>
> --- Chris Kenyon <[hidden email]> wrote:
>
> >
> > Hi,
> >
> > re:
> > "
> >     I can speed it up quite a bit if I can re-use
> > some
> > intermediate results when some parameters are the
> > same. But this requires me to introduce some data
> > members to AnalyticGJRGARCHengine and assign
> values
> > to
> > them during calculate(). But calculate() is a
> const
> > function, so I can't really do that. What do you
> > think
> > I should do?
> > "
> >
> > If you need some local data, then declare it
> mutable
> > (=never const),
> > this overrides the const in calculate().  Use with
> > care:
> >
>
http://www.highprogrammer.com/alan/rants/mutable.html
> > This is done elsewhere in QL.
> >
> > Regards,
> > Chris
> >
> > >
>
-------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> >
>
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace>
> _______________________________________________
> > QuantLib-dev mailing list
> > [hidden email]
> >
>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
> >
>
>
>      
>
____________________________________________________________________________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
-------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
>
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace>
_______________________________________________
> QuantLib-dev mailing list
> [hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>



      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: GJR-GARCH option pricing engine

Luigi Ballabio

On Apr 4, 2008, at 9:04 PM, Yee Man Chan wrote:
> Any updates to the status of my GJR-GARCH
> contribution? I haven't heard anything for a week.

Yee Man,
        sorry---I've been busy this week. I'll try and put it in shortly.

Luigi



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev