Displaying asymmetric data / Integrating QuantLib and python

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

Displaying asymmetric data / Integrating QuantLib and python

Joseph Wang-2
I'm starting to get "hello world" results with mayavi.  I was able to
calculate option prices in QuantLib and plot the surfaces using tvtk.

A few questions:

1) I'm trying to do a three dimension plot in which the x, y, z axes are not
symmetric (i.e. x and y are percentages and z is in dollars).   What is the
easiest way of doing that.

2) I'm using vectorize to vectorize a python function that makes a call to
C++.  However it doesn't seem to have function attributes available.  
Thoughts on how to do that?

3) I'd like to make the impedance mismatch between things like QuantLib arrays
and numpy arrays as seemless as possible.  Any words of wisdom on how to do
this?

4) The thought occurs that we can get pretty nice interactivity by somehow
using Python traits with the QuantLib quote object.  Python traits (which
have nothing to do with C++ traits) are extended attributes of a python
object which can be connected to a UI and take care of things like
notification processing.   The QuantLib quote object is a container for a
quantity that could change.  

The idea would be to somehow wrapper the Quote object with Python traits,
which would allow one to interactively control things like interest rates and
see how that affects surfaces.

I should have more neat plots in the next week or so.


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





-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Enthought-dev] Displaying asymmetric data / Integrating QuantLib and python

Prabhu Ramachandran-2
>>>>> "Joseph" == Joseph Wang <[hidden email]> writes:

    Joseph> 1) I'm trying to do a three dimension plot in which the x,
    Joseph> y, z axes are not symmetric (i.e. x and y are percentages
    Joseph> and z is in dollars).  What is the easiest way of doing
    Joseph> that.

Not sure how that works.  VTK is unit agnostic AFAICT.  You can change
the axes labels to reflect the units but thats the best *I* can think
of.  You could rescale the data or any actors you view or transform
the input data to scale things.  You can lie about the text that your
axes show etc.  So there is usually a way to do what you are looking
to do.  The best way is really domain dependent.

    Joseph> 2) I'm using vectorize to vectorize a python function that
    Joseph> makes a call to C++.  However it doesn't seem to have
    Joseph> function attributes available.  Thoughts on how to do
    Joseph> that?

No idea.  That is a numpy question.  Are you saying that your
vectorized function does not have function attributes available or
that your wrapped c++ function does not?

    Joseph> 3) I'd like to make the impedance mismatch between things
    Joseph> like QuantLib arrays and numpy arrays as seemless as
    Joseph> possible.  Any words of wisdom on how to do this?

I don't know anything about QuantLib arrays so will shoot in the dark
here.  If your arrays can take or provide a block of contiguous memory
that is interpreted according to a particular data type then I think
it is easily possible to get these two array types talking to each
other.  However doing this right and optimally will take a bit of
effort (I've done this for tvtk which lets VTK and numpy arrays talk
to each other seamlessly).  I think there is a fair bit of
documentation on the scipy wiki on the various ways to do this right.
The scipy-user list is a good place to ask for pointers since the
folks who actually develop numpy and do all sorts of things with numpy
arrays are on that list and will be happy to answer questions.

    Joseph> 4) The thought occurs that we can get pretty nice
    Joseph> interactivity by somehow using Python traits with the
    Joseph> QuantLib quote object.  Python traits (which have nothing
    Joseph> to do with C++ traits) are extended attributes of a python
    Joseph> object which can be connected to a UI and take care of
    Joseph> things like notification processing.  The QuantLib quote
    Joseph> object is a container for a quantity that could change.

    Joseph> The idea would be to somehow wrapper the Quote object with
    Joseph> Python traits, which would allow one to interactively
    Joseph> control things like interest rates and see how that
    Joseph> affects surfaces.

Yes, in fact tvtk does just this.  It wraps *all* of VTK with a fancy
traits interface.  This is documented in tvtk/doc/README.txt and the
actual business of how this is automatically done for ~900 VTK classes
is documented in the devel.txt in the same directory.

HTH.
cheers,
prabhu

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev