_WithMutability#
- class rateslib.curves._WithMutability(nodes, *, interpolation=NoInput.blank, t=NoInput.blank, endpoints=NoInput.blank, id=NoInput.blank, convention=NoInput.blank, modifier=NoInput.blank, calendar=NoInput.blank, ad=0, index_base=NoInput.blank, index_lag=NoInput.blank, collateral=NoInput.blank, credit_discretization=NoInput.blank, credit_recovery_rate=NoInput.blank, **kwargs)#
Bases:
objectThis class is designed as a mixin for the methods for Curve Pricing Objects, i.e. the
CurveandLineCurve.It permits initialization, configuration of
nodesandmetaand mutability when interacting with aSolver, when getting and setting nodes, as well as user update methods, spline interpolation solving and state validation.Methods Summary
csolve()Solves and sets the coefficients,
c, of thePPSpline.to_json()Serialize this object to JSON format.
update([nodes])Update a curves nodes with new, manually input values.
update_meta(key, value)Update a single meta value on the Curve.
update_node(key, value)Update a single node value on the Curve.
Methods Documentation
- csolve()#
Solves and sets the coefficients,
c, of thePPSpline.- Return type:
None
Notes
Only impacts curves which have a knot sequence,
t, and aPPSpline. Only solves ifcnot given at curve initialisation.Uses the
spline_endpointsattribute on the class to determine the solving method.
- to_json()#
Serialize this object to JSON format.
The object can be deserialized using the
from_json()method.- Return type:
str
Notes
Some Curves will not be serializable, for example those that possess user defined interpolation functions.
- update(nodes=NoInput.blank)#
Update a curves nodes with new, manually input values.
For arguments see
Curve. Any value not given will not change the underlying Curve.- Parameters:
nodes (dict[datetime, DualTypes], optional) – New nodes to assign to the curve.
- Return type:
None
Notes
Warning
Rateslib is an object-oriented library that uses complex associations. Although Python may not object to directly mutating attributes of a Curve instance, this should be avoided in rateslib. Only use official
updatemethods to mutate the values of an existing Curve instance. This class is labelled as a mutable on update object.
- update_meta(key, value)#
Update a single meta value on the Curve.
- Parameters:
key (datetime) – The meta descriptor to update. Must be a documented attribute of
_CurveMeta.value (Any) – Value to update on the Curve.
- Return type:
None
- update_node(key, value)#
Update a single node value on the Curve.
- Parameters:
- Return type:
None
Notes
Warning
Rateslib is an object-oriented library that uses complex associations. Although Python may not object to directly mutating attributes of a Curve instance, this should be avoided in rateslib. Only use official
updatemethods to mutate the values of an existing Curve instance. This class is labelled as a mutable on update object.