Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What is Portfolio? | Portfolio Analysis Basics
Introduction to Portfolio Management with Python
course content

Course Content

Introduction to Portfolio Management with Python

Introduction to Portfolio Management with Python

1. Portfolio Analysis Basics
2. Portfolio Optimization Basics
3. Factor Investing

bookWhat is Portfolio?

First of all, let's introduce a key definition for this entire course.

Why Invest in a Portfolio?

Given the inherent risks of investing in a single asset, it can be beneficial to diversify your investments across multiple assets. This way, a decline in the price of one asset might be offset by an increase in the price of another.

Additionally, when managing a portfolio, each asset is assigned a "weight" - a positive number, that sums to 1 across all assets and determines the importance or influence of the corresponding asset in a portfolio(higher value implies higher influence).

In practice, each weight represents the proportion of each asset relative to the total value of the portfolio.

Now, we can only mention several ways to assign asset weights. For now, it's important to note that there are two common methods for assigning asset weights.

Equal Weighted Portfolio

In this strategies the weights of all assets in the portfolio are equal.

Practically, in the case of equal weighted portfolios, each weight is equal to the one over a number of assets in the portfolio.

Here is an example of computing these weights using Python:

12345678
# Defining number of assets n_assets = 4 # Computing list of weights weights = [1/n_assets for i in range(n_assets)] # Printing list of weights print(weights)
copy

Market Cap Weighted Portfolio

Meanwhile, in this strategy, the weight of each asset is proportional to its market capitalization, which is the company's total value and calculated by multiplying the stock price by the number of outstanding shares.

Specifically, each weight is calculated as the market capitalization of the individual asset divided by the total market capitalization of all assets in the portfolio.

Here is a code example for this case, where as a portfolio we have set of stock shares for such companies as Apple, Meta and Amazon, and market capitalization is specified in trillions of USD:

12345678
# Defining a capitalization of companies capitalizations = {'Apple': 3.36, 'Meta': 1.28, 'Amazon': 1.84} # Calculating portfolio's weights based on a market capitalizations portfolio_weights = {k: v/sum(capitalizations.values()) for k, v in capitalizations.items()} # Printing resulting weights print(portfolio_weights)
copy

Here are also two diagrams for comparison:

1. How market capitalization of assets in portfolio affects weights in terms of market cap weighted portfolio?
2. How market capitalization of assets in portfolio affects weights in terms of equal weighted portfolio?
How market capitalization of assets in portfolio affects weights in terms of market cap weighted portfolio?

How market capitalization of assets in portfolio affects weights in terms of market cap weighted portfolio?

Select the correct answer

How market capitalization of assets in portfolio affects weights in terms of equal weighted portfolio?

How market capitalization of assets in portfolio affects weights in terms of equal weighted portfolio?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 3
some-alt