Freqtrade - 快速开始Quick Start
目录
一、Initialize the configuration 初始化配置
1. 第一步
2. 第二步
二、Modify config 修改配置
三、Download data 下载数据
四、Backtest 回测
1.修改配置
2.执行回测
五、Trade 交易
先需要安装好,建议docker安装。
一、Initialize the configuration 初始化配置
# Step 1 - Initialize user folder
freqtrade create-userdir --userdir user_data1# Step 2 - Create a new configuration file
freqtrade new-config --config user_data1/config.json
1. 第一步
第一步 初始化用户文件夹
要保证进入了对应的python环境。
freqtrade create-userdir --userdir user_data1
2. 第二步
freqtrade new-config --config user_data1/config.json
可以安装我的截图一样,选择对应的选项或数字。
此时,可以看到文件夹中多了一堆东西:
二、Modify config 修改配置
在config.json中打开并找到 pair_whitelist,
将原本为空的修改为:
"pair_whitelist": ["BTC/USDT","ETH/USDT"],
保存,关闭。
三、Download data 下载数据
freqtrade download-data --config user_data1/config.json --userdir user_data1 --days 9 -t 5m
但是到后面会报错:
"msg": "Service unavailable from a restricted location according to 'b.
Eligibility' in https://www.binance.com/en/terms. Please contact customer
service if you believe you received this message in error."
}". Retrying still for 2 times.
2025-10-03 17:18:58,099 - freqtrade.exchange.common - WARNING -
_load_async_markets() returned exception: "Error in reload_markets due to
ExchangeNotAvailable. Message: binance GET
https://api.binance.com/api/v3/exchangeInfo 451 {"code": 0,"msg": "Service unavailable from a restricted location according to 'b.
Eligibility' in https://www.binance.com/en/terms. Please contact customer
service if you believe you received this message in error."
}". Retrying still for 1 times.
2025-10-03 17:18:58,426 - freqtrade.exchange.common - WARNING -
_load_async_markets() returned exception: "Error in reload_markets due to
ExchangeNotAvailable. Message: binance GET
https://api.binance.com/api/v3/exchangeInfo 451 {"code": 0,"msg": "Service unavailable from a restricted location according to 'b.
Eligibility' in https://www.binance.com/en/terms. Please contact customer
service if you believe you received this message in error."
}". Giving up.
2025-10-03 17:18:58,428 - freqtrade.exchange.exchange - ERROR - Could not load
markets.
Traceback (most recent call last):File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/exchange/exchange.py
", line 654, in _api_reload_marketsawait self._api_async.load_markets(reload=reload, params={})File
"/Users/test1/py_env/freq/lib/python3.11/site-packages/ccxt/async_support/base/e
xchange.py", line 338, in load_marketsraise eFile
"/Users/test1/py_env/freq/lib/python3.11/site-packages/ccxt/async_support/base/e
xchange.py", line 330, in load_marketsresult = await self.markets_loading^^^^^^^^^^^^^^^^^^^^^^^^^^File
"/Users/test1/py_env/freq/lib/python3.11/site-packages/ccxt/async_support/base/e
xchange.py", line 297, in load_markets_helpermarkets = await self.fetch_markets(params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...File
"/usr/local/Cellar/python@3.11/3.11.13_1/Frameworks/Python.framework/Versions/3.
11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_completereturn future.result()^^^^^^^^^^^^^^^File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/exchange/exchange.py
", line 658, in _api_reload_marketsraise TemporaryError(
freqtrade.exceptions.TemporaryError: Error in reload_markets due to
ExchangeNotAvailable. Message: binance GET
https://api.binance.com/api/v3/exchangeInfo 451 {"code": 0,"msg": "Service unavailable from a restricted location according to 'b.
Eligibility' in https://www.binance.com/en/terms. Please contact customer
service if you believe you received this message in error."
}
2025-10-03 17:18:58,469 - freqtrade - ERROR - Markets were not loaded.
原因:
你现在的 IP 地址所在地区被 Binance 限制访问(符合他们的 地理合规限制,比如美国、中国大陆、新加坡等)。
Freqtrade 在加载 Binance 市场信息时,被 Binance 拒绝了,所以报 ExchangeNotAvailable
。
解决办法:
clash切换到japan,全局global
(freq) test1@budas-MacBook-Pro freq_data % freqtrade download-data --config user_data1/config.json --userdir user_data1 --days 9 -t 5m2025-10-03 17:25:47,526 - freqtrade - INFO - freqtrade 2025.9
2025-10-03 17:25:47,791 - numexpr.utils - INFO - NumExpr defaulting to 8
threads.
2025-10-03 17:25:48,871 - freqtrade.configuration.load_config - INFO - Using
config: user_data1/config.json ...
2025-10-03 17:25:48,874 - freqtrade.loggers - INFO - Enabling colorized output.
2025-10-03 17:25:48,874 - freqtrade.loggers - INFO - Logfile configured
2025-10-03 17:25:48,875 - freqtrade.loggers - INFO - Verbosity set to 0
2025-10-03 17:25:48,876 - freqtrade.configuration.configuration - INFO - Using
user-data directory: user_data1 ...
2025-10-03 17:25:48,876 - freqtrade.configuration.configuration - INFO - Using
data directory: user_data1/data/binance ...
2025-10-03 17:25:48,877 - freqtrade.configuration.configuration - INFO -
timeframes --timeframes: ['5m']
2025-10-03 17:25:48,877 - freqtrade.configuration.configuration - INFO -
Detected --days: 9
2025-10-03 17:25:48,878 - freqtrade.exchange.check_exchange - INFO - Checking
exchange...
2025-10-03 17:25:48,893 - freqtrade.exchange.check_exchange - INFO - Exchange
"binance" is officially supported by the Freqtrade development team.
2025-10-03 17:25:48,894 - freqtrade.configuration.configuration - INFO - Using
pairlist from configuration.
2025-10-03 17:25:48,894 - freqtrade.configuration.config_validation - INFO -
Validating configuration ...
2025-10-03 17:25:48,921 - freqtrade.exchange.exchange - INFO - Instance is
running with dry_run enabled
2025-10-03 17:25:48,921 - freqtrade.exchange.exchange - INFO - Using CCXT 4.5.5
2025-10-03 17:25:48,945 - freqtrade.exchange.exchange - INFO - Using Exchange
"Binance"
2025-10-03 17:25:48,946 - freqtrade.resolvers.exchange_resolver - INFO - Using
resolved exchange 'Binance'...
2025-10-03 17:25:48,947 - freqtrade.exchange.exchange - INFO - Markets were not
loaded. Loading them now..
2025-10-03 17:25:54,263 - freqtrade.exchange.common - WARNING -
_load_async_markets() returned exception: "Error in reload_markets due to
ExchangeNotAvailable. Message: binance GET
https://fapi.binance.com/fapi/v1/exchangeInfo". Retrying still for 3 times.
2025-10-03 17:25:59,314 - freqtrade.data.history.history_utils - INFO - About to
download pairs: ['BTC/USDT', 'ETH/USDT'], intervals: ['5m'] to
user_data1/data/binance
2025-10-03 17:25:59,319 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):File "/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/main.py",
line 47, in mainreturn_code = args["func"](args)^^^^^^^^^^^^^^^^^^File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/commands/data_comman
ds.py", line 40, in start_download_datadownload_data_main(config)File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/data/history/history
_utils.py", line 684, in download_data_maindownload_data(config, exchange)File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/data/history/history
_utils.py", line 784, in download_datapairs_not_available = refresh_backtest_ohlcv_data(^^^^^^^^^^^^^^^^^^^^^^^^^^^^File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/data/history/history
_utils.py", line 373, in refresh_backtest_ohlcv_datadata_handler = get_datahandler(datadir, data_format)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/data/history/datahan
dlers/idatahandler.py", line 582, in get_datahandlerHandlerClass = get_datahandlerclass(data_format or "feather")^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/data/history/datahan
dlers/idatahandler.py", line 561, in get_datahandlerclassfrom .featherdatahandler import FeatherDataHandlerFile
"/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/data/history/datahan
dlers/featherdatahandler.py", line 4, in <module>from pyarrow import dataset
ModuleNotFoundError: No module named 'pyarrow'
这里是pyarrow问题,不是原来的 问题了。
修复好后(可以看我的安装教程帖子),重新执行。
(freq) test1@budas-MacBook-Pro freq_data % pip show pyarrow
Name: pyarrow
Version: 21.0.0
Summary: Python library for Apache Arrow
Home-page: https://arrow.apache.org/
Author:
Author-email:
License: Apache Software License
Location: /Users/test1/py_env/freq/lib/python3.11/site-packages
Requires:
Required-by: freqtrade
(freq) test1@budas-MacBook-Pro freq_data % python -c "import pyarrow; print(pyarrow.__version__)"21.0.0
(freq) test1@budas-MacBook-Pro freq_data % freqtrade download-data --config user_data1/config.json --userdir user_data1 --days 9 -t 5m
2025-10-03 23:18:02,289 - freqtrade - INFO - freqtrade 2025.9
2025-10-03 23:18:05,754 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.
2025-10-03 23:18:08,076 - freqtrade.configuration.load_config - INFO - Using config: user_data1/config.json ...
2025-10-03 23:18:08,080 - freqtrade.loggers - INFO - Enabling colorized output.
2025-10-03 23:18:08,080 - freqtrade.loggers - INFO - Logfile configured
2025-10-03 23:18:08,081 - freqtrade.loggers - INFO - Verbosity set to 0
2025-10-03 23:18:08,082 - freqtrade.configuration.configuration - INFO - Using user-data directory: user_data1 ...
2025-10-03 23:18:08,082 - freqtrade.configuration.configuration - INFO - Using data directory: user_data1/data/binance ...
2025-10-03 23:18:08,083 - freqtrade.configuration.configuration - INFO - timeframes --timeframes: ['5m']
2025-10-03 23:18:08,083 - freqtrade.configuration.configuration - INFO - Detected --days: 9
2025-10-03 23:18:08,084 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2025-10-03 23:18:08,099 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade
development team.
2025-10-03 23:18:08,100 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2025-10-03 23:18:08,101 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2025-10-03 23:18:08,154 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2025-10-03 23:18:08,155 - freqtrade.exchange.exchange - INFO - Using CCXT 4.5.5
2025-10-03 23:18:08,181 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2025-10-03 23:18:08,181 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
2025-10-03 23:18:08,182 - freqtrade.exchange.exchange - INFO - Markets were not loaded. Loading them now..
2025-10-03 23:18:11,860 - freqtrade.data.history.history_utils - INFO - About to download pairs: ['BTC/USDT', 'ETH/USDT'],
intervals: ['5m'] to user_data1/data/binance
2025-10-03 23:18:15,755 - freqtrade.data.history.history_utils - INFO - Download history data for "BTC/USDT", 5m, spot and store
in user_data1/data/binance. From 2025-09-24T00:00:00 to now
2025-10-03 23:18:19,881 - freqtrade.exchange.binance_public_data - WARNING - An exception raised: Cannot connect to host
data.binance.vision:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
unable to get local issuer certificate (_ssl.c:1016)')]
2025-10-03 23:18:21,234 - freqtrade.data.history.history_utils - INFO - Downloaded data for BTC/USDT with length 2775.
2025-10-03 23:18:22,031 - freqtrade.data.history.history_utils - INFO - Download history data for "ETH/USDT", 5m, spot and store
in user_data1/data/binance. From 2025-09-24T00:00:00 to now
2025-10-03 23:18:24,044 - freqtrade.exchange.binance_public_data - WARNING - An exception raised: Cannot connect to host
data.binance.vision:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
unable to get local issuer certificate (_ssl.c:1016)')]
2025-10-03 23:18:24,537 - freqtrade.data.history.history_utils - INFO - Downloaded data for ETH/USDT with length 2775.
Timeframe ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/1 100% • 0:00:06 • 0:00:00
Downloading ETH/USDT ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 100% • 0:00:08 • 0:00:00
(freq) test1@budas-MacBook-Pro freq_data %
(freq) test1@budas-MacBook-Pro freq_data % ls user_data1/data/binance
BTC_USDT-5m.feather ETH_USDT-5m.feather
说明已经下载好数据了。
四、Backtest 回测
1.修改配置
先修改config.json配置。
将
"pairlists": [{"method": "VolumePairList","number_assets": 20,"sort_key": "quoteVolume","min_value": 0,"refresh_period": 1800}],
修改成:
"pairlists": [{"method": "StaticPairList"}],
保存。
json最好用IDE或者notepad++打开,否则格式出错。
检查出来空格有问题,替换掉。
2.执行回测
回测命令:
freqtrade backtesting --config user_data1/config.json --userdir user_data1 --strategy SampleStrategy
报错:
(freq) test1@budas-MacBook-Pro freq_data % freqtrade trade --config user_data1/config.json --userdir user_data1 --strategy SampleStrategy
2025-10-04 10:14:36,324 - freqtrade - INFO - freqtrade 2025.9
2025-10-04 10:14:36,690 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.
2025-10-04 10:14:38,013 - freqtrade.worker - INFO - Starting worker 2025.9
2025-10-04 10:14:38,014 - freqtrade.configuration.load_config - INFO - Using config: user_data1/config.json ...
2025-10-04 10:14:38,015 - freqtrade - ERROR - Configuration error: Parse error at offset 1149: Missing a name for object member.
Please verify the following segment of your configuration:],"pair_blacklist": ["BNB/.*"]},"pairlists": [{"method": "StaticPairList",
Please make sure to review the documentation at https://www.freqtrade.io/en/stable.
其实是json解析错误,我们要检查config.json
修复后再重新执行:
(freq) test1@budas-MacBook-Pro freq_data % freqtrade backtesting --config user_data1/config.json --userdir user_data1 --strategy SampleStrategy
2025-10-04 10:35:07,865 - freqtrade - INFO - freqtrade 2025.9
2025-10-04 10:35:08,426 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.
2025-10-04 10:35:10,513 - freqtrade.configuration.load_config - INFO - Using config: user_data1/config.json ...
2025-10-04 10:35:10,518 - freqtrade.loggers - INFO - Enabling colorized output.
2025-10-04 10:35:10,518 - freqtrade.loggers - INFO - Logfile configured
2025-10-04 10:35:10,519 - freqtrade.loggers - INFO - Verbosity set to 0
2025-10-04 10:35:10,519 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 3 ...
2025-10-04 10:35:10,520 - freqtrade.configuration.configuration - INFO - Using user-data directory: user_data1 ...
2025-10-04 10:35:10,520 - freqtrade.configuration.configuration - INFO - Using data directory: user_data1/data/binance ...
2025-10-04 10:35:10,520 - freqtrade.configuration.configuration - INFO - Parameter --cache=day detected ...
2025-10-04 10:35:10,522 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2025-10-04 10:35:10,537 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade
development team.
2025-10-04 10:35:10,537 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2025-10-04 10:35:10,538 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2025-10-04 10:35:10,541 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Backtesting mode
2025-10-04 10:35:10,541 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2025-10-04 10:35:10,542 - freqtrade.exchange.exchange - INFO - Using CCXT 4.5.5
2025-10-04 10:35:10,567 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2025-10-04 10:35:14,662 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
2025-10-04 10:35:14,682 - freqtrade.resolvers.iresolver - INFO - Using resolved strategy SampleStrategy from
'/Users/test1/Documents/code/my_develop/freq_data/user_data1/strategies/sample_strategy.py'...
2025-10-04 10:35:14,683 - freqtrade.strategy.hyper - INFO - Found no parameter file.
2025-10-04 10:35:14,684 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value from the
configuration: USDT.
2025-10-04 10:35:14,684 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value from the
configuration: 100.
2025-10-04 10:35:14,684 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'unfilledtimeout' with value from the
configuration: {'entry': 10, 'exit': 10, 'exit_timeout_count': 0, 'unit': 'minutes'}.
2025-10-04 10:35:14,685 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'max_open_trades' with value from the
configuration: 3.
2025-10-04 10:35:14,685 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'60': 0.01, '30': 0.02, '0':
0.04}
2025-10-04 10:35:14,686 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using timeframe: 5m
2025-10-04 10:35:14,686 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.1
2025-10-04 10:35:14,686 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: False
2025-10-04 10:35:14,687 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.0
2025-10-04 10:35:14,693 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: False
2025-10-04 10:35:14,693 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_custom_stoploss: False
2025-10-04 10:35:14,693 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: True
2025-10-04 10:35:14,694 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'entry': 'limit', 'exit':
'limit', 'stoploss': 'market', 'stoploss_on_exchange': False}
2025-10-04 10:35:14,694 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'entry': 'GTC',
'exit': 'GTC'}
2025-10-04 10:35:14,695 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: USDT
2025-10-04 10:35:14,695 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 100
2025-10-04 10:35:14,695 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using startup_candle_count: 200
2025-10-04 10:35:14,696 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using unfilledtimeout: {'entry': 10, 'exit': 10,
'exit_timeout_count': 0, 'unit': 'minutes'}
2025-10-04 10:35:14,696 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_exit_signal: True
2025-10-04 10:35:14,696 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using exit_profit_only: False
2025-10-04 10:35:14,697 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_entry_signal: False
2025-10-04 10:35:14,698 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using exit_profit_offset: 0.0
2025-10-04 10:35:14,698 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using disable_dataframe_checks: False
2025-10-04 10:35:14,698 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_buying_expired_candle_after: 0
2025-10-04 10:35:14,699 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using position_adjustment_enable: False
2025-10-04 10:35:14,699 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using max_entry_position_adjustment: -1
2025-10-04 10:35:14,699 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using max_open_trades: 3
2025-10-04 10:35:14,700 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2025-10-04 10:35:14,712 - freqtrade.resolvers.iresolver - INFO - Using resolved pairlist StaticPairList from
'/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/plugins/pairlist/StaticPairList.py'...
2025-10-04 10:35:14,740 - freqtrade.optimize.backtesting - INFO - Using fee 0.1000% - worst case fee from exchange (lowest tier).
2025-10-04 10:35:14,821 - freqtrade.optimize.backtesting - INFO - Loading data from 2025-09-24 00:00:00 up to 2025-10-03 15:10:00
(9 days).
2025-10-04 10:35:14,822 - freqtrade.configuration.timerange - WARNING - Moving start-date by 200 candles to account for startup
time.
2025-10-04 10:35:14,888 - freqtrade.optimize.backtesting - INFO - Dataload complete. Calculating indicators
2025-10-04 10:35:14,889 - freqtrade.optimize.backtesting - WARNING - Backtest result caching disabled due to use of open-ended
timerange.
2025-10-04 10:35:14,889 - freqtrade.optimize.backtesting - INFO - Running backtesting for Strategy SampleStrategy
2025-10-04 10:35:14,890 - freqtrade.strategy.hyper - INFO - No params for buy found, using default values.
2025-10-04 10:35:14,890 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): buy_rsi = 30
2025-10-04 10:35:14,891 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): exit_short_rsi = 30
2025-10-04 10:35:14,891 - freqtrade.strategy.hyper - INFO - No params for sell found, using default values.
2025-10-04 10:35:14,891 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): sell_rsi = 70
2025-10-04 10:35:14,892 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): short_rsi = 70
2025-10-04 10:35:14,892 - freqtrade.strategy.hyper - INFO - No params for protection found, using default values.
2025-10-04 10:35:14,916 - freqtrade.optimize.backtesting - INFO - Backtesting with data from 2025-09-24 16:40:00 up to 2025-10-03
15:10:00 (8 days).
2025-10-04 10:35:15,430 - freqtrade.misc - INFO - dumping json to
"user_data1/backtest_results/backtest-result-2025-10-04_10-35-15.meta.json"
Result for strategy SampleStrategyBACKTESTING REPORT
┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Pair ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ ETH/USDT │ 4 │ 0.78 │ 3.097 │ 0.31 │ 1 day, 11:19:00 │ 3 0 1 75.0 │
│ BTC/USDT │ 4 │ 0.3 │ 1.191 │ 0.12 │ 1 day, 7:10:00 │ 3 0 1 75.0 │
│ TOTAL │ 8 │ 0.54 │ 4.288 │ 0.43 │ 1 day, 9:14:00 │ 6 0 2 75.0 │
└──────────┴────────┴──────────────┴─────────────────┴──────────────┴─────────────────┴────────────────────────┘LEFT OPEN TRADES REPORT
┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Pair ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ ETH/USDT │ 1 │ -0.37 │ -0.367 │ -0.04 │ 9:15:00 │ 0 0 1 0 │
│ TOTAL │ 1 │ -0.37 │ -0.367 │ -0.04 │ 9:15:00 │ 0 0 1 0 │
└──────────┴────────┴──────────────┴─────────────────┴──────────────┴──────────────┴────────────────────────┘ENTER TAG STATS
┏━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Enter Tag ┃ Entries ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ OTHER │ 8 │ 0.54 │ 4.288 │ 0.43 │ 1 day, 9:14:00 │ 6 0 2 75.0 │
│ TOTAL │ 8 │ 0.54 │ 4.288 │ 0.43 │ 1 day, 9:14:00 │ 6 0 2 75.0 │
└───────────┴─────────┴──────────────┴─────────────────┴──────────────┴────────────────┴────────────────────────┘EXIT REASON STATS
┏━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Exit Reason ┃ Exits ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ roi │ 6 │ 1.08 │ 6.455 │ 0.65 │ 1 day, 3:36:00 │ 6 0 0 100 │
│ force_exit │ 1 │ -0.37 │ -0.367 │ -0.04 │ 9:15:00 │ 0 0 1 0 │
│ exit_signal │ 1 │ -1.81 │ -1.799 │ -0.18 │ 3 days, 19:05:00 │ 0 0 1 0 │
│ TOTAL │ 8 │ 0.54 │ 4.288 │ 0.43 │ 1 day, 9:14:00 │ 6 0 2 75.0 │
└─────────────┴───────┴──────────────┴─────────────────┴──────────────┴──────────────────┴────────────────────────┘MIXED TAG STATS
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Enter Tag ┃ Exit Reason ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ │ roi │ 6 │ 1.08 │ 6.455 │ 0.65 │ 1 day, 3:36:00 │ 6 0 0 100 │
│ │ force_exit │ 1 │ -0.37 │ -0.367 │ -0.04 │ 9:15:00 │ 0 0 1 0 │
│ │ exit_signal │ 1 │ -1.81 │ -1.799 │ -0.18 │ 3 days, 19:05:00 │ 0 0 1 0 │
│ TOTAL │ │ 8 │ 0.54 │ 4.288 │ 0.43 │ 1 day, 9:14:00 │ 6 0 2 75.0 │
└───────────┴─────────────┴────────┴──────────────┴─────────────────┴──────────────┴──────────────────┴────────────────────────┘SUMMARY METRICS
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Metric ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Backtesting from │ 2025-09-24 16:40:00 │
│ Backtesting to │ 2025-10-03 15:10:00 │
│ Trading Mode │ Spot │
│ Max open trades │ 2 │
│ │ │
│ Total/Daily Avg Trades │ 8 / 1.0 │
│ Starting balance │ 1000 USDT │
│ Final balance │ 1004.288 USDT │
│ Absolute profit │ 4.288 USDT │
│ Total profit % │ 0.43% │
│ CAGR % │ 21.56% │
│ Sortino │ 14.30 │
│ Sharpe │ 10.11 │
│ Calmar │ 569.11 │
│ SQN │ 1.40 │
│ Profit factor │ 2.98 │
│ Expectancy (Ratio) │ 0.54 (0.49) │
│ Avg. daily profit │ 0.536 USDT │
│ Avg. stake amount │ 99.666 USDT │
│ Total trade volume │ 1602.141 USDT │
│ │ │
│ Best Pair │ ETH/USDT 0.31% │
│ Worst Pair │ BTC/USDT 0.12% │
│ Best trade │ ETH/USDT 1.47% │
│ Worst trade │ BTC/USDT -1.81% │
│ Best day │ 2.468 USDT │
│ Worst day │ -1.799 USDT │
│ Days win/draw/lose │ 4 / 1 / 1 │
│ Min/Max/Avg. Duration Winners │ 0d 01:00 / 4d 11:45 / 1d 03:36 │
│ Min/Max/Avg. Duration Losers │ 0d 09:15 / 3d 19:05 / 2d 02:10 │
│ Max Consecutive Wins / Loss │ 6 / 1 │
│ Rejected Entry signals │ 0 │
│ Entry/Exit Timeouts │ 0 / 0 │
│ │ │
│ Min balance │ 998.201 USDT │
│ Max balance │ 1004.655 USDT │
│ Max % of account underwater │ 0.18% │
│ Absolute drawdown │ 1.799 USDT (0.18%) │
│ Drawdown duration │ 0 days 00:00:00 │
│ Profit at drawdown start │ -1.799 USDT │
│ Profit at drawdown end │ -1.799 USDT │
│ Drawdown start │ 2025-09-28 21:05:00 │
│ Drawdown end │ 2025-09-28 21:05:00 │
│ Market change │ 6.66% │
└───────────────────────────────┴────────────────────────────────┘Backtested 2025-09-24 16:40:00 -> 2025-10-03 15:10:00 | Max open trades : 2STRATEGY SUMMARY
┏━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ ┃ ┃ ┃ ┃ ┃ ┃ Win Draw Loss ┃ ┃
┃ Strategy ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win% ┃ Drawdown ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ SampleStrategy │ 8 │ 0.54 │ 4.288 │ 0.43 │ 1 day, 9:14:00 │ 6 0 2 │ 1.799 USDT │
│ │ │ │ │ │ │ 75.0 │ 0.18% │
└────────────────┴────────┴──────────────┴─────────────────┴──────────────┴────────────────┴──────────────────┴──────────────────┘
(freq) test1@budas-MacBook-Pro freq_data %
得到像这样的表格,说明执行成功!
五、Trade 交易
freqtrade trade --config user_data1/config.json --userdir user_data1 --strategy SampleStrategy
(freq) test1@budas-MacBook-Pro freq_data % freqtrade trade --config user_data1/config.json --userdir user_data1 --strategy SampleStrategy
2025-10-04 10:22:37,384 - freqtrade - INFO - freqtrade 2025.9
2025-10-04 10:22:38,201 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.
2025-10-04 10:22:40,694 - freqtrade.worker - INFO - Starting worker 2025.9
2025-10-04 10:22:40,695 - freqtrade.configuration.load_config - INFO - Using config: user_data1/config.json ...
2025-10-04 10:22:40,698 - freqtrade.loggers - INFO - Enabling colorized output.
2025-10-04 10:22:40,699 - freqtrade.loggers - INFO - Logfile configured
2025-10-04 10:22:40,699 - freqtrade.loggers - INFO - Verbosity set to 0
2025-10-04 10:22:40,700 - freqtrade.configuration.configuration - INFO - Runmode set to dry_run.
2025-10-04 10:22:40,700 - freqtrade.configuration.configuration - INFO - Dry run is enabled
2025-10-04 10:22:40,701 - freqtrade.configuration.configuration - INFO - Using DB: "sqlite:///tradesv3.dryrun.sqlite"
2025-10-04 10:22:40,701 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 3 ...
2025-10-04 10:22:40,701 - freqtrade.configuration.configuration - INFO - Using user-data directory: user_data1 ...
2025-10-04 10:22:40,702 - freqtrade.configuration.configuration - INFO - Using data directory: user_data1/data/binance ...
2025-10-04 10:22:40,703 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2025-10-04 10:22:40,719 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade
development team.
2025-10-04 10:22:40,720 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2025-10-04 10:22:40,721 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2025-10-04 10:22:40,721 - freqtrade.exchange.exchange - INFO - Using CCXT 4.5.5
2025-10-04 10:22:40,760 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2025-10-04 10:22:45,112 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
2025-10-04 10:22:45,138 - freqtrade.resolvers.iresolver - INFO - Using resolved strategy SampleStrategy from
'/Users/test1/Documents/code/my_develop/freq_data/user_data1/strategies/sample_strategy.py'...
2025-10-04 10:22:45,139 - freqtrade.strategy.hyper - INFO - Found no parameter file.
2025-10-04 10:22:45,139 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value from the
configuration: USDT.
2025-10-04 10:22:45,140 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value from the
configuration: 100.
2025-10-04 10:22:45,140 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'unfilledtimeout' with value from the
configuration: {'entry': 10, 'exit': 10, 'exit_timeout_count': 0, 'unit': 'minutes'}.
2025-10-04 10:22:45,141 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'max_open_trades' with value from the
configuration: 3.
2025-10-04 10:22:45,141 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'60': 0.01, '30': 0.02, '0':
0.04}
2025-10-04 10:22:45,141 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using timeframe: 5m
2025-10-04 10:22:45,142 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.1
2025-10-04 10:22:45,142 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: False
2025-10-04 10:22:45,142 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.0
2025-10-04 10:22:45,143 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: False
2025-10-04 10:22:45,143 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_custom_stoploss: False
2025-10-04 10:22:45,143 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: True
2025-10-04 10:22:45,144 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'entry': 'limit', 'exit':
'limit', 'stoploss': 'market', 'stoploss_on_exchange': False}
2025-10-04 10:22:45,144 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'entry': 'GTC',
'exit': 'GTC'}
2025-10-04 10:22:45,145 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: USDT
2025-10-04 10:22:45,145 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 100
2025-10-04 10:22:45,145 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using startup_candle_count: 200
2025-10-04 10:22:45,146 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using unfilledtimeout: {'entry': 10, 'exit': 10,
'exit_timeout_count': 0, 'unit': 'minutes'}
2025-10-04 10:22:45,146 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_exit_signal: True
2025-10-04 10:22:45,146 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using exit_profit_only: False
2025-10-04 10:22:45,147 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_entry_signal: False
2025-10-04 10:22:45,147 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using exit_profit_offset: 0.0
2025-10-04 10:22:45,148 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using disable_dataframe_checks: False
2025-10-04 10:22:45,148 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_buying_expired_candle_after: 0
2025-10-04 10:22:45,148 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using position_adjustment_enable: False
2025-10-04 10:22:45,149 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using max_entry_position_adjustment: -1
2025-10-04 10:22:45,149 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using max_open_trades: 3
2025-10-04 10:22:45,149 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2025-10-04 10:22:45,623 - freqtrade.wallets - INFO - Wallets synced.
2025-10-04 10:22:49,082 - freqtrade.resolvers.iresolver - INFO - Using resolved pairlist StaticPairList from
'/Users/test1/Documents/code/my_develop/freqtrade/freqtrade/plugins/pairlist/StaticPairList.py'...
2025-10-04 10:22:49,083 - freqtrade.freqtradebot - INFO - Starting initial pairlist refresh
2025-10-04 10:22:49,112 - freqtrade.plugins.pairlistmanager - INFO - Whitelist with 2 pairs: ['BTC/USDT', 'ETH/USDT']
2025-10-04 10:22:49,113 - freqtrade.freqtradebot - INFO - Initial Pairlist refresh took 0.03s
2025-10-04 10:22:49,113 - freqtrade.strategy.hyper - INFO - No params for buy found, using default values.
2025-10-04 10:22:49,114 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): buy_rsi = 30
2025-10-04 10:22:49,114 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): exit_short_rsi = 30
2025-10-04 10:22:49,115 - freqtrade.strategy.hyper - INFO - No params for sell found, using default values.
2025-10-04 10:22:49,115 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): sell_rsi = 70
2025-10-04 10:22:49,116 - freqtrade.strategy.hyper - INFO - Strategy Parameter(default): short_rsi = 70
2025-10-04 10:22:49,116 - freqtrade.strategy.hyper - INFO - No params for protection found, using default values.
2025-10-04 10:22:49,117 - freqtrade.plugins.protectionmanager - INFO - No protection Handlers defined.
2025-10-04 10:22:49,117 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'running'}
2025-10-04 10:22:49,117 - freqtrade.worker - INFO - Changing state to: RUNNING
2025-10-04 10:22:49,127 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': warning, 'status': 'Dry run is enabled.
All trades are simulated.'}
2025-10-04 10:22:49,128 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': startup, 'status': "*Exchange:*
`binance`\n*Stake per trade:* `100 USDT`\n*Minimum ROI:* `{'60': 0.01, '30': 0.02, '0': 0.04}`\n*Stoploss:* `-0.1`\n*Position
adjustment:* `Off`\n*Timeframe:* `5m`\n*Strategy:* `SampleStrategy`"}
2025-10-04 10:22:49,128 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': startup, 'status': "Searching for USDT
pairs to buy and sell based on [{'StaticPairList': 'StaticPairList'}]"}
2025-10-04 10:22:54,132 - freqtrade.worker - INFO - Bot heartbeat. PID=18062, version='2025.9', state='RUNNING'
运行成功。
已经看见是RUNNIG状态了。
到这里,快速开始阶段已经结束,后面我将会更详细地介绍官方文档内容。
另外,你可以参考其他up主的老版本安装视频:https://www.youtube.com/watch?v=VHvikJmQrVM