Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
domokane committed Dec 4, 2023
1 parent fba65a8 commit 3cb4be7
Show file tree
Hide file tree
Showing 54 changed files with 1,326 additions and 1,339 deletions.
21 changes: 3 additions & 18 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[MAIN]

disable=duplicate-code
disable=duplicate-code, consider-using-f-string, line-too-long, import-error, too-many-arguments

# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
Expand Down Expand Up @@ -41,7 +41,7 @@ extension-pkg-whitelist=
fail-on=

# Specify a score threshold under which the program will exit with error.
fail-under=10
fail-under=6

# Interpret the stdin as a python script, whose filename needs to be passed as
# the module_or_package argument.
Expand Down Expand Up @@ -181,22 +181,7 @@ function-naming-style=snake_case
#function-rgx=

# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
p,
q,
r,
s,
t,
K,
Q,
P,
X,
S,
N,
M
_
good-names=i,j,k,p,q,r,s,f,t,K,Q,P,X,S,N,M

# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
Expand Down
Binary file modified docs/FinancePyManual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion financepy/market/curves/discount_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self,
###########################################################################

def _zero_to_df(self,
value_dt: Date, #TODO: why is value_date not used ?
value_dt: Date, #TODO: why is value_date not used ?
rates: (float, np.ndarray),
times: (float, np.ndarray),
freq_type: FrequencyTypes,
Expand Down
12 changes: 6 additions & 6 deletions financepy/market/curves/interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def fit(self,

elif self._interp_type == InterpTypes.PCHIP_ZERO_RATES:

gSmallVector = np.ones(len(self._times)) * gSmall
zero_rates = -np.log(self._dfs) / (self._times + gSmallVector)
g_small_vector = np.ones(len(self._times)) * gSmall
zero_rates = -np.log(self._dfs) / (self._times + g_small_vector)

if self._times[0] == 0.0:
zero_rates[0] = zero_rates[1]
Expand All @@ -244,8 +244,8 @@ def fit(self,

""" Second derivatives at left is zero and first derivative at
right is clamped to zero. """
gSmallVector = np.ones(len(self._times)) * gSmall
zero_rates = -np.log(self._dfs) / (self._times + gSmallVector)
g_small_vector = np.ones(len(self._times)) * gSmall
zero_rates = -np.log(self._dfs) / (self._times + g_small_vector)

if self._times[0] == 0.0:
zero_rates[0] = zero_rates[1]
Expand All @@ -263,8 +263,8 @@ def fit(self,
elif self._interp_type == InterpTypes.NATCUBIC_ZERO_RATES:

""" Second derivatives are clamped to zero at end points """
gSmallVector = np.ones(len(self._times)) * gSmall
zero_rates = -np.log(self._dfs) / (self._times + gSmallVector)
g_small_vector = np.ones(len(self._times)) * gSmall
zero_rates = -np.log(self._dfs) / (self._times + g_small_vector)

if self._times[0] == 0.0:
zero_rates[0] = zero_rates[1]
Expand Down
8 changes: 4 additions & 4 deletions financepy/market/volatility/equity_vol_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def _obj(params, *args):
tot = 0.0

for i in range(0, num_strikes):
fittedVol = vol_function(vol_type_value, params, f, strikes[i], t)
fitted_vol = vol_function(vol_type_value, params, f, strikes[i], t)
mkt_vol = volatility_grid[index][i]
diff = fittedVol - mkt_vol
diff = fitted_vol - mkt_vol
tot += diff**2

return tot
Expand Down Expand Up @@ -762,8 +762,8 @@ def plot_vol_curves(self):
for i in range(0, numIntervals):

ks.append(K)
fittedVol = self.vol_from_strike_dt(K, expiry_dt) * 100.
fitted_vols.append(fittedVol)
fitted_vol = self.vol_from_strike_dt(K, expiry_dt) * 100.
fitted_vols.append(fitted_vol)
K = K + dK

label_str = "FITTED AT " + str(self._expiry_dts[tenor_index])
Expand Down
Loading

0 comments on commit 3cb4be7

Please sign in to comment.