1. 使用 WSL
2. 安装 python 扩展
3. 安装 python pip venv,pip 用来安装包 ,venv 用来创建虚拟环境
sudo apt update
sudo apt upgrade
sudo apt install python3
sudo apt install python3-pip
sudo apt install python3-venv
sudo apt install python3-dev
sudo apt install python3-pandas
sudo apt install git
4. 安装 freqtrade
git clone https://github.com/freqtrade/freqtrade.git
cd freqtrade
5. 使用稳定版
git checkout stable
6. 使用开发板
git checkout develop
7. 使用脚本安装,时间很久建议去大便一下。
./setup.sh -i
8. 激活环境
source .env/bin/activate
9. 查看指令和版本
freqtrade --help
freqtrade --version
10. 初始化一个用户文件夹
freqtrade create-userdir --userdir user_data
11. 创建配置
freqtrade new-config --config config.json
12. 修改配置文件 config.json
12. 创建策略
freqtrade new-strategy --strategy test
13. 从交易所下载数据
freqtrade download-data --config config.json --days 999 -t 5m 15m 30m 1h 2h 4h 1d 1w
freqtrade download-data --config config.json
14. 查看下载的数据
ls user_data/data/
ls user_data/data/binance/
15. 开始回测
是什么,按照制定好的策略在历史发生过的数据进行模拟交易。
目的,根据回测的数据进行策略的改进
陷阱
- 交易成本,没有考虑交易成本的业绩是不真实的
- 前视偏差,使用了未来函数,如策略中制定每日最低点买入。
freqtrade backtesting --config config.json --strategy SampleStrategy
16. 启动机器人,有时候报错是因为代理问题,整个好的提示 can not load markets
freqtrade trade --config config.json --strategy SampleStrategy