# freqtrade 教學(未完成) > 不用docker,咱們上GCP # 1. GCP機器配置 建議不要選北美,可以用台灣或香港。 因幣安禁止北美的IP ![](https://hackmd.io/_uploads/Hy8KfR_MT.png) ![](https://hackmd.io/_uploads/SkFcMAuf6.png) # 2. 更新python版本到3.10 **2023/10/27 版本的freqtrade需要在python 3.9以上,而其中freqtrade所需要的一個模組TA-Lib最多只支援到3.10版,因此直接更新到3.11會遇到其他的BUG,所以我們要更新到3.10** ``` sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update ``` `apt-get update` `sudo apt-get install python3.10` ``` sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2 ``` `sudo update-alternatives --config python3` 輸入2,換成3.10 `python3 -V` > 參考這篇教學中的手法,文中將python3.10換成3.11,而我們需要將python3.8換成3.10 https://www.itsupportwale.com/blog/how-to-upgrade-to-python-3-11-on-ubuntu-20-04-and-22-04-lts/ # 3. 安裝 freqtrade ``` git clone https://github.com/freqtrade/freqtrade.git cd freqtrade ./setup.sh -i ``` 接著全部選像都YES **安裝成功訊息** ![](https://hackmd.io/_uploads/rJTL4CuMa.png) 參考資料 1. https://www.freqtrade.io/en/stable/installation/ 2. https://hackmd.io/@Hibana2077/SJOMBz3Es # 4.設定 Freqtrade 1. 確認目前的目錄,並且進入freqtrade目錄。 2. `source .venv/bin/activate`,並且按下 Enter。 3. `cd ..`,並且按下 Enter。 4. `mkdir bot01`,並且按下 Enter。 (bot01 可以改成其他的名稱) 5. `cd bot01`,並且按下 Enter。 6. `freqtrade create-userdir --userdir user_data`,並且按下 Enter。 7. `freqtrade new-config --config config.json`,並且按下 Enter。 說明: 12步為啟動 345為創立新資料夾並進入 # 5. freqtradeAI ## h2 5.1 安裝必要組件 進入freqtrade目錄 `pip install -r requirements-freqai.txt` `freqtrade trade --config config_examples/config_freqai.example.json --strategy FreqaiExampleStrategy --freqaimodel LightGBMRegressor --strategy-path freqtrade/templates` https://www.freqtrade.io/en/stable/freqai/ ## h2 5.2 回測 下載所需資料 `freqtrade download-data --config config_examples/config_freqai.example.json --timeframe 3m 15m 1h --timerange 20220101-` 回測 `freqtrade backtesting --strategy FreqaiExampleStrategy --strategy-path freqtrade/templates --config config_examples/config_freqai.example.json --freqaimodel LightGBMRegressor --timerange 20230401-20230701` 也可以換 --freqaimodel XGBoostRegressor freqtrade.exceptions.OperationalException: Could not load markets, therefore cannot start. Please investigate the above error for more details. https://github.com/freqtrade/freqtrade/issues/6211 問題很簡單 - 您的系統時間略有錯誤 - 因此幣安拒絕來自您系統的請求。 簡而言之 - 安裝/設定時間同步服務,如 ntpd 或 chronyd(確保它非常頻繁地同步)。