Cashflow#

class rateslib.periods.Cashflow(notional, payment, currency=NoInput.blank, stub_type=NoInput.blank, rate=NoInput.blank)#

Bases: object

Create a single cashflow amount on a payment date (effectively a CustomPeriod).

Parameters:
  • notional (float) – The notional amount of the period (positive assumes paying a cashflow).

  • payment (Datetime) – The adjusted payment date of the period.

  • currency (str) – The currency of the cashflow (3-digit code).

  • stub_type (str) – Record of the type of cashflow.

  • rate (float) – An associated rate to relate to the cashflow, e.g. an FX fixing.

notional#
Type:

float

payment#
Type:

Datetime

stub_type#
Type:

str

Notes

Other common BasePeriod parameters not required for single cashflows are set to None.

The cashflow is defined as follows;

\[C = -N\]

The npv() is defined as;

\[P = Cv(m) = -Nv(m)\]

The analytic_delta() is defined as;

\[A = 0\]

Example

In [1]: cf = Cashflow(
   ...:     notional=1e6,
   ...:     payment=dt(2022, 8, 3),
   ...:     currency="usd",
   ...:     stub_type="Loan Payment",
   ...: )
   ...: 

In [2]: cf.cashflows(curve=Curve({dt(2022, 1, 1): 1.0, dt(2022, 12, 31): 0.98}))
Out[2]: 
{'Type': 'Cashflow',
 'Period': 'Loan Payment',
 'Ccy': 'USD',
 'Acc Start': None,
 'Acc End': None,
 'Payment': datetime.datetime(2022, 8, 3, 0, 0),
 'Convention': None,
 'DCF': None,
 'Notional': 1000000.0,
 'DF': 0.988192842226477,
 'Rate': None,
 'Spread': None,
 'Cashflow': -1000000.0,
 'NPV': -988192.842226477,
 'FX Rate': 1.0,
 'NPV Ccy': -988192.842226477,
 'Collateral': None}

Attributes Summary

cashflow

Methods Summary

analytic_delta([curve, disc_curve, fx, base])

Return the analytic delta of the Cashflow.

cashflows([curve, disc_curve, fx, base])

Return the cashflows of the Cashflow.

npv([curve, disc_curve, fx, base, local])

Return the NPV of the Cashflow.

rate()

Return the associated rate initialised with the Cashflow.

Attributes Documentation

cashflow#

Methods Documentation

analytic_delta(curve=None, disc_curve=None, fx=None, base=None)#

Return the analytic delta of the Cashflow. See BasePeriod.analytic_delta()

cashflows(curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#

Return the cashflows of the Cashflow. See BasePeriod.cashflows()

npv(curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False)#

Return the NPV of the Cashflow. See BasePeriod.npv()

rate()#

Return the associated rate initialised with the Cashflow. Not used for calculations.