TQuant Lab Should ESG ETF Be a Buy? Backtest Performance of ESG ETF

Highlight

  • Article Difficulty: ★☆☆☆☆
  • Explore the relationship between ESG ETFs and weighted returns.
  • Write a buy-and-hold ESG ETF and backtest risk and performance using the TQuant Lab backtesting platform.

Introduction

What is ESG?

ESG is a concept proposed by the United Nations Global Compact in 2004. ESG in Chinese refers to “environmental”, “social” and “governance.” These three pillars are essential indicators for evaluating the sustainable operation of enterprises. The following explains the meaning of ESG:

E – Environmental:
It represents the need for enterprises to pay attention to the impact and responsibility of environmental sustainability issues during their operations and development processes, including reducing carbon emissions, climate change, energy conservation, pollution management, etc. It is used to measure whether enterprises have considered the environment’s maintenance during development.

S – Social:
It means that enterprises must pay attention to relevant social issues in the process of operation and development and fulfill their responsibilities to society. This includes how companies manage employees, consumers, or employee rights, corporate working environment, support for charity, labor human rights, social participation, etc., to promote companies’ establishment of a good workplace environment and implementation of corporate social responsibilities.

G – Governance:
It refers to the transparency, responsibility, efficiency, and fairness of various matters in the company’s management and operation process. It includes topics such as company senior management, executive compensation, shareholder rights, information transparency, risk management, board governance, supply chain management, etc. It is used to evaluate a company’s managers and operations. Combining these three ESG concepts can determine how a company can contribute to sustainable development while making profits.

Importance of ESG

ESG is an essential indicator for evaluating the sustainable development of a company and is also one of the critical issues that investors pay attention to. When the financial crisis broke out, companies with higher ESG scores were less affected because of their long-term investment in social assets, making ESG more critical. Although business operations need to pay attention to financial data, if they take actions that harm the environment or infringe on consumer rights for the sake of revenue results, it will affect the company’s reputation. Moreover, as the problem of climate change intensifies, environmental risks are an issue that the world must pay attention to. Therefore, both investors and social groups have begun to supervise the response measures of enterprises or governments to environmental risks.

In other words, ESG risks have become one of the critical factors affecting corporate finance and reputation. For example, environmental and social violations have caused the company to be fined or face legal risks such as lawsuits, or there have been disputes about ethical flaws in its operating methods, and the media have criticized it. Damage to brand reputation caused by reports. Therefore, there are five benefits for companies to implement ESG:

  • Reduce risk
  • Increase long-term value
  • Meet investor expectations
  • Good reputation
  • Sustainable development

ESG ETF

This article will select the top 4 popular ESG ETFs in the market as investment targets:

  1. The full name of 00692 is “Fubon Taiwan Corporate Governance 100 Fund,” and the tracking index is “Taiwan Corporate Governance 100 Index.”
  2. The full name of 00850 is “Yuanta Taiwan ESG Sustainable ETF Securities Investment Trust Fund,” and the tracking index is the Taiwan Sustainability Index.
  3. The full name of 00878 is “Cathay Taiwan ESG Sustainable High Dividend ETF Fund,” and the tracking index is “MSCI Taiwan ESG Sustainable High Dividend Select 30 Index.” MSCI refers to the abbreviation of Morgan Stanley Capital International, one of the three largest companies in the world and one of the important index companies.
  4. The full name of 00888 is “SinoPac Taiwan ESG Sustainable Quality ETF Securities Investment Trust Fund,” and the tracking index is the FTSE Taiwan ESG Quality Index, which is derived from the FTSE Global Equity Index.

Editing Environment and Module Requirements

This article uses Windows 11 and VS code as the editor.

Data Importation

import os
import pandas as pd

tej_key = 'your key'
api_base = 'https://api.tej.com.tw'

os.environ['TEJAPI_KEY'] = tej_key 
os.environ['TEJAPI_BASE'] = api_base

start = '2018-01-01'
end = '2023-12-31'
stock_list = ['00692', '00850', '00878', '00888', 'IR0001']
calendar_name = 'TEJ'

os.environ['mdate'] = start + ' ' + end
os.environ['ticker'] = ' '.join(stock_list)

!zipline ingest -b tquant

Create backtest function

Create Pipeline function

Pipeline() provides users with the function of quickly processing multiple targets’ quantitative indicators and price and volume data. In this case, we used it to obtain data on four ESG ETFs, which can avoid processing stocks that have yet to be listed.

bundle = bundles.load('tquant')
benchmark_asset = bundle.asset_finder.lookup_symbol('IR0001',as_of_date = None)

def make_pipeline():

    return Pipeline(
        columns = {
            "curr_price": TWEquityPricing.close.latest,
    },
        screen = ~StaticAssets([benchmark_asset])
    )
