backtest支持参数化使用其他策略
This commit is contained in:
parent
1dfdf2ac70
commit
eb7ffa8348
@ -205,31 +205,26 @@ if [ -n "$CONFIG_ARG" ]; then
|
||||
echo "Overriding config with command line parameter: $CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# 检查指定的配置文件是否存在,如果不存在则使用默认配置
|
||||
echo "Checking config file: freqtrade/templates/$CONFIG_FILE"
|
||||
if [ ! -f "../freqtrade/templates/$CONFIG_FILE" ]; then
|
||||
echo "Warning: Config file freqtrade/templates/$CONFIG_FILE not found, using default configuration"
|
||||
CONFIG_FILE="basic.json"
|
||||
else
|
||||
echo "Config file found: freqtrade/templates/$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
cd ../
|
||||
source .venv/bin/activate
|
||||
rm -rf user_data/models/*
|
||||
rm -rf ./freqtrade/user_data/data/backtest_results/*
|
||||
rm -fr ./user_data/dryrun_results/*
|
||||
rm result/*
|
||||
|
||||
# 根据策略名称确定对应的配置文件
|
||||
# 每个策略类对应两个配置文件:
|
||||
# 1. 策略文件 (.py) 在 freqtrade/templates/ 目录下
|
||||
# 2. 配置文件 (.json) 在 config_examples/ 和 freqtrade/templates/ 目录下
|
||||
STRATEGY_CONFIG_FILE="${STRATEGY_NAME%.py}.json"
|
||||
|
||||
# 检查配置文件是否存在,如果不存在则使用默认配置
|
||||
if [ ! -f "../config_examples/$STRATEGY_CONFIG_FILE" ]; then
|
||||
echo "Warning: Strategy config file ../config_examples/$STRATEGY_CONFIG_FILE not found, using default configuration"
|
||||
STRATEGY_CONFIG_FILE="basic.json"
|
||||
fi
|
||||
rm -f result/*
|
||||
|
||||
echo "docker-compose run --rm freqtrade backtesting $PAIRS_FLAG \
|
||||
--logfile /freqtrade/user_data/logs/freqtrade.log \
|
||||
--freqaimodel LightGBMRegressorMultiTarget \
|
||||
--config /freqtrade/config_examples/$CONFIG_FILE \
|
||||
--config /freqtrade/config_examples/$STRATEGY_CONFIG_FILE \
|
||||
--config /freqtrade/templates/$STRATEGY_CONFIG_FILE \
|
||||
--config /freqtrade/templates/$CONFIG_FILE \
|
||||
--strategy-path /freqtrade/templates \
|
||||
--strategy $STRATEGY_NAME \
|
||||
--timerange $START_DATE-$END_DATE \
|
||||
@ -240,9 +235,7 @@ echo "docker-compose run --rm freqtrade backtesting $PAIRS_FLAG \
|
||||
docker-compose run --rm freqtrade backtesting $PAIRS_FLAG \
|
||||
--logfile /freqtrade/user_data/logs/freqtrade.log \
|
||||
--freqaimodel LightGBMRegressorMultiTarget \
|
||||
--config /freqtrade/config_examples/$CONFIG_FILE \
|
||||
--config /freqtrade/config_examples/$STRATEGY_CONFIG_FILE \
|
||||
--config /freqtrade/templates/$STRATEGY_CONFIG_FILE \
|
||||
--config /freqtrade/templates/$CONFIG_FILE \
|
||||
--strategy-path /freqtrade/templates \
|
||||
--enable-protections \
|
||||
--strategy $STRATEGY_NAME \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user