This commit is contained in:
zhangkun9038@dingtalk.com 2025-05-14 04:50:31 +00:00
parent ff26d32726
commit 9a50029e7b
2 changed files with 17 additions and 1 deletions

1
.gitignore vendored
View File

@ -125,4 +125,5 @@ data/
output.log
output_filted.log
tools/.env
result/

View File

@ -1,11 +1,26 @@
#!/bin/bash
# 检查 .env 文件
if [ ! -f ".env" ]; then
echo "⚠️ 本地缺少 .env 文件,请创建并配置。示例内容如下:"
echo ""
echo "STRATEGY_NAME=TheForceV7"
echo "CONFIG_FILE=basic.json"
echo "TEST_BRANCH=theforce-noai-test"
echo "DRYRUN_BRANCH=theforce-noai-dryrun"
echo ""
exit 1
fi
# 加载 .env 文件中的变量
export $(grep -v '^#' .env | xargs)
# 设置默认值
STRATEGY_NAME=${STRATEGY_NAME:-TheForceV7}
CONFIG_FILE=${CONFIG_FILE:-basic.json}
echo "Using strategy: $STRATEGY_NAME"
echo "Using config: $CONFIG_FILE"
echo "Using testBranch: $TEST_BRANCH"
# Parse command line arguments
START_DATE=${1:-$(date -d "2 days ago" +"%Y%m%d")}
END_DATE=${2:-$(date -d "tomorrow" +"%Y%m%d")}
@ -21,7 +36,7 @@ freqtrade backtesting \
--logfile ./user_data/logs/freqtrade.log \
--freqaimodel XGBoostRegressor \
--strategy $STRATEGY_NAME \
--config $CONFIG_FILE \
--config config_examples/$CONFIG_FILE \
--strategy-path ./freqtrade/templates \
--timerange ${START_DATE}-${END_DATE} \
--breakdown week month \