Thursday, September 17, 2009

How to blend a depo fra swap curve

My daily little contribution to the world of finance (the Quantlab developer world that is) was a function to blend together a bank deposit curve with a forward rate agreement curve and at the end the interest rate swap curve.

Why, you might ask? Well the current release has only got the blending functions fra-prio and swap-prio so there was need for a "left-to-right prio" blend.

Here's how it goes:

curve blend_curves_depo_fra_prio(curve depo_c, curve fra_c, curve swap_c){

date chop_d;
curve short_c;
fra_c = fra_c.chop_short(v_max(depo_c.instruments().maturity()) + 1);
short_c = merge(depo_c, fra_c);
chop_d = v_max(short_c.instruments().maturity()) + 1;
swap_c = swap_c.chop_short(chop_d);

return merge(short_c, swap_c);
}

I also tried to figure out how to model personal behavior into a market risk model for retail loans today. Found myself a couple of Brain Twits short today. I'll give it a go tomorrow and let i mellow over the week-end. Perhaps Danish mortgage bond market can give some clues as how to do this ...

No comments:

Post a Comment