download.sh支持传参数,dryrun.sh约定在dryrun分支运行, 如果不是给出警告

This commit is contained in:
zhangkun9038@dingtalk.com 2025-05-17 22:29:04 +00:00
parent 454b2e5b98
commit cf6a7c83c7
3 changed files with 69 additions and 15 deletions

View File

@ -1,13 +1,6 @@
{
"strategy_name": "TheForceV7",
"params": {
"roi": {},
"trailing": {
"trailing_stop": false,
"trailing_stop_positive": null,
"trailing_stop_positive_offset": 0.0,
"trailing_only_offset_is_reached": false
},
"max_open_trades": {
"max_open_trades": 3
},
@ -20,10 +13,22 @@
"rsi_sell": 60
},
"protection": {},
"roi": {
"0": 0.23399999999999999,
"32": 0.06,
"91": 0.026,
"195": 0
},
"stoploss": {
"stoploss": -0.061
"stoploss": -0.108
},
"trailing": {
"trailing_stop": true,
"trailing_stop_positive": 0.054,
"trailing_stop_positive_offset": 0.12,
"trailing_only_offset_is_reached": false
}
},
"ft_stratparam_v": 1,
"export_time": "2025-05-15 12:57:22.019801+00:00"
"export_time": "2025-05-17 17:07:27.574446+00:00"
}

View File

@ -27,17 +27,66 @@ get_param_value() {
exit 1
}
# Function to extract comma-separated values
get_csv_param_value() {
local param="$1"
shift
while [[ $# -gt 0 ]]; do
case "$1" in
$param=*)
echo "${1#*=}"
return
;;
$param)
# Check if the next argument exists and does not start with a dash
if [[ -n "$2" && "$2" != -* ]]; then
echo "$2"
return
else
echo "Error: Missing value for parameter $param" >&2
exit 1
fi
;;
esac
shift
done
echo ""
return
}
if [[ "$@" == *"--timerange"* ]] && [[ "$@" == *"--days"* ]]; then
echo "Error: Both --timerange and --days cannot be provided."
exit 1
fi
echo days: $days
# Get timerange or days from parameters
if [[ "$@" == *"--timerange"* ]]; then
timerange=$(get_param_value "--timerange" "$@")
docker-compose run --rm freqtrade download-data --config /freqtrade/config_examples/basic.json --pairs BTC/USDT OKB/USDT TON/USDT DOT/USDT SOL/USDT XRP/USDT --timeframe 3m 5m 15m 30m 1h 4h 6h 12h 1d --timerange $timerange
elif [[ "$@" == *"--days"* ]]; then
days=$(get_param_value "--days" "$@")
docker-compose run --rm freqtrade download-data --config /freqtrade/config_examples/basic.json --pairs BTC/USDT OKB/USDT TON/USDT DOT/USDT SOL/USDT XRP/USDT --timeframe 3m 5m 15m 30m 1h 4h 6h 12h 1d --days $days
else
docker-compose run --rm freqtrade download-data --config /freqtrade/config_examples/basic.json --pairs BTC/USDT OKB/USDT TON/USDT DOT/USDT SOL/USDT XRP/USDT --timeframe 3m 5m 15m 30m 1h 4h 6h 12h 1d
fi
# Get pairs and timeframe from parameters or use defaults
pairs=$(get_csv_param_value "--pairs" "$@")
timeframe=$(get_csv_param_value "--timeframe" "$@")
# Use default values if parameters are not provided
if [[ -z "$pairs" ]]; then
pairs="BTC/USDT,OKB/USDT,TON/USDT,DOT/USDT,SOL/USDT,XRP/USDT"
fi
if [[ -z "$timeframe" ]]; then
timeframe="3m,5m,15m,30m,1h,4h,6h,12h,1d"
fi
# Initialize the base command
cmd="docker-compose run --rm freqtrade download-data --config /freqtrade/config_examples/basic.json --pairs $pairs --timeframe $timeframe"
# Add timerange or days if provided
if [[ -n "$timerange" ]]; then
cmd+=" --timerange $timerange"
elif [[ -n "$days" ]]; then
cmd+=" --days $days"
fi
# Execute the command
eval $cmd

View File

@ -65,7 +65,7 @@ docker-compose run -d --rm --name freqtrade-dryrun-${GIT_COMMIT_SHORT} -p 8080:8
--freqaimodel LightGBMRegressor \
--config /freqtrade/config_examples/$CONFIG_FILE \
--strategy $STRATEGY_NAME \
--fee 0.0016 \
--fee 0.0008 \
--strategy-path /freqtrade/templates
#python3 tools/filter.py