update dryrun.sh+2

This commit is contained in:
zhangkun9038@dingtalk.com 2025-11-26 11:49:18 +08:00
parent 21a467568c
commit e7268a84ea

View File

@ -268,18 +268,14 @@ echo "✅ 远程币对列表URL: $PAIR_REMOTE_LIST_URL" >&2
### 核心:处理币对列表 ###
# 初始化 PAIRS_FLAG
PAIRS_FLAG=""
# 0. 判断是否使用 --pairs 传入的币对列表
if [ -n "$PAIRS_ARG" ]; then
echo "✅ 使用命令行 --pairs 参数:$PAIRS_ARG" >&2
PAIRS_FLAG="--pairs $PAIRS_ARG"
# 简化处理:直接使用提供的币对,是否更新配置文件取决于是否有配置文件
if [ -f "../config_examples/live.json" ]; then
update_live_json_pair_whitelist "../config_examples/live.json" "$PAIRS_ARG"
# 更新配置文件中的 pair_whitelist
if [ -f "../config_examples/$CONFIG_FILE" ]; then
update_live_json_pair_whitelist "../config_examples/$CONFIG_FILE" "$PAIRS_ARG"
else
echo "⚠️ 找不到 ../config_examples/live.json跳过配置更新" >&2
echo "⚠️ 找不到 ../config_examples/$CONFIG_FILE,跳过配置更新" >&2
fi
else
# 使用旧的逻辑:数据库 + 遥程 API
@ -296,11 +292,10 @@ else
merged_pairs=$(merge_and_deduplicate_pairs "$db_pairs" "$remote_pairs")
# 4. 更新配置文件
update_live_json_pair_whitelist "../config_examples/live.json" "$merged_pairs"
# 5. 构建 PAIRS_FLAG如果有币对
if [ -n "$merged_pairs" ]; then
PAIRS_FLAG="--pairs $merged_pairs"
if [ -f "../config_examples/$CONFIG_FILE" ]; then
update_live_json_pair_whitelist "../config_examples/$CONFIG_FILE" "$merged_pairs"
else
echo "⚠️ 找不到 ../config_examples/$CONFIG_FILE,跳过配置更新" >&2
fi
fi
@ -316,7 +311,6 @@ remove_existing_container "$CONTAINER_NAME"
# 启动新容器
docker-compose run -d --rm --name freqtrade-dryrun-${GIT_COMMIT_SHORT} -p 8080:8080 freqtrade trade \
$PAIRS_FLAG \
--logfile /freqtrade/user_data/logs/freqtrade.log \
--db-url sqlite:////freqtrade/user_data/tradesv3.sqlite \
--dry-run \