Skip to content

Commit

Permalink
Update VolSurface.py
Browse files Browse the repository at this point in the history
Fix bug in var interpolation
  • Loading branch information
jkirkby3 authored Apr 13, 2024
1 parent f8ca1cc commit feddd78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fypy/volatility/VolSurface.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _interpolate_var(self, x: Union[float, np.ndarray], T: float) -> Union[float
ttm_left = self._ttms[left_index]
ttm_right = self._ttms[right_index]

var_left = self._slices[left_index].model_var(x)
var_left = self._slices[ttm_left].model_var(x)

mult = (T - ttm_left) / (ttm_right - ttm_left)
return var_left + (self._slices[right_index].model_var(x) - var_left) * mult
return var_left + (self._slices[ttm_right].model_var(x) - var_left) * mult

0 comments on commit feddd78

Please sign in to comment.