Is there a way to create a Leg in quantlib in which the notional and reset amounts are calculated by how an index/equity performs?
1 Answer
QuantLib does not, but if you're using C++ then you can check out the "open source risk engine", which adds an equity index class, equity indexed legs, and equity swaps:
https://github.com/OpenSourceRisk/Engine/blob/master/OREData/ored/portfolio/equityswap.cpp
https://github.com/OpenSourceRisk/Engine/blob/master/QuantExt/qle/indexes/equityindex.cpp
If you're using Python there is SWIG wrapper available too, but it's not maintained so well:
https://github.com/OpenSourceRisk/ORE-SWIG/tree/master/QuantExt-SWIG/Python