Skip to content

Commit 797440d

Browse files
committed
Code consistency
1 parent 8160ed6 commit 797440d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pyfeng/sabr_int.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class SabrCondDistABC(sabr.SabrABC, abc.ABC):
120120
fwd_cv = False
121121

122122
@abc.abstractmethod
123-
def fwd_vol_eff(self, fwd, texp):
123+
def cond_spot_sigma(self, fwd, texp):
124124
# return (fwd, vol, weight) each 1d array
125125
pass
126126

@@ -134,7 +134,7 @@ def price(self, strike, spot, texp, cp=1):
134134
#else:
135135
kk = strike / fwd
136136

137-
fwd_eff, vol_eff, ww = self.fwd_vol_eff(fwd, texp)
137+
fwd_eff, vol_eff, ww = self.cond_spot_sigma(fwd, texp)
138138
# print(f'E(F) = {np.sum(fwd_eff*ww)}')
139139
if self.fwd_cv:
140140
fwd_eff /= np.sum(fwd_eff*ww)
@@ -203,9 +203,7 @@ def zhat_weight(self, vovn):
203203
ww = ww[:, None]
204204
return zhat, ww
205205

206-
def cond_int_var(self, vovn, zhat, fwd):
207-
betac = 1.0 - self.beta
208-
alpha = self.sigma / np.power(fwd, betac) #if self.beta > 0.0 else self.sigma
206+
def cond_int_var(self, vovn, zhat):
209207

210208
m1 = self.condvar_m1(zhat, vovn)
211209
m2 = self.condvar_m2(zhat, vovn)
@@ -232,12 +230,12 @@ def cond_int_var(self, vovn, zhat, fwd):
232230
assert r_var.shape == w2.shape
233231
return r_var, r_vol, w2
234232

235-
def fwd_vol_eff(self, fwd, texp):
233+
def cond_spot_sigma(self, fwd, texp):
236234
alpha, betac, rhoc, rho2, vovn = self._variables(fwd, texp)
237235
rho_alpha = self.rho * alpha
238236

239237
zhat, w0 = self.zhat_weight(vovn) # column vectors
240-
r_var, r_vol, w123 = self.cond_int_var(vovn, zhat, fwd)
238+
r_var, r_vol, w123 = self.cond_int_var(vovn, zhat)
241239
w0123 = w0 * w123
242240

243241
r_vol *= rhoc # matrix

0 commit comments

Comments
 (0)