wondertrader / wtpy

wtpy是基于wondertrader为底层的针对python的子框架
MIT License
926 stars 259 forks source link

Ubuntu下wtpy的HFT策略的问题 #110

Closed jawa10 closed 1 year ago

jawa10 commented 1 year ago

你好,我参考发布在B站的《Linux环境下运行wtpy的HFT策略》,在Ubuntu下尝试HFT时,执行python run.py报错, 而之后尝试在windows10下能够正常运行,配置文件和代码都相同。

Ubuntu下的错误包括 (一)找不到文件,好像是文件名前多了"lib": libtts_thosttraderapi_se.so: cannot open shared object file: No such file or directory (二) segmentation violation

这是运行后的全部信息 [06.14 22:32:54 - info ] WonderTrader HFT production framework initialziedversion: UNIX v0.9.7 Build@Apr 4 2023 08:54:27 [06.14 22:32:54 - info ] Trading sessions loaded [06.14 22:32:54 - info ] Commodities configuration file ../common/commodities.json loaded [06.14 22:32:54 - info ] Contracts configuration file ../common/contracts.json loaded, 5 exchanges [06.14 22:32:54 - info ] Holidays loaded [06.14 22:32:54 - info ] Hot rules loaded [06.14 22:32:54 - info ] Trading environment initialized, engine name: HFT [06.14 22:32:54 - info ] Running mode: Production [06.14 22:32:54 - debug] Filters configuration file filters.yaml not exists [06.14 22:32:54 - info ] 38 fee templates loaded [06.14 22:32:54 - warning] RiskMon is not configured, portfilio fund will be updated every 5s [06.14 22:32:54 - info ] WtDataReader initialized, rt dir is ../FUT_Data/rt/, hist dir is ../FUT_Data/his/, adjust_flag is 0 [06.14 22:32:54 - info ] No adjusting factor file configured, loading skipped [06.14 22:32:54 - info ] Data manager initialized [06.14 22:32:54 - info ] Action policies initialized [06.14 22:32:54 - info ] Reading parser config from tdparsers.yaml... [06.14 22:32:54 - info ] [parser0] Parser module /home/ubuntu/.conda/envs/wtpy/lib/python3.10/site-packages/wtpy/wrapper/linux/parsers/libParserCTP.so loaded [06.14 22:32:54 - info ] [parser0] Parser initialzied, check_time: false [06.14 22:32:54 - info ] 1 parsers loaded [06.14 22:32:54 - info ] Reading trader config from tdtraders.yaml... [06.14 22:32:54 - info ] [simnow] Risk control rule default of trading channel loaded [06.14 22:32:54 - info ] [simnow] Trader module /home/ubuntu/.conda/envs/wtpy/lib/python3.10/site-packages/wtpy/wrapper/linux/traders/libTraderCTP.so loaded /home/ubuntu/.conda/envs/wtpy/lib/python3.10/site-packages/wtpy/wrapper/linux/traders/libtts_thosttraderapi_se.so: cannot open shared object file: No such file or directory [06.14 22:32:54 - info ] 1 traders loaded [06.14 22:32:54 - info ] 1 parsers started [06.14 22:32:54 - error] segmentation violation

而在windows下,看起来没有类似的错误: [06.14 22:45:21 - info ] WonderTrader HFT production framework initialzied,version: X64 v0.9.7 Build@Apr 4 2023 10:13:38 [06.14 22:45:21 - info ] Trading sessions loaded [06.14 22:45:21 - info ] Commodities configuration file ../common/commodities.json loaded [06.14 22:45:21 - info ] Contracts configuration file ../common/contracts.json loaded, 5 exchanges [06.14 22:45:21 - info ] Holidays loaded [06.14 22:45:21 - info ] Hot rules loaded [06.14 22:45:21 - info ] Trading environment initialized, engine name: HFT [06.14 22:45:21 - info ] Running mode: Production [06.14 22:45:21 - debug] Filters configuration file filters.yaml not exists [06.14 22:45:21 - info ] 38 fee templates loaded [06.14 22:45:21 - warning] RiskMon is not configured, portfilio fund will be updated every 5s [06.14 22:45:21 - info ] WtDataReader initialized, rt dir is ../FUT_Data/rt/, hist dir is ../FUT_Data/his/, adjust_flag is 0 [06.14 22:45:21 - info ] No adjusting factor file configured, loading skipped [06.14 22:45:21 - info ] Data manager initialized [06.14 22:45:21 - info ] Action policies initialized [06.14 22:45:21 - info ] Reading parser config from tdparsers.yaml... [06.14 22:45:21 - info ] [parser0] Parser module C:/Users/xxxxx/.conda/envs/wtpy/lib/site-packages/wtpy/wrapper/x64/parsers/ParserCTP.dll loaded [06.14 22:45:21 - info ] [parser0] Parser initialzied, check_time: false [06.14 22:45:21 - info ] 1 parsers loaded [06.14 22:45:21 - info ] Reading trader config from tdtraders.yaml... [06.14 22:45:21 - info ] [simnow] Risk control rule default of trading channel loaded [06.14 22:45:21 - info ] [simnow] Trader module C:/Users/xxxxx/.conda/envs/wtpy/lib/site-packages/wtpy/wrapper/x64/traders/TraderCTP.dll loaded [06.14 22:45:21 - info ] 1 traders loaded [06.14 22:45:21 - info ] 1 parsers started [06.14 22:45:21 - info ] registerFront: tcp://121.37.80.177:20002 [06.14 22:45:21 - info ] 1 trading channels started [06.14 22:45:21 - info ] Market Data subscribed: CFFEX.IF.2306 [06.14 22:45:21 - info ] Trading day 20230615 begun press any key to exit [06.14 22:45:21 - info ] [ParserCTP] Market data server connected [06.14 22:45:21 - info ] [ParserCTP] Market data server logined, 20230614 [06.14 22:45:21 - info ] [ParserCTP] Market data of 653 contracts subscribed totally [06.14 22:45:21 - info ] [TraderCTP][9999-6374] Login succeed, AppID: simnow_client_test, Sessionid: 141635, login time: 22:45:21... [06.14 22:45:21 - info ] [TraderCTP][9999-6374] Login succeed, trading date: 20230615... [06.14 22:45:21 - info ] [TraderCTP][9999-6374] Querying confirming state of settlement data... [06.14 22:45:21 - info ] [TraderCTP][9999-6374] Confirming settlement data... [06.14 22:45:21 - info ] [TraderCTP][9999-6374] Trading channel initialized... [06.14 22:45:21 - info ] [simnow] Trader login succeed, trading date: 20230615 [06.14 22:45:22 - info ] [simnow] Position data updated [06.14 22:45:25 - info ] [simnow] Trading channel ready [06.14 22:45:26 - info ] 理论价格3956.700000,最新价:3956.600000 [06.14 22:45:26 - info ] 出现正向信号

以下是其他信息:

版本: Ubuntu 20.04.3 LTS Python 3.10.10 wtpy-0.9.7.2和wtpy-0.9.8都报错

目录:demos\hft_fut\

配置文件(使用的是OpenCTP的7x24环境): tdparsers.yaml parsers:

tdtraders.yaml traders:

wondertrader commented 1 year ago

最新dev已经修复,后面发布会在0.9.8版本