my_pipeline = run_pipeline(make_pipeline(), pd.Timestamp(start, tz='UTC'), pd.Timestamp(end, tz='UTC'))
ESG ETF
Displaying Pipeline calculation results.

Create initialize function

The initialize() function is used to define the daily trading environment before the start of trading. In this example, we set:

  • Slippage cost
  • Commission fees
  • Returns index (IX0001) as the benchmark index
  • Import the above calculated Pipeline into the transaction process
def initialize(context):
    set_slippage(slippage.VolumeShareSlippage(volume_limit = 0.025, price_impact = 0.1))
    set_commission(commission.Custom_TW_Commission(min_trade_cost = 20, discount = 1.0, tax = 0.003))
    set_benchmark(symbol('IR0001'))
    attach_pipeline(make_pipeline(), 'mystrats')

Create handle_data function

The handle_data() is an essential function for building a trading strategy. It will be called every day after the backtest starts. The main task of this article is to set an order equal to 25% of the current value of the investment portfolio.

def handle_data(context, data):
    out_dir = pipeline_output('mystrats')
    
    for asset in out_dir.index:
        stock_position = context.portfolio.positions[asset].amount
        if stock_position == 0:
            order_percent(asset, 0.25)

Executing the Trading Strategy

Use run_algorithm() to execute the buy-and-hold ESG ETF set above. Set the trading period from start_date (2018-01-01) to end_date (2023-12-31). The dataset used is tquant, and the initial capital is 1,000,000. The output results are a detailed list of daily performance and transactions.

results = run_algorithm(
    start = pd.Timestamp('2018-01-01', tz='UTC'),
    end = pd.Timestamp('2023-12-31', tz ='UTC'),
    initialize=initialize,
    handle_data=handle_data,
    bundle='tquant',
    data_frequency='daily',
    capital_base=1e7,
    trading_calendar=get_calendar(calendar_name))
ESG ETF
Trading Details

Performance Evaluation Using Pyfolio

returns, positions, transactions = pf.utils.extract_rets_pos_txn_from_zipline(results)
benchmark_rets = results.benchmark_return

# Creating a Full Tear Sheet
pf.create_full_tear_sheet(returns, positions = positions, transactions = transactions,
                            benchmark_rets = benchmark_rets,
                            round_trips=False)
ESG ETF
Backtesting Performance Compared to Benchmark

From the chart above, we can see that the market has a return of 2 times in these 5 years, while the return of buying and holding ESG ETFs is slightly lower, but it still has a cumulative return of more than 1.6 times. In addition, we also see that the fluctuations of the ESG ETF investment group are almost consistent with the broader market, but the annualized volatility and maximum drawdown are 11.57% and -27.08% respectively. This fluctuation range is relatively small compared to the broader market. Moreover, a Beta value < 1 means that the investment team is not sensitive to changes in the overall market. Various indicators show that ESG ETFs are making stable profits at lower risks, reflecting the three major aspects of the ESG concept:

  • Long-term value mindset:ESG companies focus on long-term value creation rather than short-term profit pursuits.
  • Risk management:ESG companies usually pay more attention to risk management, including climate change risks, social responsibility risks, governance risks, etc. These risk management measures can reduce the unknown risks the company faces and reduce the stock’s volatility.
  • Stable profit model:Many ESG companies adopt sustainable business models, such as reducing environmental impact, establishing a robust supply chain, etc. These practices can lead to stable profits and cash flow.

Conclusion

In this implementation, we selected four ESG ETFs as investment targets and used TQuant Lab to conduct a backtest performance analysis of buy-and-hold targets. The backtest results of this four-tier ESG ETF performed well in cumulative and annualized returns, reaching 67.95% and 9.34%, respectively. The annualized volatility and maximum drawdown were 11.57% and -27.08%, respectively. This shows that ESG ETFs have achieved solid returns and controlled risks. The beta value shows that the performance relative to the broader market is relatively stable and less affected by market fluctuations. However, it can be seen from the Sharpe Ratio and Alpha that ESG ETFs have less excess returns, reflecting that the ESG corporate industry attaches great importance to the stability of various company indicators.

Overall, these factors make ESG ETFs stable in performance and less volatile. Investing in ESG ETFs is better for obtaining long-term stable growth than short-term swing returns.

Therefore, readers interested in various trading backtesting scenarios are welcome to purchase relevant solutions from TQuant Lab to construct their trading strategies using high-quality databases.

This is a gentle reminder that this strategy is for reference only and does not represent advice on commodities or investments.

[TQuant Lab] Solving Your Quantitative Finance Pain Points

Comprehensively providing all the tools needed for trading backtesting.

GitHub Source Code

Click Here to GitHub

Extended Reading

About

想看更多內容?快來【登入會員】,享受更多閱讀文章的權限喔!
Back