Skip to content

Commit

Permalink
More pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
domokane committed Nov 19, 2023
1 parent 5aa6524 commit 23fcf99
Show file tree
Hide file tree
Showing 85 changed files with 877 additions and 872 deletions.
Binary file modified docs/FinancePyManual.pdf
Binary file not shown.
16 changes: 8 additions & 8 deletions financepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cr = "\n"
CR = "\n"

s = "####################################################################" + cr
s += "# FINANCEPY BETA Version " + str('0.33') + " - This build: 16 Nov 2023 at 18:53 #" + cr
s += "# This software is distributed FREE AND WITHOUT ANY WARRANTY #" + cr
s += "# Report bugs as issues at https://github.com/domokane/FinancePy #" + cr
s += "####################################################################"
s += cr
S = "####################################################################" + CR
S += "# FINANCEPY BETA Version " + str('0.33') + " - This build: 16 Nov 2023 at 18:53 #" + CR
S += "# This software is distributed FREE AND WITHOUT ANY WARRANTY #" + CR
S += "# Report bugs as issues at https://github.com/domokane/FinancePy #" + CR
S += "####################################################################"
S += CR

print(s)
print(S)
32 changes: 16 additions & 16 deletions financepy/market/curves/discount_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,27 @@ def _df_to_zero(self,
f = annual_frequency(freq_type)

if isinstance(maturityDts, Date):
dateList = [maturityDts]
date_list = [maturityDts]
else:
dateList = maturityDts
date_list = maturityDts

if isinstance(dfs, float):
dfList = [dfs]
df_list = [dfs]
else:
dfList = dfs
df_list = dfs

if len(dateList) != len(dfList):
if len(date_list) != len(df_list):
raise FinError("Date list and df list do not have same length")

num_dates = len(dateList)
num_dates = len(date_list)
zero_rates = []

times = times_from_dates(
dateList, self._value_date, dc_type)
date_list, self._value_date, dc_type)

for i in range(0, num_dates):

df = dfList[i]
df = df_list[i]

t = max(times[i], gSmall)

Expand Down Expand Up @@ -240,7 +240,7 @@ def swap_rate(self,
else:
maturity_dates = maturity_date

parRates = []
par_rates = []

for maturityDt in maturity_dates:

Expand All @@ -266,19 +266,19 @@ def swap_rate(self,
prev_dt = next_dt

if abs(pv01) < gSmall:
parRate = 0.0
par_rate = 0.0
else:
dfStart = self.df(effective_date)
parRate = (dfStart - df) / pv01
df_start = self.df(effective_date)
par_rate = (df_start - df) / pv01

parRates.append(parRate)
par_rates.append(par_rate)

parRates = np.array(parRates)
par_rates = np.array(par_rates)

if isinstance(maturity_date, Date):
return parRates[0]
return par_rates[0]
else:
return parRates
return par_rates

###########################################################################

Expand Down
3 changes: 1 addition & 2 deletions financepy/market/volatility/equity_vol_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ def vol_from_strike_date(self, K, expiry_date):

###############################################################################

def volatility_from_delta_date(self, call_delta, expiry_date,
delta_method=None):
def vol_from_delta_date(self, call_delta, expiry_date, delta_method=None):
""" Interpolates the Black-Scholes volatility from the volatility
surface given a call option delta and expiry date. Linear interpolation
is done in variance space. The smile strikes at bracketed dates are
Expand Down
Loading

0 comments on commit 23fcf99

Please sign in to comment.