Hummingbot Macos下搭建开发调试环境
HummingBot中文社区组织交易比赛,时间从11.25-12.2号为期一周,25号折腾了一上午BN子账号API token问题,到底还是被BN的统一账户模式坑了下.(感谢社区Dolm的耐心帮助.)
今天抽空把本地环境部署了下,方便交易策略的开发和调试.
之前在ubuntu的云主机上运行hummingBot过程比较丝滑,倒没碰到什么大问题;
本地是Macos环境,乱七八糟的环境太乱了,过然还是碰到了一些问题,记录下.
官方文档
编译问题
ios
,complex
头文件找不到,报error检查conda环境1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45building 'hummingbot.strategy.pure_market_making.pure_market_making_order_tracker' extension
clang++ -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -fPIC -O2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -Ihummingbot/core/data_type -Ihummingbot/core -I/Users/konbluesky/miniconda3/envs/hummingbot/lib/python3.10/site-packages/numpy/core/include -I/Users/konbluesky/miniconda3/envs/hummingbot/include/python3.10 -c hummingbot/strategy/pure_market_making/pure_market_making_order_tracker.cpp -o build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/pure_market_making/pure_market_making_order_tracker.o
hummingbot/strategy/cross_exchange_market_making/order_id_market_pair_tracker.cpp:1254:10: fatal error: 'ios' file not found
1254 | #include "ios"
| ^~~~~
hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.cpp:1257:10: fatal error: 'ios' file not found
1257 | #include "ios"
| ^~~~~
hummingbot/strategy/cross_exchange_mining/cross_exchange_mining.cpp:1258:10: fatal error: 'string' file not found
1258 | #include <string>
| ^~~~~~~~
1 error generated.
hummingbot/strategy/cross_exchange_mining/order_id_market_pair_tracker.cpp:1254:10: fatal error: 'ios' file not found
1254 | #include "ios"
| ^~~~~
building 'hummingbot.strategy.strategy_base' extension
clang++ -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -fPIC -O2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -Ihummingbot/core/data_type -Ihummingbot/core -I/Users/konbluesky/miniconda3/envs/hummingbot/lib/python3.10/site-packages/numpy/core/include -I/Users/konbluesky/miniconda3/envs/hummingbot/include/python3.10 -c hummingbot/strategy/strategy_base.cpp -o build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/strategy_base.o
hummingbot/strategy/order_book_asset_price_delegate.cpp:1256:10: fatal error: 'ios' file not found
1256 | #include "ios"
| ^~~~~
hummingbot/strategy/order_tracker.cpp:1256:10: fatal error: 'string' file not found
1256 | #include <string>
| ^~~~~~~~
1 error generated.
hummingbot/strategy/pure_market_making/pure_market_making.cpp:1257:10: fatal error: 'ios' file not found
1257 | #include "ios"
| ^~~~~
building 'hummingbot.strategy.strategy_py_base' extension
clang++ -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -fPIC -O2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -Ihummingbot/core/data_type -Ihummingbot/core -I/Users/konbluesky/miniconda3/envs/hummingbot/lib/python3.10/site-packages/numpy/core/include -I/Users/konbluesky/miniconda3/envs/hummingbot/include/python3.10 -c hummingbot/strategy/strategy_py_base.cpp -o build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/strategy_py_base.o
hummingbot/strategy/pure_market_making/pure_market_making_order_tracker.cpp:1256:10: fatal error: 'string' file not found
1256 | #include <string>
| ^~~~~~~~
1 error generated.
1 error generated.
1 warning and 1 error generated.
1 error generated.
1 error generated.
hummingbot/strategy/strategy_base.cpp:1256:10: fatal error: 'ios' file not found
1256 | #include "ios"
| ^~~~~
1 error generated.
hummingbot/strategy/strategy_py_base.cpp:1256:10: fatal error: 'ios' file not found
1256 | #include "ios"
| ^~~~~
1 error generated.envs/hummingbot/include
中确实没有对应的头文件,怀疑可能是前不久刚升级系统,commandLineTool被更新了,应该导致基础库没了
为了省力直接干掉/Library/Developer/CommandLineTools
目录,执行sudo xcode-select --install
重新安装.- 干掉conda的hummingbot环境,因为之前是用老tool执行的
- 重新执行
./install
和./compile
,出现新错误手动export到上下文1
2
3
4
5gbot/strategy/strategy_py_base.cpp -o build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/strategy_py_base.o
creating build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/twap
x86_64-apple-darwin13.4.0-clang++ -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -D_FORTIFY_SOURCE=2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -I/Users/konbluesky/miniconda3/envs/hummingbot/lib/python3.10/site-packages/numpy/core/include -I/Users/konbluesky/miniconda3/envs/hummingbot/include/python3.10 -c hummingbot/strategy/spot_perpetual_arbitrage/dummy.cpp -o build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/spot_perpetual_arbitrage/dummy.o
x86_64-apple-darwin13.4.0-clang++ -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -D_FORTIFY_SOURCE=2 -isystem /Users/konbluesky/miniconda3/envs/hummingbot/include -I/Users/konbluesky/miniconda3/envs/hummingbot/lib/python3.10/site-packages/numpy/core/include -I/Users/konbluesky/miniconda3/envs/hummingbot/include/python3.10 -c hummingbot/strategy/twap/dummy.cpp -o build/temp.macosx-10.13-x86_64-cpython-310/hummingbot/strategy/twap/dummy.o
error: command 'x86_64-apple-darwin13.4.0-clang++' failed: No such file or directory1
export CXX=clang
- 执行
./start
Pycharm 配置
- 添加conda HummingBot的interpreter
./start.sh
文件中是通过hummingbot_quickstart.py 来启动的,有三个参数PASSWORD,FILENAME,CONFIG 这里先暂时用不到.
所以Pycharm中直接Runbin/hummingbot_quickstart.py
就可以了;
HummingBot 是命令行UI程序,使用的是prompt_toolkit,这个框架在console中输出有特殊要求,所以如果碰到下面错误
不要慌,在Run/Debug Configurations中 勾选下面Emulate terminal in output console
配置
再次Run
Ok. 开发环境完毕. 收工
Hummingbot Macos下搭建开发调试环境