New Basket Option Code and question about StochasticProcessArray

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

New Basket Option Code and question about StochasticProcessArray

Joseph Wang-2
Thanks to everyone that sent me code and pointers.

I did a backward compatible refactoring of the basket option code that makes
it relatively easy to add new types of basket options.  Instead of using a
enum to define the basket option, the code now allows you to subclass
BasketOptionType which contains code on how to calculate the price of that
option.  There are now AverageBasketOptionType, MinBasketOptionType, and
MaxBasketOptionType, and by moving the option calculation code out of the
engines, any new basket options can be calculated automatically by the monte
carlo code.

I'm now in the process of putting together some swig wrappers for all of this.

I do have a question about StochasticProcessArray.  Right now you have to
define a vector of StochasticProcesses and then put that into the constructor
of the array.  Would it be better to add a "push_back" method to the
StochasticProcessArray so that you create an array object and then insert
processes to it?

--
-------------------------------------------------------------------------------
Joseph Wang Ph.D. - [hidden email]  
China Derivatives Researcher and Software Developer - QuantLib
http://en.wikiversity.org/wiki/User:Roadrunner





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: New Basket Option Code and question about StochasticProcessArray

Luigi Ballabio
On Thu, 2007-03-08 at 11:20 -0600, Joseph Wang wrote:
> I did a backward compatible refactoring of the basket option code that makes
> it relatively easy to add new types of basket options.  Instead of using a
> enum to define the basket option, the code now allows you to subclass
> BasketOptionType which contains code on how to calculate the price of that
> option.  There are now AverageBasketOptionType, MinBasketOptionType, and
> MaxBasketOptionType, and by moving the option calculation code out of the
> engines, any new basket options can be calculated automatically by the monte
> carlo code.

Joe,
        first of all, thanks for the effort---I've meant to do something of the
sort for a long time but never got around to implement it.
Just for clarity though, I'd call the base class BasketOptionPayoff
(same for the children.) Since next release's purpose will be to get
closer to release 1.0 (more on this later) we're not much concerned with
backward compatibility at this time---in fact, we're trying to change a
number of things that seemed right at some time, that we wanted to
change after a while, but that weren't easy to change while maintaining
backward compatibility.

We'll care again for compatibility starting with the release after this
one.


> I'm now in the process of putting together some swig wrappers for all of this.
>
> I do have a question about StochasticProcessArray.  Right now you have to
> define a vector of StochasticProcesses and then put that into the constructor
> of the array.  Would it be better to add a "push_back" method to the
> StochasticProcessArray so that you create an array object and then insert
> processes to it?

My 2 cents are that I'd like to keep objects as immutable as possible.
For instance, I wouldn't like the possibility to add processes to a
StochasticProcessArray _after_ it has been passed to an instrument.

Later,
        Luigi


----------------------------------------

Brady's First Law of Problem Solving:
When confronted by a difficult problem, you can solve it more
easily by reducing it to the question, "How would the Lone
Ranger have handled this?"



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: New Basket Option Code and question about StochasticProcessArray

Joseph Wang-2
I did some more refactoring of the Basket options.  Now it takes a
BasketPayoff class.  The BasketPayoff class takes another payoff class and
then wrappers it with basket information.  This makes the system extensible
to non-vanilla payoffs, and the engines use dynamic pointer casting to figure
out what it can process.

One interesting extension would be to allow one to composite payoffs.  Have a
payoff class that consists of a linear combination of payoff classes.  
Another interesting possibility is to hack the SWIG code to allow definition
of payoff functions in the scripting language.  The hard part is to figure
out how to avoid duplicating code with the cost functions.

On Monday 12 March 2007 12:51:31 Luigi Ballabio wrote:

> Joe,
> first of all, thanks for the effort---I've meant to do something of the
> sort for a long time but never got around to implement it.
> Just for clarity though, I'd call the base class BasketOptionPayoff
> (same for the children.) Since next release's purpose will be to get
> closer to release 1.0 (more on this later) we're not much concerned with
> backward compatibility at this time---in fact, we're trying to change a
> number of things that seemed right at some time, that we wanted to
> change after a while, but that weren't easy to change while maintaining
> backward compatibility.

--
-------------------------------------------------------------------------------
Joseph Wang Ph.D. - [hidden email]  
China Derivatives Researcher and Software Developer - QuantLib
http://en.wikiversity.org/wiki/User:Roadrunner





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev