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.
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 get_bucketed_delta
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_bucketed_delta(cashflow_list, discount_curve, valuation_date=None,
delta_curve=None, delta_grid=None, shift=.0001):
r""" list of bpv delta for partly shifted interest rate curve
:param cashflow_list: list of cashflows
- 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 get_curve_fit
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_curve_fit(cashflow_list, discount_curve, valuation_date=None,
Function get_bucketed_delta
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_bucketed_delta(cashflow_list, discount_curve, valuation_date=None,
Function get_curve_fit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_curve_fit(cashflow_list, discount_curve, valuation_date=None,
fitting_curve=None, fitting_grid=None, present_value=0.0,
precision=1e-7, bounds=(-0.1, .2)):
r"""fit curve to cashflow_list prices (bootstrapping)
- 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 get_fair_rate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_fair_rate(cashflow_list, discount_curve,
Function get_yield_to_maturity
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_yield_to_maturity(cashflow_list, valuation_date=None, present_value=0.,
Function get_basis_point_value
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_basis_point_value(cashflow_list, discount_curve, valuation_date=None,
Function _simple_bracketing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _simple_bracketing(func, a, b, precision=1e-13):
""" find root by _simple_bracketing an interval
:param callable func: function to find root
:param float a: lower interval boundary
- 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"