Showing 88 of 148 total issues
File curve.py
has 612 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
File pricer.py
has 535 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
File interpolation.py
has 461 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
Function __iter__
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def __iter__(self):
if self._masterscale:
value = round(float(self), 7)
value_list = [round(x, 7) for x in list(self.masterscale.values())]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File optionpricing.py
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
File payoffs.py
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
File interestratecurve.py
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
File dev2.py
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
File cashflow.py
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# dcf
# ---
# A Python library for generating discounted cashflows.
Function details
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def details(self, date, strike=None):
"""model parameter details
:param date: option expiry date (also fixing date)
:param strike: option strike value
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function rate_table
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def rate_table(curve, x_grid=None, y_grid=None):
if x_grid is None:
if curve.origin in curve.domain:
x_grid = curve.domain
else:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function plot_vol
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def plot_vol(curves, x=None):
if not isinstance(curves, (tuple, list)):
curves = curves,
fig, axs = plt.subplots(1, len(curves))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function plot_curve
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def plot_curve(curves, x=None):
if not isinstance(curves, (tuple, list)):
curves = (curves,)
fig, axs = plt.subplots(1, len(curves))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function interest_rate_swap
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def interest_rate_swap(start_date=TODAY,
Function get_interest_accrued
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_interest_accrued(cashflow_list, valuation_date):
r""" calculates interest accrued for rate cashflows
:param cashflow_list: requires a `day_count` property
:param valuation_date: calculation date
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function make_grid
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def make_grid(curve, step=None, nums=10):
domain = curve.domain
grid = list()
for start, stop in zip(domain[:-1], domain[1:]):
grid.append(start)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, domain=(), data=(), interpolation=None, origin=None,
day_count=None, forward_tenor=None):
if isinstance(domain, RateCurve):
# if argument is a curve add extra curve points to domain
# for better approximation
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function rate_table
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def rate_table(curve, x_grid=None, y_grid=None):
r""" table of calculated rates
:param curve: function $f$
:param x_grid: vertical date axis $x_0, \dots, x_m$
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function details
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def details(self, forward_curve=None):
yf = self.day_count(self.start, self.end)
details = {
'cashflow': 0.0,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _interest_payment_dates
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _interest_payment_dates(
start_date, end_date, period, convention, holidays):
if bd and isinstance(start_date, bd.BusinessDate):
start_date = bd.BusinessDate(start_date)
if bd.BusinessPeriod.is_businessperiod(end_date):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"