可以了,看来是同时安装几个版本搞的。我是都安装在root下,conda几个环境,但是应该都装在.vntrader下冲突了。
如果创建几个不同的用户,再安装的话是不是可以避免这种情况?
你是说vnc服务器启动的时候吗,这个没有
我装了几个版本,是用conda创建不同的虚拟的环境安装的,按理说不影响啊。是不是数据库是共同的,
我这个是ubuntu系统,数据库放在哪个位置了
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 3144, in execute_sql
cursor.execute(sql, params or ())
sqlite3.OperationalError: table dbbardata has no column named turnover
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.7/site-packages/vnpy/app/data_recorder/ui/widget.py", line 155, in process_exception_event
raise exc_info[1].with_traceback(exc_info[2])
File "/root/miniconda3/lib/python3.7/site-packages/vnpy/app/data_recorder/engine.py", line 82, in run
database_manager.save_bar_data(data)
File "/root/miniconda3/lib/python3.7/site-packages/vnpy/database/sqlite/sqlite_database.py", line 160, in save_bar_data
DbBarData.insert_many(c).on_conflict_replace().execute()
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 1907, in inner
return method(self, database, args, **kwargs)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 1978, in execute
return self._execute(database)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 2745, in _execute
return super(Insert, self)._execute(database)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 2474, in _execute
cursor = database.execute(self)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 3157, in execute
return self.execute_sql(sql, params, commit=commit)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 3151, in execute_sql
self.commit()
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 2917, in exit
reraise(new_type, new_type(exc_value, exc_args), traceback)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 190, in reraise
raise value.with_traceback(tb)
File "/root/miniconda3/lib/python3.7/site-packages/peewee.py", line 3144, in execute_sql
cursor.execute(sql, params or ())
peewee.OperationalError: table dbbardata has no column named turnover
https://cloud.tencent.com/developer/article/1726400
解决了,可以按这个的方法来
base) root@linux-yuanhui:~/vnpy/vnpy-2.5.0/examples/vn_trader# python run.py
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
可能是什么原因
gcc -pthread -B /root/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ivnpy/api/ctp/include -Ivnpy/api/ctp/vnctp -I/root/miniconda3/include/python3.7m -c vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp -o build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp/vnctptd/vnctptd.o -std=c++17 -O3 -Wno-delete-incomplete -Wno-sign-compare
gcc: error: vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp: No such file or directory
ERROR: Failed building wheel for vnpy
Running setup.py clean for vnpy
Failed to build vnpy
Installing collected packages: vnpy
Running setup.py install for vnpy ... error
ERROR: Command errored out with exit status 1:
command: /root/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-6j86cjas/setup.py'"'"'; file='"'"'/tmp/pip-req-build-6j86cjas/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-4bqd8wmw/install-record.txt --single-version-externally-managed --compile --install-headers /root/miniconda3/include/python3.7m/vnpy
cwd: /tmp/pip-req-build-6j86cjas/
Complete output (1875 lines):
/root/miniconda3/lib/python3.7/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.
""")
gcc -pthread -B /root/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ivnpy/api/ctp/include -Ivnpy/api/ctp/vnctp -I/root/miniconda3/include/python3.7m -c vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp -o build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp/vnctptd/vnctptd.o -std=c++17 -O3 -Wno-delete-incomplete -Wno-sign-compare
gcc: error: vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /root/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-6j86cjas/setup.py'"'"'; file='"'"'/tmp/pip-req-build-6j86cjas/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-4bqd8wmw/install-record.txt --single-version-externally-managed --compile --install-headers /root/miniconda3/include/python3.7m/vnpy Check the logs for full command output.
(base) root@linux-yuanhui:~/vnpy/vnpy-2.3.0#
Building wheels for collected packages: vnpy
Building wheel for vnpy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /root/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-6j86cjas/setup.py'"'"'; file='"'"'/tmp/pip-req-build-6j86cjas/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdistwheel -d /tmp/pip-wheel-vk1cbhg
cwd: /tmp/pip-req-build-6j86cjas/
Complete output (1877 lines):
/root/miniconda3/lib/python3.7/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.
""")
/root/miniconda3/lib/python3.7/site-packages/setuptools/dist.py:717: UserWarning: Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead
% (opt, underscore_opt)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/vnpy
copying vnpy/init.py -> build/lib.linux-x86_64-3.7/vnpy
creating build/lib.linux-x86_64-3.7/vnpy/app
copying vnpy/app/init.py -> build/lib.linux-x86_64-3.7/vnpy/app
creating build/lib.linux-x86_64-3.7/vnpy/event
copying vnpy/event/init.py -> build/lib.linux-x86_64-3.7/vnpy/event
copying vnpy/event/engine.py -> build/lib.linux-x86_64-3.7/vnpy/event
creating build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/converter.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/database.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/setting.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/init.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/rqdata.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/event.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/engine.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/utility.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/gateway.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/constant.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/app.py -> build/lib.linux-x86_64-3.7/vnpy/trader
copying vnpy/trader/object.py -> build/lib.linux-x86_64-3.7/vnpy/trader
creating build/lib.linux-x86_64-3.7/vnpy/chart
copying vnpy/chart/init.py -> build/lib.linux-x86_64-3.7/vnpy/chart
copying vnpy/chart/item.py -> build/lib.linux-x86_64-3.7/vnpy/chart
copying vnpy/chart/manager.py -> build/lib.linux-x86_64-3.7/vnpy/chart
copying vnpy/chart/axis.py -> build/lib.linux-x86_64-3.7/vnpy/chart
copying vnpy/chart/base.py -> build/lib.linux-x86_64-3.7/vnpy/chart
copying vnpy/chart/widget.py -> build/lib.linux-x86_64-3.7/vnpy/chart
creating build/lib.linux-x86_64-3.7/vnpy/api
copying vnpy/api/init.py -> build/lib.linux-x86_64-3.7/vnpy/api
creating build/lib.linux-x86_64-3.7/vnpy/rpc
copying vnpy/rpc/init.py -> build/lib.linux-x86_64-3.7/vnpy/rpc
creating build/lib.linux-x86_64-3.7/vnpy/gateway
copying vnpy/gateway/init.py -> build/lib.linux-x86_64-3.7/vnpy/gateway
creating build/lib.linux-x86_64-3.7/vnpy/database
copying vnpy/database/init.py -> build/lib.linux-x86_64-3.7/vnpy/database
creating build/lib.linux-x86_64-3.7/vnpy/app/risk_manager
copying vnpy/app/risk_manager/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/risk_manager
copying vnpy/app/risk_manager/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/risk_manager
creating build/lib.linux-x86_64-3.7/vnpy/app/option_master
copying vnpy/app/option_master/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/option_master
copying vnpy/app/option_master/time.py -> build/lib.linux-x86_64-3.7/vnpy/app/option_master
copying vnpy/app/option_master/base.py -> build/lib.linux-x86_64-3.7/vnpy/app/option_master
copying vnpy/app/option_master/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/option_master
copying vnpy/app/option_master/algo.py -> build/lib.linux-x86_64-3.7/vnpy/app/option_master
creating build/lib.linux-x86_64-3.7/vnpy/app/rpc_service
copying vnpy/app/rpc_service/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/rpc_service
copying vnpy/app/rpc_service/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/rpc_service
creating build/lib.linux-x86_64-3.7/vnpy/app/market_radar
copying vnpy/app/market_radar/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/market_radar
copying vnpy/app/market_radar/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/market_radar
creating build/lib.linux-x86_64-3.7/vnpy/app/portfolio_manager
copying vnpy/app/portfolio_manager/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/portfolio_manager
copying vnpy/app/portfolio_manager/base.py -> build/lib.linux-x86_64-3.7/vnpy/app/portfolio_manager
copying vnpy/app/portfolio_manager/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/portfolio_manager
creating build/lib.linux-x86_64-3.7/vnpy/app/script_trader
copying vnpy/app/script_trader/cli.py -> build/lib.linux-x86_64-3.7/vnpy/app/script_trader
copying vnpy/app/script_trader/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/script_trader
copying vnpy/app/script_trader/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/script_trader
creating build/lib.linux-x86_64-3.7/vnpy/app/cta_backtester
copying vnpy/app/cta_backtester/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/cta_backtester
copying vnpy/app/cta_backtester/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/cta_backtester
creating build/lib.linux-x86_64-3.7/vnpy/app/paper_account
copying vnpy/app/paper_account/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/paper_account
copying vnpy/app/paper_account/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/paper_account
creating build/lib.linux-x86_64-3.7/vnpy/app/chart_wizard
copying vnpy/app/chart_wizard/init.py -> build/lib.linux-x86_64-3.7/vnpy/app/chart_wizard
copying vnpy/app/chart_wizard/engine.py -> build/lib.linux-x86_64-3.7/vnpy/app/chart_wizard
上面链接里面,这个回答可以
sudo apt-get install aptitude
sudo aptitude install <package-name>
其实是需要的,有时候要根据止损的大小来调整开仓数量的大小。也可以在总资金回撤的时候,减小仓位。
估计是。应该要做不少裁剪,只把最核心的算法移植过来。
这种需求应该比较普遍吧,以后应该有开发计划吧。毕竟策略执行的时候不能手工去干预实行算法交易。
群主的意思是说,可以自己把算法交易自己移植到策略里面是吗?
我看功能介绍算法交易是对交易的标的直接指定操作。
可以在策略中应用算法交易吗,事先配置好后在策略中下单的时候直接执行。
self.buy(self.boll_up, self.fixed_size, True),这个是停止单,就是突破这个价格的时候买
没有对应的价格是什么意思,self.boll_up就是布林线上轨的位置啊,K线没有穿越布林线,那就是无法成交啊。
def boll(
self,
n: int,
dev: float,
array: bool = False
注意看这个 arry,缺省是false,就是返回的是一个值,就是数组最后的那个值