Financial Python

Studies in Finance and Python

Archive for December 2009

Top 5 Posts

leave a comment »

I just noticed I passed 100 posts a little while ago. Small potatoes in comparison to the geometrically increasing data puking contest that is the Internet. Nevertheless, as we close out 2009, I thought it would be interesting to review the top five posts:

1) Delta and Mark-to-Market. A brief explanation of corporate synthetic tranche value sensitivity to the underlying portfolio.
2) Use your.flowingdata.com…for the children. Track your baby's sleep schedule (and pretty much anything else) via Twitter.
3) Sqlite and Sqlalchemy. An example of using python and a popular object-relational mapper.
4) Using Google Apps Python Provisioning API. An example of pulling user data via the python API and writing it to excel.
5) Use python and sqlite3 to build a database. A quick intro to python's sqlite3 module.

The "best of the rest":

It's been an interesting year. While most of my posts are derived from Interweb tidbits I find interesting, my original posts were much more popular (according to the admittedly crude Posterous stats). I have no ambitions for this blog, but I hope some of the factoids featured here have helped you or at least offered some entertainment. Best wishes for 2010!

Written by DK

December 29, 2009 at 12:58 am

Posted in Finance

This Time It’s Different

leave a comment »

I was looking up Reinhart and Rogoff's book, This Time It's Different, on Amazon and the following results appeared:

Awesome…

Written by DK

December 21, 2009 at 4:53 pm

Posted in Finance

Gamma, Delta, and Mark-to-Market

leave a comment »

I've gotten a few questions about gamma vs. delta as it relates to tranches (partially in reaction to an old post), so I thought I'd post my response here.

As I mentioned in "Delta and Mark-to-Market," one way to describe tranche risk is in terms of delta:

The delta of a tranche describes the leverage of a tranche relative to the underlying portfolio. So if a given tranche has a delta of 3x, a one dollar swing in the underlying portfolio should result in a roughly $3 dollar swing in the value of the tranche.

So, in the correlation market, one can "delta-hedge" spread risk by buying/selling the underlying index against the tranche. Given the example above, if I sold $10m in tranche protection and wanted to delta-hedge, I would buy 3x notional (or $30m) index protection. Theoretically speaking, this hedged position is now immunized against spread movement but still exposed to correlation risk.

As I also mentioned in that older post, however, tranches gain and lose delta depending on the expected loss of the underlying index. If the expected loss of the index is moving toward the attachment/detachment point of the tranche, the tranche gains delta. If expected loss is moving away from the attachment/detachment point, the tranche is losing delta.

This change in delta is sometimes called gamma risk. A position that is "long gamma" typically benefits from market volatility. The easiest way to explain this is to examine a hedged position. Let's examine a delta-hedged equity tranche position, where one sells equity tranche protection and buys index protection. Back when spreads were low, the equity tranche exhibited deltas on the order of 15x. So for the sake of argument (meaning the numbers that follow are completely made up but are directionally accurate), you'd sell $1 million in equity protection and buy $15 million in index protection.

Now, let's assume the index spread increases such that the equity tranche delta has fallen to 10x. As a result, your delta-hedged position is now over-hedged, in the sense that you own 15x delta but only need 10x. So you can now sell your excess $5 million in index protection at a profit (since you bought protection and spreads are higher). As a result, you've experienced a mark-to-market loss on your equity tranche, but made money on your hedge. Now let's assume spreads fall again, such that your delta increases to 18x. You now buy more index protection to reset your hedge. If this process repeats itself over time, with spreads oscillating back and forth, you'll make money on your hedge by "buying low and selling high" due to the change in delta. This is an example of a "long gamma" position that benefits from market volatility. There

Keep in mind that the numbers in the example above are pretty crude and not representative of what you'd see in current markets. Nevertheless, the basic mechanics should provide some decent intuition.

Written by DK

December 6, 2009 at 9:52 pm

Posted in Finance

Mint on Unemployment

leave a comment »

Written by DK

December 4, 2009 at 2:23 pm

Posted in Finance