MarcusRainbow / QuantMath

Financial maths library for risk-neutral pricing and risk
MIT License
370 stars 43 forks source link

Multiple results from price or mc_price #19

Open MarcusRainbow opened 6 years ago

MarcusRainbow commented 6 years ago

At present, these methods just return Result<f64, qm:Error>, which means that a lot of the detail of pricing is lost. There are two kinds of things that could be returned:

  1. A recursive breakdown of how the price was calculated. For example, the price of a basket is the weighted sum of the components. If the weights and components were also returned, it would allow the user to show breakdown of the price and also the risks by component, without any further calculation.
  2. Pricer-dependent outputs. For example, a Monte-Carlo pricer could output a convergence graph. Again, this could be summed for risks, showing convergence of the risks as well. Pricers for dynamic indices could show the contribution from fees. (This can be important for recursive dynamic indices, where there may be rules for netting out fees other than at the top level.)

I think this means returning some kind of structure, containing top-level price, recursive price breakdown, and pricer-specific (and maybe model specific) outputs.