How can I make copies of a portfolio efficiently for modelling and reporting purposes?
LUSID allows a portfolio to derive (or copy) from another portfolio. A derived portfolio inherits all holdings and transactions from its parent portfolio. Any changes made to the parent portfolio are automatically reflected in derived portfolio, but the derived portfolio can also contain its own additional transactions (with transactions in the latter taking precedence).
Derived portfolios in conjunction with scopes are a powerful construct. For example, to do pre-trade what-if analysis, a derived portfolio could be created in a new namespace linked to the underlying live (parent) portfolio in the ‘official’ scope. Scenario transactions can then be booked in the derived portfolio and the performance of the two could be compared without affecting the live book.
You can find a code example in Python of this here.
It is important when creating a derived transaction portfolio to consider what creation date to use.
If you do create a derived portfolio, please note that you must delete the derived portfolio before you can delete the parent portfolio.