From cf6a7c83c738a5c0c324d9fbb1a45727cb61cd89 Mon Sep 17 00:00:00 2001 From: "zhangkun9038@dingtalk.com" Date: Sat, 17 May 2025 22:29:04 +0000 Subject: [PATCH] =?UTF-8?q?download.sh=E6=94=AF=E6=8C=81=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E6=95=B0,dryrun.sh=E7=BA=A6=E5=AE=9A=E5=9C=A8dryrun=E5=88=86?= =?UTF-8?q?=E6=94=AF=E8=BF=90=E8=A1=8C,=20=E5=A6=82=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E7=BB=99=E5=87=BA=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- freqtrade/templates/TheForceV7.json | 23 ++++++----- tools/download.sh | 59 ++++++++++++++++++++++++++--- tools/dryrun.sh | 2 +- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/freqtrade/templates/TheForceV7.json b/freqtrade/templates/TheForceV7.json index 18d8f777..fcc51e13 100644 --- a/freqtrade/templates/TheForceV7.json +++ b/freqtrade/templates/TheForceV7.json @@ -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" } \ No newline at end of file diff --git a/tools/download.sh b/tools/download.sh index 90c612e3..dfb24354 100755 --- a/tools/download.sh +++ b/tools/download.sh @@ -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 diff --git a/tools/dryrun.sh b/tools/dryrun.sh index 5d3e6783..93302533 100755 --- a/tools/dryrun.sh +++ b/tools/dryrun.sh @@ -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