pricing.price_portfolio()
Prices a portfolio and allocates the price to its components.
Usage
pricing.price_portfolio(
pd,
assets,
*,
cost_of_capital=None,
distortion=None,
)Premium and assets are each allocated by co-measure (the natural allocation): component prices add up to the portfolio’s, and a component that diversifies the portfolio is priced below its standalone price. With a cost of capital, every component earns the rate on its allocated capital.
Parameters
pd: PredictiveDistribution-
Components that add up to the portfolio: segments or covers, not gross, ceded and net side by side.
assets: Distortioncost_of_capital: float = Nonedistortion: Distortion = None-
Exactly one of
cost_of_capitalanddistortion, as in price.
Returns
PortfolioPrice
Examples
>>> from prospicio.distributions import PredictiveDistribution
>>> from prospicio.pricing import price_portfolio
>>> from prospicio.risk import Distortion
>>> pd = PredictiveDistribution(["cover"], [("a",), ("b",)],
... [[0.0, 2.0], [1.0, 1.0], [4.0, 0.0], [8.0, 0.0]])
>>> p = price_portfolio(pd, Distortion.tvar(0.5), cost_of_capital=0.1)
>>> [round(c.premium, 6) for c in p.allocated][3.5, 0.681818]
>>> p.allocated[1].margin < 0 # the second cover hedges the firstTrue