The derived class is a Vanilla Option on a Future and I need to specify the expiry of the underlying future which is in general different (later) than the expiry of the Vanilla Option. I have implemented a couple of
PricingEngine that derive from
VanillaOption::engine and for the moment their respective
calculate() methods assume that the expiry of the future coincides with the expiry of the option.
I plan to proceed as follows:
- Declare the derived class VanillaOptionFuture as follows:
class VanillaOptionFuture : public VanillaOption
- Define a new type of argument for this class as follows:
class VanillaOptionFuture::arguments : public VanillaOption::argumentsand add a new field called
- Redefine the method
VanillaOptionFuturein order to call the homonymous method of class
VanillaOptionplus setting the
futureExpiry_field of the arguments class, which will be passed to the constructor of the class.
Question: I would like to keep my pricing engines working for the general case of a
VanillaOption with the default behavior
futureExpiry_ = arguments_.exercise->lastDate(). I was thinking on leaving the declarations of my pricing engines as they are and just deal with the two cases directly in the
calculate() methods by using
boost::dynamic_pointer_cast. Do you think this is the right way to proceed? Thanks for any advice.