Skip to content
All library documents

Backtesting Daily Multi-Asset Crypto Strategies

Article Quant Q&A · Author: md1630

Summary

The document addresses how to backtest a strategy that trades a list of cryptocurrencies on a daily schedule. It recommends considering Backtrader, which supports event-driven strategies across multiple assets, and mentions Zipline as another possible framework. A cited example applies portfolio rebalancing to a fixed universe of stocks: assets are ranked, top-ranked names are bought, bottom-ranked names are sold, and target orders are set for the selected holdings.

The central modeling idea is to evaluate signals across both assets and time, then rebalance the portfolio according to the strategy's conditions. The document does not specify the user's trading rules, data needs, or execution assumptions, so it cannot determine which library will fit best. For unusually complex strategies, it suggests implementing a custom backtester to control the cross-asset and time-based logic. It provides no comparative benchmarks or validation results for the named tools.

Key ideas

  • Backtrader can model event-driven strategies that trade multiple assets.
  • Zipline is offered as another Python backtesting framework to consider.
  • A fixed asset universe can be rebalanced using cross-sectional rankings and target orders.
  • Multi-asset backtests need to evaluate strategy conditions across assets and through time.
  • A custom backtester may be appropriate when a strategy's logic exceeds a library's capabilities.

Tags

Full text
# python library for backtesting buying and selling multiple cryptos


# python library for backtesting buying and selling multiple cryptos












What is a good python backtesting library to use if I want to test buying and selling a list of different cryptocurrencies every day? Most libraries I find like backtesting.py and pyalgotrade are event-drive based on signals from a single asset. I would like to test an algorithm that buys a list of different assets every day. Any suggestions?

## Answer by Pleb (score 3, accepted)

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

### Take a look at Backtrader:

There is an extensive backtesting Python library called `Backtrader` (link to Github repository), which from the documentation, supports event-based strategies across multiple assets. Due to the core community behind it, the library frequently gets updated with additional functionality (it has a whopping 122 built-in indicators). I have provided a link to the documentation.

Other than that, I have found an example where they backtest the strategy of this paper, across a subset of stocks. As long as the asset universe is fixed, then it can rebalance across asset-dimension based on some conditions. In the example, the conditions for rebalancing are based on Buying and selling top- and bottom-ranked stocks respectively and setting a target order for top-ranked stocks.

This seems like the same setup you're requesting in your question. Though, it is hard to tell, when you haven't disclosed your strategy. Here are some more examples. You can determine whether any of them fit your own scenario.

Alternatively, you could try `Zipline` (link here), which is another backtesting Python library. In the end, if your strategy is too "complex" (in one way or another) it is best to code your own backtester, where you check your signals across asset dimension and through time. This is the same as rebalancing a portfolio of assets, based on some conditions relative to the asset- and time-dimension. I hope this provide some insight.

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.