F#: Shocking The Forecast
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)














