extending instrument question

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

extending instrument question

japari
The library is pricing oriented, ok; but say I want to use Instruments for other things like mitigation, c.v.a, etc... So I need to ask an instrument for something else. I have tried some solutions which are not very neat, decorating them, abusing the PricingEngine concepts for other things than pricing, etc... Also wondered if all instruments were visitable would it allow one to do this?
Is anyone else in this situation? and whats the correct way to do it?
Thanks
Pepe

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: extending instrument question

Luigi Ballabio
Hi Pepe,
    in the short term I'd abuse the pricing engine.  Not that it's
much of an abuse.
For the long term, I'm not sure, but then again I think I haven't
grasped the problem yet.  Do you have a use case you can share?

Luigi

P.S. Not sure about the visitor pattern.  It would require your
visitor to specialize for all instruments, giving lots of coupling in
a single class.


On Wed, Feb 22, 2012 at 9:51 AM,  <[hidden email]> wrote:

> The library is pricing oriented, ok; but say I want to use Instruments for other things like mitigation, c.v.a, etc... So I need to ask an instrument for something else. I have tried some solutions which are not very neat, decorating them, abusing the PricingEngine concepts for other things than pricing, etc... Also wondered if all instruments were visitable would it allow one to do this?
> Is anyone else in this situation? and whats the correct way to do it?
> Thanks
> Pepe
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: extending instrument question

Roland Lichters-2
Hi Pepe,
I also went down that road decorating the instrument and extending the pricing engines to provide things like cva of pfe. That works fine e.g. for single-trade cva, but does not work so well when you have to deal with portfolios (and netting requires cva/pfe calculation for portfolios of trades). Then you need to either map a portfolio to a flexible instrument or take a different approach where cva/pfe is produced by some portfolio analytics tool. The latter can be made quite generic and scalable, the former is perfect for single deals, so I am using both.
Hope this helps!
Regards,
Roland

> Hi Pepe,
>    in the short term I'd abuse the pricing engine.  Not that it's
> much of an abuse.
> For the long term, I'm not sure, but then again I think I haven't
> grasped the problem yet.  Do you have a use case you can share?
>
> Luigi
>
> P.S. Not sure about the visitor pattern.  It would require your
> visitor to specialize for all instruments, giving lots of coupling in
> a single class.
>
>
> On Wed, Feb 22, 2012 at 9:51 AM,  <[hidden email]> wrote:
>> The library is pricing oriented, ok; but say I want to use Instruments for other things like mitigation, c.v.a, etc... So I need to ask an instrument for something else. I have tried some solutions which are not very neat, decorating them, abusing the PricingEngine concepts for other things than pricing, etc... Also wondered if all instruments were visitable would it allow one to do this?
>> Is anyone else in this situation? and whats the correct way to do it?
>> Thanks
>> Pepe
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: extending instrument question

japari
Hi guys,
Good idea to "price" a portfolio-instrument directly.
My particular context is that I have to optimize a potential exposure mitigation portfolio and, to avoid recomputing the MC, I separate the mitigation portfolio; (assuming theres no counterparty risk added by the instruments in that portfolio) and try to solve:
 Max ( Value(portfolio, mitigationPortfl) )
So I travel along the hedge like:
 mitigationPortfl[i]->exposureMitigation(t, portfolio, ...)
This would correspond to the second case you mention.
And 'exposureMitigation' changes with the context rules (pricing, risk) and 'Value' can be on EPE, PFE, EL, or a loss quantile.
So those would be different 'engines' (or I was wondering).

This one and other situations are very close to a pricing engine, I try to do it with the minimum modifications to the instrument, or no more than what is needed to expose the arguments. Also I cant have more than one 'engine' active because of Lazyness; so if I mitigate (or whatever else) I lose, say, the NPV

Regards
Pepe

----- Mail original -----
De: "Roland Lichters" <[hidden email]>
À: [hidden email], "Luigi Ballabio" <[hidden email]>
Cc: [hidden email]
Envoyé: Jeudi 1 Mars 2012 14:42:03
Objet: Re: [Quantlib-users] extending instrument question

Hi Pepe,
I also went down that road decorating the instrument and extending the pricing engines to provide things like cva of pfe. That works fine e.g. for single-trade cva, but does not work so well when you have to deal with portfolios (and netting requires cva/pfe calculation for portfolios of trades). Then you need to either map a portfolio to a flexible instrument or take a different approach where cva/pfe is produced by some portfolio analytics tool. The latter can be made quite generic and scalable, the former is perfect for single deals, so I am using both.
Hope this helps!
Regards,
Roland

> Hi Pepe,
>    in the short term I'd abuse the pricing engine.  Not that it's
> much of an abuse.
> For the long term, I'm not sure, but then again I think I haven't
> grasped the problem yet.  Do you have a use case you can share?
>
> Luigi
>
> P.S. Not sure about the visitor pattern.  It would require your
> visitor to specialize for all instruments, giving lots of coupling in
> a single class.
>
>
> On Wed, Feb 22, 2012 at 9:51 AM,  <[hidden email]> wrote:
>> The library is pricing oriented, ok; but say I want to use Instruments for other things like mitigation, c.v.a, etc... So I need to ask an instrument for something else. I have tried some solutions which are not very neat, decorating them, abusing the PricingEngine concepts for other things than pricing, etc... Also wondered if all instruments were visitable would it allow one to do this?
>> Is anyone else in this situation? and whats the correct way to do it?
>> Thanks
>> Pepe
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users