FX Forwards PV cashflow in CouchDB


{
    "tradeId": 1003,
    "trader": "Terry Trader",
    "desk": "FX Desk",
    "region": "London",
    "notional": 100,
    "rate": 1.58,
    "side": "Buy",
    "assetClass": "FX",
    "instrument": "Forward",
    "duration": "6M",
    "ccyPair": "GBPUSD",
    "yieldCurve": "http:\\\\localhost:8001\\yieldCurve\\GBP\\20100101",
    "GBPcashflow": [-98.54],
    "USDcashflow": [154.22]
}

With an enhanced map:

function(doc) {
  if (doc.instrument == "Swap") {
    emit(doc.tradeId, sum(doc.fixedLegPVCashflows)+sum(doc.floatingLegPVCashflows));
  } else if (doc.assetClass == "FX") {
    emit(doc.tradeId, sum(doc.GBPcashflow)+sum(doc.USDcashflow));
  }
}

So the above is still fairly simple, and probably not relevant in business – i.e. the sum of total NPV for two instruments. What might be more interesting is the total PV for 6M (6 months). Which possibly highlights the document structure issues around how we hold the Swap cashflow’s.

~ by mdavey on February 24, 2012.

One Response to “FX Forwards PV cashflow in CouchDB”

  1. I am working on something similar in Couch – would be interested in comparing notes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 388 other followers