Skip to content
All library documents

Approaches to Backtesting Fundamental Equity Strategies

Article Quant Q&A · Author: nosigma

Summary

The document collects suggestions for backtesting equity strategies that use fundamental data. For Zipline, one answer explains that fundamental datasets are generally accessed through Pipeline, so a user may need to implement a custom loader for the chosen dataset; the answer notes that documentation for this work is limited. It also mentions using a platform that supports fundamental data with Zipline or another backtesting engine.

Other responses outline alternatives: build a custom backtester with separate components for data loading, strategy calculations, model signals, and parameter configuration, or use a framework that accepts extra columns alongside price data. These are practical implementation options rather than a comparison based on controlled results. The discussion does not evaluate data quality, point-in-time availability, survivorship bias, or look-ahead bias, all of which can materially affect fundamental backtests. Some recommendations depend on specific services or tools mentioned in the original discussion and may not reflect current availability.

Key ideas

  • Zipline users typically need a custom Pipeline loader to bring fundamental datasets into a backtest.
  • A custom backtester can separate data ingestion, strategy logic, signal models, and configuration.
  • Some backtesting frameworks can accept fundamental values as additional input columns.
  • The discussion offers implementation suggestions but does not assess data biases or compare performance.

Tags

Full text
# Backtesting Fundamental Equity Strategies in Python


# Backtesting Fundamental Equity Strategies in Python












I am trying to run a local backtest using Python and Zipline seems to be the most popular package out there. Does any one have isnight on ingesting fundamental data for the backtest? The documentation is limited on the topic.

Alternatively if anyone has other suggestions on backtesting fundamental data that would be welcome as well.

## Answer by Brian from QuantRocket (score 2, accepted)

https://quant.stackexchange.com/a/40870

Unlike price data which is ingested as a bundle, fundamental data in Zipline is usually used via Pipeline and thus requires writing a custom `PipelineLoader` that knows how to load the particular fundamental dataset you're using. I'm not aware of much documentation for writing a custom `PipelineLoader` apart from digging into the source code.

As an alternative, QuantRocket supports pulling a variety of fundamental datasets and backtesting with either Zipline or Moonshot. QuantRocket's Code Library contains some example strategies that use fundamental data.

## Answer by V. Foo (score 1)

https://quant.stackexchange.com/a/43575

I think the best way is not using Python lib since it can difficult to see what code is behind, even if you can have access to the source code. The best way is to develop your own BT, using the following structure :

- A script for loading data (you have two solutions, first there are plenty of paying API for loading data. In my case, I use BeautifulSoup package to scrap data from Yahoo, google, etc. You can have access to historical and tick data). This script will load data and format your data (best way is as series since its faster). You can also use the MongoDB or DropBox API. In my case, I use free dropbox API to store my database and my script will request this API

- A Main script for the BT. For exemple an Abstractclass "Backtester". And the, you will create "EquityBasket(Backtester)", "MeanReversion(Backtester)" etc for each strategies; These scripts will be purely maths script to compute the weights, quantities, returns etc

- The same structure of script as for Backtester but for algorithm used. In fact, you will have the possibility, in "MeanReversion(Backtester)" to create a self._model(XX) and then in the compute of the mean reversion signal for exemple : signal : self._model.get_signals() etc

- Finally, a kind of console to call each script. The parameters should be store as a JSON in a txt file to make in the console : params = get_params_from_json, bt = MeanReversion(params), and then res = bt.run.

I hope it's clear, i have work on many BT scripts, do not hesitate if you have further questions

## Answer by Jay (score 0)

https://quant.stackexchange.com/a/43257

An online alternative I used in the past is Quantopian - the authors of Zipline. Python based, sign up is free, access to Morningstar Fundamentals, excellent inbuilt research environment using Jupyter, great tear sheets for backtesting, very good tutorials + documentation, and a very active community.

You can submit your algorithms to compete in a contest, and receive direct funding.

## Answer by K3---rnc (score 0)

https://quant.stackexchange.com/a/43573

Backtesting.py supports any kind of OHLC data. If you'd like to feed it other fundamental data, you just add extra columns to the input data frame.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.