Skip to content

Test a loss

View as Markdown

Draw a test loss on a tower to see which Layers it reaches. Use the Engine to estimate how much each Layer pays.

Drag the slider to move the loss line.

Tower
Retention 20%
Retention 20%
Second excess, 5M xs 5M per claim
Loss 6.2M
kept by the cedant signed firm orderWidth is share of the risk, height is amount.

Pass an amount as loss. The tower is washed up to that level and flagged. A loss larger than the tower says how far above it runs.

<Towers data={response} loss={6200000} />

Pass null, or leave the prop out, for no loss.

POST /recoveries returns the ceded amount per Layer after applying inuring order and annual terms. The amounts are Estimates for illustration and what-if analysis. Never use them for booking.

In the browser, call a route on your own server that forwards the request body to the Engine’s POST /api/v1/recoveries with your secret API key. This example lists ceded Estimates for one Loss on the selected Risk.

async function showRecoveryEstimates(program, riskId, currency, date, amount) {
const response = await fetch('/api/recovery-estimates', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
program,
losses: [{ lossId: 'test-loss', riskId, currency, date, amount }],
}),
});
if (!response.ok) throw new Error('Could not load recovery Estimates');
const { losses } = await response.json();
console.info(`Ceded Estimates in ${currency} (never for booking)`);
console.table(losses[0].layers.map(({ contractRef, layerRef, ceded }) => ({
contractRef, layerRef, ceded,
})));
}

Pass the loss to a <TowerChart /> when you want to mark it on a single tower. The line shows where the gross amount falls on that tower’s vertical scale. Use the Engine to estimate recoveries across the Risk’s Layers.

Tower
Retention 40%
XOL Treaty - Per Event
Retention
Retention 10%
Cat XL 2, 25M xs 25M per event
Loss 30M
XOL Treaty - Aggregate
Retention
Loss 30M
kept by the cedant signed firm orderWidth is share of the risk, height is amount.

Keep the amount in state and pass it down. towerTop gives a sensible upper bound for a slider:

import { useState } from 'react';
import { Towers, towerTop } from '@vinsa/towers';
function TowersWithLoss({ response }) {
const [loss, setLoss] = useState(0);
const top = Math.max(...response.risks.flatMap((r) => r.towers.map(towerTop)));
return (
<>
<input type="range" min={0} max={top * 1.25} value={loss} onChange={(e) => setLoss(Number(e.target.value))} />
<Towers data={response} loss={loss > 0 ? loss : null} />
</>
);
}