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 Financial Portfolio Management with Python
course content

Course Content

Introduction to Financial Portfolio Management with Python

Introduction to Financial Portfolio Management with Python

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

What is Portfolio?

Investing in a single asset is relatively simple. However, managing multiple assets can be significantly more complex.

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

Why Invest in a Portfolio?

Investing is always risky due to factors that can affect the value and performance of investments, such as market fluctuations, inflation, change in management, natural disasters, etc.

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 the upcoming chapters, we will explore in detail how these weights affect the overall 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:

123456
# Defining number of assets `n_assets` n_assets = 4 # Computing list of weights `weights` weights = [1/n_assets for i in range(n_assets)] # Printing list of weights `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.

To be more exact - each weight is computed as market capitalization of the corresponding asset over the sum of all asset's capitalizations into 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:

123456
# Defining dictionary `portfolio` of corresponding portfolio portfolio = {'Apple': 3.36, 'Meta': 1.28, 'Amazon': 1.84} # Computing dictionary `portfolio_weights` of portfolio's weights portfolio_weights = {k: v/sum(portfolio.values()) for k, v in portfolio.items()} # Printing dictionary `portfolio_weights` print(portfolio_weights)
copy

Here are also two diagrams for comparison:

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

Select the correct answer

Everything was clear?

Section 1. Chapter 2
We're sorry to hear that something went wrong. What happened?
some-alt