Saturday, September 26, 2009

Caplet stripping first go...



Today I needed to fix Caplet vols from Caps. Previously I have had troubles getting the reverse problem stable. Now I got the idea to fix the interest yield curve using another set of input instruments and blend them in another way.




Original data is CAP broker data. Looks as if it has been numerically modelled from a SABR or something. But anyway.








Using some caplet stripping trixs the caplets turn out pretty ok. But why should the original data be perfectly smooth but not the underlying caplets? Shouldn't the original data just be an integral over the caplet data?
Hmm, anyway. Well see when we use the model for repricing. Hopefully someone will react if it's too far off.
This reminds me that I need to fix a better data object structure to contain the original data. It took way to many lines of code to get it up and running. Need also to ensure it stays stable ... also for the Nordic market. Perhaps a more robust inverter i needed as well.
All for now.

Thursday, September 24, 2009

Uselessness of div yields

Tried to figure out how to calculate implied volatilities for a complete index surface today. Didn't come out to well...

Since I didn't have discrete dividends for all the constituents for the underlyings, I tried to use a continous dividend yield. That does not work ... of course. From where to where should the div yield span?

Tomorrow it's time for a redefinition and a hunt for a daily update of the index constituents. Perhaps it's possible to back a relevant and approximate div yield from the futures market. I'll try that as well.

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 ...

Sunday, September 13, 2009

Some realtime issues ...

I need some speed.
Below is the code needed to calulate any equity index in realtime. The only pre-requisite is to have a curve defined with the constituents and a vector of shares in the index as well. (And also the divisor of course).

out number calc_index(curve_name cn, date d, string num_share_tag, quote_side q){

curve idx_c = curve(cn, d, q);
number index_divisor = get_tag_num('index_divisor', cn, d);
vector(string) i = idx_c.instruments().name();
vector(number) w = get_tag_num(num_share_tag, i, d);

return w*instrument(i,d,q).quote()/index_divisor;
}

Any time a new price quote comes in the code will excecute and calculate the index value again. The code can still be optimized further though. I will do that later.