Finance

F#: Shocking The Forecast

March 12th, 2010 / Tales from a Trading Desk

As I sit here on the train I release that my late night coding meant that I missed shocking the forcast. The following code corrects last nights mistake:

    let valueDate = new DateTime(2010,1,1)
    let trade  = createIRSTwoLegTrade 101
    let npv =
        trade.SwapStream |> Seq.sumBy (fun x -> generateCashflow(x,trade, valueDate, curve, forcast))
    printfn "IRS NPV %A" npv

    let bumpCurve = curve |> List.map (fun x -> (fst x + 0.0001, snd x))
    let bumpForcast = forcast |> List.map (fun x -> (fst x + 0.0001, snd x))
    let shockedNpv =
        trade.SwapStream |> Seq.sumBy (fun x -> generateCashflow(x,trade, valueDate, bumpCurve, bumpForcast))
    printfn "IRS Shocked NPV %A" shockedNpv

    printfn "Parallel PV01 %A" (npv - shockedNpv)

F#: Parallel PV01 Using List.map

March 11th, 2010 / Tales from a Trading Desk

Moving on from the previous NPV calculations, I now need to shock the curve, recalculate NPV and thereby calculate Parallel delta or Parallel PV01. Shocking the curve means adding 100th of 1% to each point on the curve, which I can do fairly easily with List.map:

    let valueDate = new DateTime(2010,1,1)
    let trade  = createIRSTwoLegTrade 101
    let npv =
        trade.SwapStream |> Seq.sumBy (fun x -> generateCashflow(x,trade, valueDate, curve, forcast))
    printfn "IRS NPV %A" npv

    let bumpCurve = curve |> List.map (fun x -> (fst x + 0.0001, snd x))
    let shockedNpv =
        trade.SwapStream |> Seq.sumBy (fun x -> generateCashflow(x,trade, valueDate, bumpCurve, forcast))
    printfn "IRS Shocked NPV %A" shockedNpv

    printfn "Parallel PV01 %A" (npv - shockedNpv)

F#: Market Risk – Fixed/Floating Cashflows

March 11th, 2010 / Tales from a Trading Desk

I’ve now got cashflow generation for both legs (see below). I think the Days360 function is slightly different to Excels hence the slight difference in number compared to the original XLS I previous posted. Next things to do are to parallel compute the cashflows.

F#: Modelling An Interest Rate Swap (IRS) Trade Using FpML 5.0

March 9th, 2010 / Tales from a Trading Desk

I want to take the previous blogged Market Risk IRS trade to the next level, and move from Excel to a real calculation engine. To aid this I need to model a trade. I was going to start with auto-generating C# code from FpML, but I though it would be more interesting to build the Proof Of Concept (POC) types in F# – and XSD.EXE doesn’t support F# :(

FpML is probably the best scheme to model off since the ISDA initially create FpML for a purely IRS perspective, but has now moved to cover multiple products. For this example, I’m looking at section 5.1 Interest Rate Swap.

SDP: FX – Yard Revolution?

March 8th, 2010 / Tales from a Trading Desk

Euromoney’s article on Morgan Stanley’s Matrix provides some insight into the feature set required to attain top 5 ranking in the FX world – currency options, precious metals, and streaming NDF’s. Morgan Stanley need to continue to push the feature set to achieve an appropriate yard increase to move back into the top 10, with I suspect the desire to be in the top 5.

One curious take away from the article; both FX Deutsche Bank and UBS have gone for more of a build than a buy as far as I am aware, and I believe (not confirmed) both use similar streaming technology.

Single Dealer Platforms: Buy vs Build, Who Cares?

March 5th, 2010 / Tales from a Trading Desk

Recently with numerous comments on my blog from certain parties coupled I thought it worth blogging some thoughts on where we are in Single Dealer Platform (SDP) land:

  • Firstly, I don’t really care if a SDP is build or buy. Even a buy consists of a build. You can’t buy an SDP off the shelf today without doing some work. “Caplin is the leader in rich applications in capital markets” – should I stop laughing now? Caplin is an integration layer as far as I can tell.

Market Risk: Bi-Temporal Model

March 5th, 2010 / Tales from a Trading Desk

Modelling a trade and the events that occur on a trade is always an interesting exercise. It’s become clear over the years however that a Bi-Temporal model is the only real way to go. This model is the lifecycle of the trade based on events and actions. The reasoning behind the need for bi-temporal model is quite simple. If you imagine an IRS trade, it gets created (New Trade $100m), amended, followed after sometime by a partial unwind ($50m), and amendment, another partial unwind ($40m).

Notes on Market Risk

March 3rd, 2010 / Tales from a Trading Desk

So today everyone is talking Risk – Real-Time Risk (RTR) to be more precise. Hence lets clarify things a little and make it clear were about to discuss Real-Time Market Risk.

