Basis-point sensitivity and such

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

Basis-point sensitivity and such

Luigi Ballabio-2
Hi Andre',
        I did some refactoring of basis-point sensitivity calculation  
and related classes. Could you check that everything works? (Or even  
better, add a test). Also, could you document a bit your BPS-basket  
calculation? For instance, why a subtraction in visit(FixedRateCoupon)  
instead of the addition in visit(Coupon)?

Warning: some interface has changed. In particular, I made the  
TimeBasket class a whole lot slimmer. However, I kept all its  
functionality---the differences are only in syntax, i.e.,instead of

basket.push(date,value);
basket.add(date,value);
basket.subtract(date,value);

one now writes

basket[date] = value;
basket[date] += value;
basket[date] -= value;

respectively, and instead of

for (Size i=0; i<basket.size(); i++) {
    Entry e = basket[i];
    Date d = e.date();
    double v = e.value();
    ...
}

one now writes

for (TimeBasket::iterator i=basket.begin(); i!=basket.end(); ++i) {
    Date d = i->first;
    double v = i->second;
    ...
}

Cheers,
        Luigi


Reply | Threaded
Open this post in threaded view
|

RE: Basis-point sensitivity and such

Andre Louw-2
Luigi wrote:
> I did some refactoring of basis-point sensitivity calculation  
> and related classes. Could you check that everything works? (Or even  
> better, add a test).

Will do

> Also, could you document a bit your BPS-basket  
> calculation? For instance, why a subtraction in
> visit(FixedRateCoupon) instead of the addition in visit(Coupon)?

I will try my best on the documentation. At the coupon level (fixed or not)
it should be simple addition, the subtraction would then happen in the
instrument, depending on which cashflow is payed vs. received. I will fix
this.

>
> Warning: some interface has changed. In particular, I made the  
> TimeBasket class a whole lot slimmer. However, I kept all its  
> functionality---the differences are only in syntax....

Great, I will have a look

Thanx
Andre