val r = t => 0.01 + 0.002 * t
val S = 100.0
val div = t => 0.03 + 0.003 * t
val repo = t => 0.0
val vol = (t, k) => 0.1 + 0.01 * t + math.pow(math.abs(k - 100), 2) / 1000.0
val cashflow = Map[
0.5 -> (x:Double) => math.max(0.0, x - 100.0),
1.0 -> (x:Double) => math.max(0.0, x - 100.0),
1.5 -> (x:Double) => math.max(0.0, x - 100.0),
2.0 -> (x:Double) => math.max(0.0, x - 100.0)
]
price(cashflow) = Map[
0.5 -> 4.225,
1.0 -> 4.10,
1.5 -> 3.85,
2.0 -> 3.555
] (or something like this, numbers are complete random)
Create montecarlo model with Dupire volatility
Assumption
Input
==> Please decide format of volatility input
Required function
where result is mapping payment date => price
Example
Ref
http://www.fairmat.com/plugins/view/dupire