Skip to content

Commit ae9efd4

Browse files
authored
Merge pull request #180 from PyFE/cgmy
Bug fixed in CGMY FFT model
2 parents 96a471e + cf373d6 commit ae9efd4

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

pyfeng/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .gamma import InvGam, InvGauss
99

1010
# FFT related models
11-
from .sv_fft import HestonFft, BsmFft, OusvFft, VarGammaFft, ExpNigFft, Sv32Fft
11+
from .sv_fft import HestonFft, BsmFft, OusvFft, VarGammaFft, CgmyFft, ExpNigFft, Sv32Fft
1212

1313
# SABR/NSVh related models
1414
from .sabr import SabrHagan2002, SabrNormVolApprox, SabrLorig2017, SabrChoiWu2021H, SabrChoiWu2021P

pyfeng/sv_fft.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,7 @@ def mgf_logprice(self, uu, texp):
657657

658658
class CgmyFft(smile.OptSmileABC, FftABC):
659659

660-
C = 1.
661-
G = 1.
662-
M = 1.
663-
Y = 0.
660+
C, G, M, Y = 1., 1., 1., 0.
664661

665662
def __init__(self, C, G, M, Y, intr=0.0, divr=0.0, is_fwd=False):
666663
super().__init__(C, intr=intr, divr=divr, is_fwd=is_fwd) # self.sigma = C
@@ -679,7 +676,6 @@ def mgf_logprice(self, uu, texp):
679676
680677
References:
681678
- 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
682-
683679
"""
684680
gam_Y = spsp.gamma(-self.Y)
685681
M_pow_Y = np.power(self.M, self.Y)
@@ -693,10 +689,5 @@ def mgf_logprice(self, uu, texp):
693689
np.power(self.M - 1., self.Y) - M_pow_Y
694690
+ np.power(self.G + 1., self.Y) - G_pow_Y
695691
)
696-
np.exp(texp*(mu + rv), out=rv)
692+
np.exp(texp*(mu*uu + rv), out=rv)
697693
return rv
698-
699-
class CGMY_New():
700-
701-
def __init__(self):
702-
pass

0 commit comments

Comments
 (0)