Skip to content

Added support for multi-asset portfolio and general improvements#1

Open
matteorosato wants to merge 7 commits into
apalladi:mainfrom
matteorosato:add-improvements
Open

Added support for multi-asset portfolio and general improvements#1
matteorosato wants to merge 7 commits into
apalladi:mainfrom
matteorosato:add-improvements

Conversation

@matteorosato

Copy link
Copy Markdown

This pull request adds support for multi-asset portfolio while maintaining backward compatibility with the original single-asset behavior. The update introduces a new simulate_portfolio_returns function to simulate investments in portfolios composed of multiple assets, with customizable portfolio composition.

A Jupyter Notebook CustomPortfolio.ipynb has been added to demonstrate how to use the tool with a sample two-fund portfolio.

Key Changes:

  1. simulate_portfolio_returns:

    • Introduced a new function to handle multi-asset portfolios, allowing users to specify the composition of the portfolio (asset weights).
    • The portfolio is defined as a dictionary where asset tickers are the keys, and the corresponding portfolio percentages are the values.
  2. simulate_multiple_investments:

    • Updated to support the simulation of portfolios. If a portfolio_composition is provided, the function calls simulate_portfolio_returns. If no composition is provided, it defaults to the original behavior of simulating single asset investments.
  3. simulate_multiple_durations:

    • Modified to accept and pass the portfolio_composition argument to simulate_multiple_investments, enabling simulations for multiple durations with multi-asset portfolios.
  4. New Notebook: Notebooks/CustomPortfolio.ipynb:

    • A new Jupyter Notebook has been added to illustrate how to use the simulation tool with a portfolio composed of two assets. The notebook walks through the steps of simulating and analyzing portfolio returns for a user-defined asset composition.
  5. Tests:

    • The unit tests have been rewritten to be compliant with the unittest framework.
  6. Improved README:

    • The README.md has been updated to reflect the latest changes, including extra information on installation and usage.
  7. Improved import_data function:

    • The import_data function has been improved to handle multiple DataFrames more efficiently.

Comment thread src/simulations.py

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apalladi this is more a general question: why are we using average capital instead of total one when computing the gross return?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant