QuantlibXL objects question

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

QuantlibXL objects question

Denny D
Hi,

I took the sample QuantlibXL spreadsheet (options.xls)
and plugged a real-time feed into one of the cells. I
see that objects created with
qlGeneralizedBlackScholesProcess and qlVanillaOption
keep changing numbers (...#0000 ...#0001 ...#0002
etc)every time I receive a quote. Does this mean that
every time I update the price of the underlying
QuantlibXL creates a new set of objects? If so, what
is the correct way to use functions in real-time
application.

Also, what is the meaning of "any permanent" in the
documentation? It is the last argument for every
function in QuantlibXL.

Thank you in advance!
Denny

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 


Reply | Threaded
Open this post in threaded view
|

Re: QuantlibXL objects question

eric ehlers
Hi Denny

On 10/2/06, Denny D <[hidden email]> wrote:
> QuantlibXL creates a new set of objects? If so, what
> is the correct way to use functions in real-time
> application.

You can set calculation to manual, and then recalculate only when you
need a price e.g. by hitting F2 on the cell containing the instrument.

In some cases you can exploit QuantLib's "Observer/Observable"
mechanism to facilitate updates within the QL code, behind the scenes
of Excel's dependency tree.

For example a YieldTermStructure observes its RateHelpers such that
when you query the YTS it first checks whether any of its RateHelpers
have changed.  So you can:
- create a sheet to instantiate the RateHelper objects, then close it
- create a sheet to receive the live data feed, updating the existing
RHs non-destructively by calling their setQuote methods.  Keep this
sheet open.
- create a sheet to instantiate the YTS, then close it

With the above environment, the sheets which instantiated the RHs and
YTS are closed, meaning that Excel cannot force recalulation of those
cells.  Only the data feed is active, updating the state of the RHs
non-destructively.  Because of QL's Observer/Observable pattern,
changes in the state of the RHs are reflected in that of the YTS,
invisible to Excel and without triggering the recalculation of any
cells.

Now you can create a sheet to price an instrument based on the YTS.

In order for the above technique to work, QLXL supports a feature
whereby you can use a raw string to reference an object which resides
on a sheet that has been closed.  For example if the YTS lives in
'book1.xls[sheet1]:A1', normally the instrument would simply hold a
reference to that cell; instead the instrument can refer to the object
by its ID e.g. "my_YTS".  The object will be retrieved from the
ObjectHandler repository, even though the sheet which instantiated the
object is closed.

The above technique for referencing objects circumvents Excel's
dependency tree so sometimes you need to use the trigger parameters to
force dependencies that Excel would otherwise not know about.

> Also, what is the meaning of "any permanent" in the
> documentation? It is the last argument for every
> function in QuantlibXL.

It's the last argument for every constructor.  "any" is the datatype
of the argument, and "permanent" is its name.  It's a flag which
indicates whether the object is to be permanent or not.  It's a
boolean but is implemented as "any" so that it can be omitted (default
= false).

Permanent objects are not deleted by function ohDeleteAllObjects,
allowing finer granularity in managing the objects in the repository.
For example in the scenario described above, the YTS and RH objects
instantiated on closed books would be declared permanent, so that
ohDeleteAllObjects deletes only the objects that the user can see.

Regards,
Eric