Hi,
I'm a newbie to the QuantLib library (but have been a quant for several years) and really like most of the QuantLib structure but have a particular suggestion that would make the library much more usable from an integration & system development perspective.
The library is currently devised (from what I've seen) s.t. the market data is given to the model or instrument as a specific type or set of types. So, the ubiquitous IR swap is given a specific YieldTermStructure, the Black model is given a vol & discount rate etc. I term this pattern the PUSH method. In it, the business/quant knowledge specific to the model is split between the model code (where the data is used) and the calling code (where the data is constructed and allocated to the model.
The benefit of this method is simplicity and the easy ability to follow the dependencies of a given price.
However, for system development and more complicated products, I much prefer the PULL method. In this pattern, a generic market data collection object is passed to the model and the model itself determines which specific data is required for pricing.
I'll just outline some of the benefits of this approach:
1) The information on the types of market data that are required is concentrated in a single place - the model code. There is no need for a calling system to have code specific to this.
2) It is simple to switch between market data environments - instead of having to update the handles to every bit of market data, you simply update the handle to the market data collection object. Then all instruments can be re-priced with no need to recreate the models.
3) You don't - necessarily - have to create a model externally. If you specify a default model type for a given instrument, the model can be constructed internally (the model spec is retrieved from the market data collection object). This can be very handy when switching between two different models in a system as the interface stays the same,
e.g. the release cycle of the calling system(s) does not have to be synchronised to the library and switching models becomes trivial.
4) For more complicated instruments, you might have an option which can be exercised into 2 or more derivatives. Instead of creating a model which contains a model (or more than one), each of which requires specific market data, you can simply let the default model be used for each of the underlying derivatives.
5) Developing models becomes simpler. If you need another argument/parameter, you simply register a value or object against the market data collection object and retrieve it internally from the market data collection object - no need to change the interface.
Has anyone had this discussion in the past? I've read through all the documentation I could find and read no mention of this. Perhaps I've been remiss and this is all explained somewhere. Or perhaps there is another project specifically for this.
I believe this could be implemented in a simple manner, in addition to the current interface.
It would require an additional constructor for all instruments/models (stoch processes) that supported this facility. It would also require additional descriptive variables within those models (so that the model knows which yieldcurve or which vol surface is needed). We'd also need some small additions to allow a change in the market data object (pointing to a new set of market data) to be passed onto the specific yieldcurves, vols etc. However, there would be no compulsion to use this new facility and no change to anyones existing calling conventions. It could be introduced slowly - no existing instrument or model would HAVE to support this type of access.
I'd be prepared to do the necessary work for this. I've developed in libraries that allow this facility before. Usually the only tricky part is determining the descriptive variables. For example, a model requires a EUR yieldcurve - but which one? EUR Libor or Euribor? Do we require a discounting curve or a forwarding curve?
Does anyone have any objections? Or any additions / comments or questions? I seriously believe that this would add substantial value to the project. Regards,
Simon
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Fri, 2007-09-28 at 10:12 +0100, Simon Ibbotson wrote:
> The library is currently devised (from what I've seen) s.t. the market > data is given to the model or instrument as a specific type or set of > types. [...] I term this pattern the PUSH method. In it, the > business/quant knowledge specific to the model is split between the > model code (where the data is used) and the calling code (where the > data is constructed and allocated to the model. > > However, for system development and more complicated products, I much > prefer the PULL method. In this pattern, a generic market data > collection object is passed to the model and the model itself > determines which specific data is required for pricing. Simon, interesting idea. However, I'm not sure that I'd jump into it right now---I'm aiming for a 0.9.0 release by the end of the year and a 1.0 release shortly afterwards, with a couple of refactoring and some maintenance work to be done before that. In order to deliver the releases, I'd keep your idea for later. Since, as you said, it's an incremental modification (an instrument might implement both approaches, right?) it can be introduced in later releases without breaking backward compatibility (which we'll have to think about after we release 1.0) This said, I repeat: interesting idea. Why don't you sketch the implementation of one instrument so that we can go into details? Later, Luigi -- I hate quotations. -- Ralph Waldo Emerson ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Okay, here's my first stab at sketching the implementation, I've attached a file showing the basic draft of the pattern.
There are several classes outlined - I've tried to follow the basic structure of QuantLib and derived from the basic classes... if I've broken a pattern irreparably, let me know.
The Termsheet class (deliberately left opaque), which supplies cashflows/payoff for the Instrument and information to resolve the market data. The Instrument derived class which holds the payoff and cashflow arguments for the PricingEngine.
The PricingEnvironment which supplies the StochasticProcess and PricingEngine for the Instrument and the MarketDataCollection for the StochasticProcess.
The StochasticProcess derived object, which determines the type of market data required.
The MarketDataCollection class, which supplies the specific market data objects.
This is idealised, there may be cases where the Instrument does not require a StochasticProcess or PricingEngine and should simply get the required market data from the PricingEnvironment itself.
All comments are welcome,
Simon
On 10/3/07, Luigi Ballabio <[hidden email]> wrote:
On Fri, 2007-09-28 at 10:12 +0100, Simon Ibbotson wrote: ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hmm, would have been useful if I'd attached the file...
On 10/8/07, Simon Ibbotson <[hidden email]> wrote:
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev ExampleInterface.h (10K) Download Attachment |
Free forum by Nabble | Edit this page |