Skip to content

Commit

Permalink
Update sv_fft.py
Browse files Browse the repository at this point in the history
jaehyukchoi committed Apr 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7f4dc6c commit cc87134
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pyfeng/sv_fft.py
Original file line number Diff line number Diff line change
@@ -667,18 +667,31 @@ def __init__(self, C, G, M, Y, intr=0.0, divr=0.0, is_fwd=False):
self.C, self.G, self.M, self.Y = C, G, M, Y

def mgf_logprice(self, uu, texp):
"""
MGF of log price of CGMY from Eq (19) from Ballotta and Kyriakou (2014)
Args:
uu: dummy variable
texp: time to expiry
Returns:
MGF value at uu
References:
- Ballotta L, Kyriakou I (2014) Monte Carlo Simulation of the CGMY Process and Option Pricing. Journal of Futures Markets 34:1095–1121. https://doi.org/10.1002/fut.21647
"""
gam_Y = spsp.gamma(-self.Y)
M_pow_Y = np.power(self.M, self.Y)
G_pow_Y = np.power(self.G, self.Y)

rv = self.C * gam_Y * (
np.power(self.M - uu, self.Y) - M_pow_Y
+ np.power(self.G - uu, self.Y) - G_pow_Y
+ np.power(self.G + uu, self.Y) - G_pow_Y
)
mu = - self.C * gam_Y * (
np.power(self.M - 1., self.Y) - M_pow_Y
+ np.power(self.G - 1., self.Y) - G_pow_Y
+ np.power(self.G + 1., self.Y) - G_pow_Y
)
np.exp(texp*(mu + rv), out=rv)
return rv

0 comments on commit cc87134

Please sign in to comment.