update downlaod

This commit is contained in:
zhangkun9038@dingtalk.com 2025-05-16 12:41:59 +00:00
parent 66492da604
commit 209f7323e7

View File

@ -1,4 +1,43 @@
#!/bin/bash
docker-compose run --rm freqtrade download-data --config /freqtrade/config_examples/basic.json --pairs BTC/USDT OKB/USDT OKB/BTC XRP/USDT --timeframe 5m 15m 30m 1h 4h 6h 12h 1d
# Function to extract the value of a parameter
get_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 "Error: Parameter $param not found" >&2
exit 1
}
if [[ "$@" == *"--timerange"* ]] && [[ "$@" == *"--days"* ]]; then
echo "Error: Both --timerange and --days cannot be provided."
exit 1
fi
echo days: $days
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 OKB/BTC XRP/USDT --timeframe 1m 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 OKB/BTC XRP/USDT --timeframe 1m 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 OKB/BTC XRP/USDT --timeframe 1m 3m 5m 15m 30m 1h 4h 6h 12h 1d
fi