ICashflowsService. This page describes the service, the measures that read it, and how to register it.
Understanding exposure measures is a prerequisite for this page.
What is a projected cashflow?
A projected cashflow is a payment that a trade is expected to make or receive at a time point. The service returns one value per scenario for each trade and time point.Which measures read the cashflows?
TheSimulatedCashflow measure (plugin key: SimulatedCashflow) calls the service for each trade and time point. It backs the hidden Gross Cumulative Cashflow and Gross With Break Dates Cumulative Cashflow measures, which two visible measures expand:
Gross Cumulative Cashflow (Scenario Level), which shows the cashflow of each scenario along the Scenarios dimension.Gross With Break Dates Cumulative Cashflow (Scenario Level), the same measure for the gross with break dates family, which keeps only the time points before the break date of each trade.
cumulativeCashflow() and cumulativeCashflowScenarioLevel() on the base gross exposure measures.
No gross, netted, or collateralized exposure formula reads the cashflows. Supplying cashflows does not change any exposure.
The service returns the cashflows in the trade’s MTF currency, and the measure converts them to the display currency with the FX rates that convert the MtF vectors. The measure has values at the Trade ID level only. It is empty above the trade level, because the per-trade values are not aggregated upward. At the trade level, it accumulates the values that the service returns for each time point over the time points. The service returns the cashflow at each time point, not a running total.
What happens when no service is supplied?
The cube uses a service that returns zero for every trade and time point, so the cumulative cashflow measures are zero at the Trade ID level.How to supply projected cashflows
The application implementsICashflowsService and registers it with ICollateralCubeConfigurator.cashflows(...), which it gets from ICollateralConfigurator.cube(...) inside its ICollateralConfigurer bean. The method getCashFlow(asOfDate, tradeId, timePoint) returns one value per scenario, or null when the trade has no cashflow at that time point. The service does not need to be serializable.
The following class is an ICashflowsService that returns a scheduled amount for a trade and time point, and zero otherwise. It returns the same amount in every scenario. A source that depends on the scenario returns one value per scenario.
ICollateralServices. Its scenarioCount() is the length that every vector must have. The following configurer registers the service. The same bean also adds a collateral algorithm, as described in How to write your own collateral algorithm.
cube(...). A later call to cashflows(...) for the same cube replaces an earlier one.