preprocessed_backtest#

API documentation for tradeexecutor.backtest.preprocessed_backtest Python module in Trading Strategy.

Module description#

Preprocessed datasets.

  • Generate preprocessed backtest histories with certain parameters

  • Generated sets are free from survivorship bias, by having inclusion criteria as historical TVL threshold

To export / update all exported data:

python tradeexecutor/backtest/preprocessed_backtest_exporter.py ~/exported

Run using Docker. Created files will be placed in ~/exported in the host FS:

mkdir ~/exported
# Get from https://github.com/tradingstrategy-ai/trade-executor/actions
export TRADE_EXECUTOR_VERSION=latest
docker run         -it         --entrypoint /usr/local/bin/python         --env TRADING_STRATEGY_API_KEY         -v ~/exported:/exported         -v ~/.cache:/root/.cache         ghcr.io/tradingstrategy-ai/trade-executor:${TRADE_EXECUTOR_VERSION}         /usr/src/trade-executor/tradeexecutor/backtest/preprocessed_backtest_exporter.py /exported

Classes#

BacktestDatasetDefinion

Predefined backtesting dataset

SavedDataset

SavedDataset(set: tradeexecutor.backtest.preprocessed_backtest.BacktestDatasetDefinion, parquet_path: pathlib.Path, csv_path: pathlib.Path, parquet_file_size: int, csv_file_size: int, pair_count: int, row_count: int, duration: datetime.timedelta | None)

Functions#

make_base_symbol(row)

Generate a base symbol.

make_full_ticker(row)

Generate a base-quote ticker for a pair.

make_link(row)

Get TradingStrategy.ai explorer link for the trading data

make_simple_ticker(row)

Generate a ticker for a pair with fee and DEX info.

prepare_dataset(client, dataset, output_folder)

Prepare a predefined backtesting dataset.

run_and_write_report(output_html, ...[, ...])