FinancePy

FinancePy API Reference

Helpers

financepy.utils.helpers

Functions

beta_vector_to_corr_matrix

beta_vector_to_corr_matrix(betas)
Convert a one-factor vector of factor weights to a square correlation matrix.

check_argument_types

check_argument_types(func, values)
Check function arguments against their type annotations. Parameters ---------- func : callable Function whose annotations are used for type checking. values : dict Mapping of argument names to supplied values, typically locals(). Raises ------ FinError If an argument does not match its annotated type.

check_dt

check_dt(d: financepy.utils.date.Date)
Check that input d is a Date.

check_vector_differences

check_vector_differences(x: numpy.ndarray, y: numpy.ndarray, tol: float = 1e-06)
Compare two vectors elementwise to see if they are more different than tolerance.

dump

dump(obj)
Get a list of all of the attributes of a class (not built in ones)

format_table

format_table(header, rows)
Format a table without PrettyTable. Left-align text, right-align numbers.

grid_index

grid_index(t, grid_times)

No description available.

input_time

input_time(dt: financepy.utils.date.Date, curve)
Validates a time input in relation to a curve. If it is a float then it returns a float as long as it is positive. If it is a Date then it converts it to a float. If it is a Numpy array then it returns the array as long as it is all positive.

label_to_string

label_to_string(label: str, value: float | str, separator: str = '\n', list_format: bool = False)
Format label/value pairs for a unified formatting.

option_years

option_years(value_dt: financepy.utils.date.Date, expiry_dt: financepy.utils.date.Date, floor=1e-10, fail=True)

No description available.

print_tree

print_tree(array: numpy.ndarray, depth: int = None)
Function that prints a binomial or trinonial tree to screen for the purpose of debugging.

pv01_times

pv01_times(t: float, f: float)
Calculate a bond style pv01 by calculating remaining coupon times for a bond with t years to maturity and a coupon frequency of f. The order of the list is reverse time order - it starts with the last coupon date and ends with the first coupon date.

table_to_string

table_to_string(header: str, value_table, float_precision='10.7f')
Format a 2D array into a table-like string.

times_from_dates

times_from_dates(value_dt: financepy.utils.date.Date, dt: financepy.utils.date.Date | list, curve_dc_type: financepy.utils.day_count.DayCountTypes = <DayCountTypes.ACT_365F: 7>)
Return year fractions from value_dt to dt. If dt is a single Date, return a float. If dt is a list of Dates, return a numpy array of floats.

to_usable_type

to_usable_type(t)
Convert a type such that it can be used with `isinstance`
Generated automatically from the FinancePy source code. Do not edit this file manually.