Essentially we need to calculate the Present Value (PV) or Net Present Value (NPV) of a trade. In the following example we’re assume we looking at a Interest Rate Swap (IRS) which has two legs: Fixed and Floating.

Market Depth Data: Eurex and TickOne

February 23rd, 2010 / Tales from a Trading Desk

So I managed to find some data on the Eurex site (here). Although the data is from 2007, its a least better than nothing. The PDF’s on the site provide details on the field formats, which means you can basically figure out the depth at a specific time from a buy/sell viewpoint.

TickData (thanks to a colleague for reminding me of this site) also offers futures data.

Market Depth Historical Data: CME, LIFFE, Eurex, eSpeed, BrokerTec, HDAT, MTS

February 22nd, 2010 / Tales from a Trading Desk

I’m looking for some historical market depth data that I can use to play though my Market Strategy Engine. Looking at the various web sites (CME, LIFFE, Eurex, eSpeed(BGC Partners), BrokerTec, HDAT and MTS) there doesn’t appear to be a free download of data. Anyone know of anywhere where I can get decent data for free?

StreamInsight: Market Strategy Engine – Adding a User Experience (UX)

February 16th, 2010 / Tales from a Trading Desk

So in a recent posting I provide four areas that need enhancing with regards my Market Strategy Engine Proof Of Concept (POC). The initial version of the engine was a console application driven by .CSV files. With the move to a WPF UI I now want to add a UX that allows me to visualise the Market, allow me to enter strategy orders, and a blotter to show there working status.

The original console POC used the TextFile adapters to load data. I’ve now moved to writing my own adapters for market depth and strategy orders – the market was original an Rx powered adapter :)

Single Dealer Platform: Google Chart Tools

February 14th, 2010 / Tales from a Trading Desk

I wonder if Google Chart Tools will help in reducing the build cost of a Single Dealer Platform (SDP)?

Sybase acquiring Aleri?

February 2nd, 2010 / /dev/random

Looks like Sybase is in the process of acquiring Aleri.

It’ll be interesting to see how Sybase manages Aleri and Coral8 products, in both development and deployment (licensing).

FIXatdl v1.1 Release Candidate

February 1st, 2010 / /dev/random

The Algoithmic Trading Working Group uploaded the v1.1 Release Candidate (internal build v2.7.0) for FIXatdl recently. You’ll need to register in order to download the files.

So start coding up those algo UIs already!

Here’s an earlier post that highlights some of the breaking changes with previous builds.

Kevin Kelly @ First HPC/Cloud Computing SIG

January 19th, 2010 / Gotham Canuk

Last week was the first meeting of the HPC/Cloud Computing workshop, hosted by Lab49 and Liquidnet.

Changing from the typical NY Java SIG format, this new workshop was a bit of an experiment. We limited the attendance to foster a more discussion-oriented workshop. I’m sure everyone in attendance would agree it was a great formula and a welcomed change from large seminar-styled approach. I asked Kevin Kelly from Amazon Web Services come to town and give the membership an introduction to Cloud Computing.

Kevin Kelly on Cloud Computing

@Lab This Month

December 23rd, 2009 / Tech Tock

There was plenty going on at lab in the last few weeks, but hey, I’ve been busy too, so December gets a monthly installment.

Die Region Die

Very few of us like Visual Studio Regions.  A dozen spoke up within minutes when the topic came up.

This VS Macro was recommended to help control regions.

If you have any love for regions you’ll want this automagic regionator.

Using regions to organize by functionality instead of type of members or access modifiers got some support.  Also, using regions to hide boilerplate code like copyrights and imports sections could be acceptable to some.

Solace, Celoxica and High Frequency Trading (HFT)

December 18th, 2009 / Tales from a Trading Desk

Reuter’s provides a view on HFT, with Solace providing thoughts, and Credit Suisse goes Celoxica

Have Reuters and EBS Lost Control of FX ?

December 8th, 2009 / newyorkscot

Interesting article from Euromoney, here.

Notes from Functional Programming eXchange (7/12/09)

December 7th, 2009 / Tales from a Trading Desk

So after a complete travel nightmare on a Monday morning I made it to Skillsmatter with 1min to spare before kick-off. There was a pretty good turn out for the event, with people from RBC, youDevise, CS and Commerce Bank. Overall and interesting office space, the lunch was acceptable, the wifi was rubbish, and the conference was interesting:

  • Computation Abstraction – Sadek Drobi talked about glue (glue in this case is all the exception handling code requred around an algorithm). We need to get rid of the noise! Functors, Applicative Functors, Monads are the tools.

CDS Clearing

December 7th, 2009 / /dev/random

In news last week, the CME Group finally announced the availability of their CDS clearing platform.