create_benchmark_equity_curves#
API documentation for tradeexecutor.visual.benchmark.create_benchmark_equity_curves Python function.
- create_benchmark_equity_curves(strategy_universe, pairs, initial_cash, custom_colours={'AAVE': '#F289DA', 'ARB': 'red', 'All cash': 'black', 'BTC': 'orange', 'DOGE': 'darkorange', 'ETH': 'blue', 'MATIC': 'purple', 'MKR': '#1AAB9B', 'PEPE': 'darkmagenta', 'SOL': 'lightblue', 'Strategy': 'green'}, convert_to_daily=False)[source]#
Create data series of different buy-and-hold benchmarks.
Create different benchmark indexes to compare y our backtest results against
Has default colours set for BTC and ETH pair labels
See also
Output be given e.g. to
tradeexecutor.analysis.grid_search.visualise_grid_search_equity_curves()
Example:
from tradeexecutor.analysis.grid_search import visualise_grid_search_equity_curves from tradeexecutor.visual.benchmark import create_benchmark_equity_curves # List of pair descriptions we used to look up pair metadata our_pairs = [ (ChainId.centralised_exchange, "binance", "BTC", "USDT"), (ChainId.centralised_exchange, "binance", "ETH", "USDT"), ] benchmark_indexes = create_benchmark_equity_curves( strategy_universe, {"BTC": our_pairs[0], "ETH": our_pairs[1]}, initial_cash=StrategyParameters.initial_cash, ) fig = visualise_grid_search_equity_curves( grid_search_results, benchmark_indexes=benchmark_indexes, ) fig.show()
- Parameters:
strategy_universe (TradingStrategyUniverse) – Strategy universe from where we
pairs (Dict[str, Union[Tuple[ChainId, str | None, str, str, float], Tuple[ChainId, str | None, str, str], TradingPairIdentifier]]) –
Trading pairs benchmarked.
In a format short label : pair description.
initial_cash (float) –
The value for all cash benchmark and the initial backtest deposit.
All cash is that you would just sit on the top of the cash pile since start of the backtest.
custom_colours – Apply these colours on the benchmark series
- Returns:
Pandas DataFrame.
DataFrame has series labelled “BTC”, “ETH”, “All cash”, etc.
DataFrame and its series’ attrs contains colour information for well-known pairs.
- Return type:
DataFrame