How to Rebalance Your Stock Portfolio with Python

Part II is Now Available Here

  • What are the Benefits of Rebalancing a Stock Portfolio?
  • Stock Weighting Methodologies and Python Snippets

What are the Benefits of Rebalancing a Stock Portfolio?

Investors should periodically rebalance their portfolios to maintain their designated portfolio weights over a long time horizon and across bullish and bearish market conditions.

  • reduced portfolio risk,
  • increased portfolio diversity, and
  • avoiding mental investment biases.

Reduced Portfolio Risk

  • GME’s equity is worth $28,279 | GME’s portfolio weighting is 59.7%
  • TSLA’s equity is worth $12,709 | TSLA’s portfolio weighting is 26.8%
  • AMD’s equity is worth $2,581 | AMD’s portfolio weighting is 5.4%
  • GOOG’s equity is worth $2,065 | GOOG’s portfolio weighting is 4.4%
  • AMZN’s equity is worth $1,743 | AMZN’s portfolio weighting is 3.7%

Increased Portfolio Diversity

Avoiding Mental Investment Biases

Stock Weighting Methodologies and Python Snippets

The following sections will illustrate three rebalance methodologies and show an investor how to use Python & Intrinio’s Financial APIs to quickly calculate portfolio weightings for their holdings once they decide on the stock they desire to own.

  • Equal Weight,
  • Market Cap Weight, and
  • Efficient Frontier Weight.

Equal Weight Rebalancing

Equal weight rebalancing is typically identified as a value-based methodology.

Market Cap Rebalancing

Unlike an equal weight rebalance, market weight rebalancing is a momentum-based methodology.

Efficient Frontier Rebalancing

For investors looking to take a more quantitative focus on their portfolio allocation and rebalance methodologies, efficient frontier weighting is an excellent option to maximize returns while reducing risk.

Where to access clean market data

At Intrinio, we’re recognized for being one of the top data providers that specializes in high-quality data, immediate customer service, and modern tools for a variety of fintech platforms and businesses. Our dedicated team wants to help you find the best data package that fits your unique needs. Reach out to one of our data specialists today to find out more about our equities market data packages. And to learn more about all our financial services and data please visit



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


High-quality financial data. Tools built for developers. First-class, US-based support. Data doesn’t have to be hard or expensive.