I just installed QL 0.3.1 and am just getting started
with it. My background is programming and trading, not ph.d.-level mathematics. I would like to use the lib to price american options primarily. Looks like the only direct support for american options is by using finite difference techniques (no binomial for american?) So, regarding fdAmericanOption, can someone please explain the timeSteps and gridPoints variables? FdAmericanOption( Option::Type type, double underlying, double strike, Spread dividendYield, Rate riskFreeRate, Time residualTime, double volatility, int timeSteps, // <-- how to use this?? int gridPoints // <-- how to use this?? ); I am interested in a pragmatic explanation, not a highly mathematical or theorectical one. The docs present the partial differential equations which does not help me because I don't understand them. The other question I have is about optimizing the use of the lib to price many options. If I want to price thousands of options, for example, holding everything constant and varying the underlying price in small increments, would I do this by instantiating a new option object with each new underlying price? For example: for (double under=x; under<y; under+=0.25) { fdAmericanOption option(...,under,...); ... = option.value() } Is that the _best_ way to rip many values out of the lib? tia wryboy __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |
hi wryboy,
I've tested that timeSteps=50 and gridPoints=50 are ok for american option. It corresponds to the discretization of the time and underlying value. You know when you represent a plan with x axis=time and y axis = underlying you can draw a grid if you divide x axis in 50 equally spaced intervals and the same for y axis. In one word, the higher is this value and the more accurate is your pricing. So timeSteps=500 and gridPoints=500 should give a better pricing than timeSteps=50 and gridPoints=50 but it's so small than you are going to lose performance for no advantage in term of pricing. If you need to price thousands of options (I did the same but with milions of options) I would also recommand an analytical approximation like Barone Adesi Whaley if performance is critical to you. I did the developpement in my Quantlib 0.3.0 and can share the code with you if you can help me to check it and test if there's no bug. Xavier Wry Boy <[hidden email]> Sent by: To: [hidden email] [hidden email] cc: eforge.net Subject: [Quantlib-users] Help with fdAmericanOption 09/04/2003 00:28 I just installed QL 0.3.1 and am just getting started with it. My background is programming and trading, not ph.d.-level mathematics. I would like to use the lib to price american options primarily. Looks like the only direct support for american options is by using finite difference techniques (no binomial for american?) So, regarding fdAmericanOption, can someone please explain the timeSteps and gridPoints variables? FdAmericanOption( Option::Type type, double underlying, double strike, Spread dividendYield, Rate riskFreeRate, Time residualTime, double volatility, int timeSteps, // <-- how to use this?? int gridPoints // <-- how to use this?? ); I am interested in a pragmatic explanation, not a highly mathematical or theorectical one. The docs present the partial differential equations which does not help me because I don't understand them. The other question I have is about optimizing the use of the lib to price many options. If I want to price thousands of options, for example, holding everything constant and varying the underlying price in small increments, would I do this by instantiating a new option object with each new underlying price? For example: for (double under=x; under<y; under+=0.25) { fdAmericanOption option(...,under,...); ... = option.value() } Is that the _best_ way to rip many values out of the lib? tia wryboy __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ Quantlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users ************************************************************************* Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. La Fimat et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither Fimat nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. ************************************************************************* |
In reply to this post by Wry Boy
At 03:28 PM 4/8/03 -0700, Wry Boy wrote:
>So, regarding fdAmericanOption, can someone please >explain the timeSteps and gridPoints variables? > >FdAmericanOption( > Option::Type type, > double underlying, > double strike, > Spread dividendYield, > Rate riskFreeRate, > Time residualTime, > double volatility, > int timeSteps, // <-- how to use this?? > int gridPoints // <-- how to use this?? >); > >I am interested in a pragmatic explanation, not a >highly mathematical or theorectical one. timeSteps is just, well, the number of time steps. If the option expires in one year, 365 time steps mean that you'll be observing it once every day. If it expires in 10 years, 120 time steps means you'll be observing it once a month. This is very much alike time discretization on trees. As for gridPoints; were you building a tree, it would be the number of nodes at the latest time. In finite differences, you'll have the same number at each time---which gives you a rectangular grid, as opposed to the somewhat triangular shape of trees. Be aware, though, that a bit of theory---not of at Ph.D. level---wouldn't hurt in order to know what's going on and what the gotchas are. The pricers in the library are stable enough, but if you want to roll your own, you'll have to know how to avoid shooting your own foot. >The other question I have is about optimizing the use >of the lib to price many options. If I want to price >thousands of options, for example, holding everything >constant and varying the underlying price in small >increments, would I do this by instantiating a new >option object with each new underlying price? For >example: > >for (double under=x; under<y; under+=0.25) { > > fdAmericanOption option(...,under,...); > ... = option.value() >} > >Is that the _best_ way to rip many values out of the >lib? Well, let's call it the current way. We're working on the best way. Or on a better one, at least. Bye, Luigi |
In reply to this post by Xavier.Abulker
OK i dusted off my old copy of Hull (2nd ed) and
poured over the chapter on finite differences. It seems to me that timeSteps should properly be a some sort of function of time remaining and gridpoints should be a function of expected volatility... For an option expiring in 1 year, sure, 365 for timesteps makes sense, but, for an option expiring in 2 months, does it make sense to cut up 60 days into 365 discrete time chunks? Following that line of reasoning through -- does it make sense to use days remaining as the timeSteps value and, if we do this, will the model converge properly to accurate prices as timesteps is reduced each day heading toward expiration? A similar argument for gridPoints. Don't you need to divide that axis up into chunks that approximate your volatility-based expectation of where the stock can move to in the time allotted? For example, if I expect no greater than a 10 point range on a stock over the next 2 months and I want to be able to price the american option in 0.25 (underlying) increments of that range, can I deduce that: gridPoints = 10 / 0.25 = 40, timeSteps = 60 (i.e. days remaining) Does this make any sense? Phil --- [hidden email] wrote: > > hi wryboy, > I've tested that timeSteps=50 and gridPoints=50 are > ok for american option. > It corresponds to the discretization of the time and > underlying value. > You know when you represent a plan with x axis=time > and y axis = underlying > you can draw a grid if you divide x axis in 50 > equally spaced intervals and > the same for y axis. > In one word, the higher is this value and the more > accurate is your > pricing. > So timeSteps=500 and gridPoints=500 should give a > better pricing than > timeSteps=50 and gridPoints=50 but it's so small > than you are going to lose > performance for no advantage in term of pricing. > > If you need to price thousands of options (I did the > same but with milions > of options) I would also recommand an analytical > approximation like Barone > Adesi Whaley if performance is critical to you. > I did the developpement in my Quantlib 0.3.0 and can > share the code with > you if you can help me to check it and test if > there's no bug. > > Xavier __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |
At 01:27 PM 4/9/03 -0700, Wry Boy wrote:
>OK i dusted off my old copy of Hull (2nd ed) and >poured over the chapter on finite differences. It >seems to me that timeSteps should properly be a some >sort of function of time remaining and gridpoints >should be a function of expected volatility... For an >option expiring in 1 year, sure, 365 for timesteps >makes sense, but, for an option expiring in 2 months, >does it make sense to cut up 60 days into 365 discrete >time chunks? And that is why it is a value you choose and pass to the pricer, rather than a fixed one :) >Following that line of reasoning through >-- does it make sense to use days remaining as the >timeSteps value and, if we do this, will the model >converge properly to accurate prices as timesteps is >reduced each day heading toward expiration? >A similar argument for gridPoints. Don't you need to >divide that axis up into chunks that approximate your >volatility-based expectation of where the stock can >move to in the time allotted? For example, if I >expect no greater than a 10 point range on a stock >over the next 2 months and I want to be able to price >the american option in 0.25 (underlying) increments of >that range, can I deduce that: > >gridPoints = 10 / 0.25 = 40, >timeSteps = 60 (i.e. days remaining) > >Does this make any sense? It does in general, although for my own peace of mind I would make a few tries---for instance, I would look at the results for 40x60, 80x120, and 160x240 and check if the calculated price varies too much for its own good. Calculations are fast enough to allow you to do that. Also, I think there are a few constraints in the implementation of the pricer. For instance, there's no place where you can *directly* input your intuition on the no-more-than-10-point range---if I remember correctly, the pricer will create itself a grid extending about four times sigma*sqrt(T) above and below the current log price, so you'll have to express your feeling through the value of the volatility. Bye, Luigi |
Free forum by Nabble | Edit this page |