Friday, April 13, 2012

Curve fitting with Hyman monotonicity preserved

 In finance, a common problem is how to create sufficiently smooth curves for pricing, hedging and risk management. This is typically a problem when creating exact fit to interest rate curves. From the exact fit you often want smooth forward curves of different kinds. Having an extensive collection of interpolators certainly help.

Below is an example of arbitary points and various interpolations. Most interpolations come from the Hermite polynome family, but also cubic spline is there for reference. Clearly when two points are close but on different levels the choice of model will affect the results.



A neat trick found in the latest version of Quantlab 3.1 is to apply a Hyman monotonicty and sign revalsal filter to any of the interpolators used. The Hyman filter preserves the exact fit at the expense of the smoothness in the the bends. But it is still not a linear function ...


For more on financial bootstrap interpolation see link to dual bootstrap example

Thursday, October 6, 2011

This is a very sad day.
Coming to work this morning, I find news of the death of my engineering icon. I never had the chance to work with Steve Jobs but I certainly enjoyed using all his toys. Engineering is about simplifying life for people, either for fun or used for a deeper purpose. Technology development is not successful unless it comes to use. Apple took this a step further, creating a technological religion, having people loving their products. Few companies have products with that glow. It is often said that no person is irreplaceable. Steve Jobs certainly is an exception to that rule.

Some of the magic is gone. Now Apple is just a tech company again.

Quantlab doesn't run on iPad yet. Now I'm not sure it ever will...

Tuesday, September 20, 2011

Someone said the correlation had gone up?


There has been quite a frequent debate surrounding correlations between markets. When you look at end-of-day quotes, the correlation has certainly gone up. But what about intra-day? Well most days actually you can't spot the difference between markets.
Here you see the intra-day chart for Stockholm, Helsinki, Copenhagen and Oslo. It's not the entire business day but the message is clear...
There must certainly be a number of HFT robots keeping these markets in line. Sure, some stocks and business have similarities, and yes there all Nordic region, but this has nothing to do with what you are actually buying or selling. It's just a spread game... or something.

Thursday, April 28, 2011

Creating a monthly series from daily data

Today I came across the issue of converting a daily time-series to display and calculate only on end-of-month data.
Turns out that a series type cannot display the month, number combo directly in my workspace so a little workaround is needed.
In this example I start with a from and to date, in date format. Then we extract the starting month and end month for the series. Then we fill the series object with monthly data (using the move_bus_days to get the last business day of each month.
Lastly we want to plot the data so we fill the non-equidistant pair of dates and numbers in a vector of point date so that it can be displayed in a graph.
Problem solved:

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