Skip to content
All library documents

Choosing a Backtesting Tool for Equal-Weight Trades from a CSV

Article Quant Q&A · Author: David Serero

Summary

The question describes a trade list with tickers, buy dates, and sell dates, and asks how to evaluate its performance when each stock receives equal weight. The response points to Backtrader as a Python library for building and running backtests. It offers a starting point for implementation, but does not explain how to turn the listed trades into portfolio returns or specify software settings for equal weighting.

The exchange gives no worked calculation, comparison of backtesting tools, or discussion of assumptions such as overlapping positions, cash allocation, transaction costs, or how to handle dates when only some holdings are active. Readers would need to define those choices and verify that any chosen tool applies weights and measures returns as intended. The recommendation is brief, so it serves mainly as a pointer to a tool rather than a complete backtesting method.

Key ideas

  • The input data lists each stock's entry and exit dates.
  • The portfolio is intended to give each stock equal weight.
  • The response recommends Backtrader as a Python backtesting library.
  • The exchange does not specify how to calculate portfolio returns or account for trading costs.

Tags

Full text
# What’s the best Backtest Software/method?


# What’s the best Backtest Software/method?












I have a CSV which looks like this.

Ticker | Buy Date | Sell date

AAPL | 2018-01-03 | 2019-03-30

TSLA | 2019-03-01| 2019-04-05

What’s the best way to backtest this CSV performance given that every stock is given equal weight?

Looking for a software or python script.

## Answer by Matteo (score 2)

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

If you use Python one of the most complete library for doing backtest is "Backtrader". Have a look at the GitHub page: https://github.com/mementum/backtrader

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.