Financial Python

Studies in Finance and Python

Archive for June 2009

Python Gmail Script

leave a comment »

Click here to download:

emailscriptexample.py (1 KB)

Sorry, forgot to attach the code for the previous post. Here it is.

Mirror at NotesToSelf

Advertisements

Written by DK

June 13, 2009 at 8:42 pm

Posted in Python

Tagged with ,

Sending Gmail with Automator and Python

with one comment

I wanted to automate some reminder emails I send out every week (because I always forget to send them), and thought I’d give Automator a try. The experience wasn’t that great. It launches OS X’s Mail application and, for whatever reason, doesn’t send anything. The message just sits in the Outbox. I think it’s a known bug in Automator, but it was sort of a letdown for something as simple as auto-sending email.

So instead, I adapted a short python script that sends email via the smtplib and email modules, and used Automator to run the script via an iCal plug-in (File>Save As Plugin). Creating a plugin creates an Automator calendar in iCal where your scheduled script resides. All you have to do is set the timing. I know the command-line folks probably use cron to schedule scripts like this, but I like seeing the scheduled script on my calendar. I also like the script approach because I don’t have to launch any other applications (e.g., Mail). The script also works for those of you using google apps (just use your google apps email address).

Mirror at NotesToSelf

Written by DK

June 13, 2009 at 8:20 pm

Posted in Python

Tagged with , ,

Run Your Own Stress Test

leave a comment »

This impressive spreadsheet by RortyBomb is making the rounds. It attempts to approximate the banking stress tests applied by the Treasury and allows you to make your own assumptions. He recognizes many of the obvious objections to his methodology, but it’s all very transparent, so I don’t see how you can fault him for anything. Man, that guy is smart AND funny. What the heck?

Written by DK

June 11, 2009 at 9:14 pm

Posted in Finance

Tagged with

Finance Primer Round-Up

leave a comment »

Here’s a round-up of some “primer” posts I’ve either written or linked, for convenient reference.

“Yet Another CDO Primer” Videos:

Ep 1: Basic Intuition

Ep 2: Economic motivations and PPIP

Posts:
Delta and Mark-to-Market. This has been NoteToSelf’s most popular post, by far. It explains the basic intuition behind expected loss and delta for synthetic tranches.

Fixed Coupon is the same as CDX. The “Big Bang” made for standardization of CDS coupons. Not a big deal if you understand how the CDX index works (explained in the post).

My Liability Is Your Asset. An initial reaction to Simon Johnson’s piece in the Atlantic. A bit of a ramble.

Mark To Market vs. Mark To Model. A link to Rortybomb’s explanation of this concept.

Financial Crisis for Beginners. A link to Baseline Scenario’s mega-link page of helpful articles on the current crisis.

Written by DK

June 11, 2009 at 9:10 pm

Posted in Finance

Tagged with , , , , ,

DTCC CDS Data

leave a comment »

I called DTCC many months ago asking whether they were planning on creating a feed of their CDS/Tranche data (they currently only offer weekly snapshots). The answer was something like, “We’ve been getting lots of requests, and we are planning to roll out something in the next few weeks that will allow users to download historical data.” Well, that was back in 2008. And as I understand it, the previous week’s data goes up in smoke when the new data comes arrives. I should know better. Anyway, Zero Hedge captures the weekly information caveman-style (he is promising more coverage of DTCC too, thank you very much), but c’mon DTCC! Can’t we get this data onto the website or get the FreeRisk guys to spider this stuff into a database someplace?

**End pout.**

Written by DK

June 10, 2009 at 9:24 pm

Posted in Finance

Tagged with ,

YACP: Episode 2

leave a comment »

My second installment of “Yet Another CDO Primer” is up after a long hiatus of tech watching (I’m looking at you Google Wave). It explains why lenders and investors liked CDOs in the first place and shows how PPIP is basically a CDO structure. It builds on the first episode, so if you are completely new to finance, you might want to watch that first. Enjoy!

Written by DK

June 10, 2009 at 9:10 pm

Posted in Finance

Tagged with ,