Obtain how each ETF or fund is allocated across sectors, as decimals. This shows whether a fund that looks broad is in fact concentrated in a few sectors, such as technology in many large-cap indices.

Tickers that are not an ETF or fund return no data. They are not removed from the Toolkit instance.

Also known as: sector allocation, sector exposure, sector breakdown.

ETF Sector Weightings in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_etf_sector_weightings as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["QQQ", "VTI"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.get_etf_sector_weightings()

Which returns:

Sector QQQ VTI
Technology 0.603104 0.365041
Communication Services 0.117791 0.086689
Consumer Cyclical 0.098732 0.089865
Consumer Defensive 0.057355 0.042514
Industrials 0.055378 0.088185
Healthcare 0.036579 0.099808
Utilities 0.010639 0.019731
Basic Materials 0.009198 0.022242
Cash & Others 0.004737 0.001929
Energy 0.004538 0.037377
Financial Services 0.001949 0.123878
Real Estate 0 0.022741

Parameters

The function accepts the following parameters:

  • overwrite (bool): Defines whether to overwrite the existing data.
Share