Last login: Fri Mar 31 14:17:44 on ttys000
apple@bogon ~ % brew install ta-lib
==> Fetching ta-lib
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/ta-lib-0.4.0.arm64_
Already downloaded: /Users/apple/Library/Caches/Homebrew/downloads/ce993e6b3293fa0016d8eb4d5ea501d62164efd53ed2e7a1a7db319587772844--ta-lib-0.4.0.arm64_ventura.bottle.1.tar.gz
fatal: not in a git directory
Error: Command failed with exit 128: git
apple@bogon ~ % python3 -m pip install numpy --index=https://pypi.doubanio.com/simple
python3 -m pip install ta-lib==0.4.24 --index=https://pypi.doubanio.com/simple
Looking in indexes: https://pypi.doubanio.com/simple
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (1.23.1)
Looking in indexes: https://pypi.doubanio.com/simple
Collecting ta-lib==0.4.24
Using cached https://pypi.doubanio.com/packages/78/f5/59f1d7d0c43d3d96e93249ae9d5415b42591362bfcf2f4e50574ad063312/TA-Lib-0.4.24.tar.gz (269 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from ta-lib==0.4.24) (1.23.1)
Building wheels for collected packages: ta-lib
Building wheel for ta-lib (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
/private/var/folders/5n/jr5q1bz96ms2jlx6kfmfsgpm0000gn/T/pip-install-9n3bu8kq/ta-lib_931b35c883224de6b1ba5b410a3ff913/setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.10
creating build/lib.macosx-10.9-universal2-3.10/talib
copying talib/abstract.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_polars.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_abstract.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/deprecated.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/__init__.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/stream.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_pandas.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_data.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_func.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_stream.py -> build/lib.macosx-10.9-universal2-3.10/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/talib
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c talib/_ta_lib.c -o build/temp.macosx-10.9-universal2-3.10/talib/_ta_lib.o
talib/_ta_lib.c:682:10: fatal error: 'ta-lib/ta_defs.h' file not found
#include "ta-lib/ta_defs.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ta-lib
Running setup.py clean for ta-lib
Failed to build ta-lib
Installing collected packages: ta-lib
Running setup.py install for ta-lib ... error
error: subprocess-exited-with-error
× Running setup.py install for ta-lib did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
/private/var/folders/5n/jr5q1bz96ms2jlx6kfmfsgpm0000gn/T/pip-install-9n3bu8kq/ta-lib_931b35c883224de6b1ba5b410a3ff913/setup.py:77: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.10
creating build/lib.macosx-10.9-universal2-3.10/talib
copying talib/abstract.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_polars.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_abstract.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/deprecated.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/__init__.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/stream.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_pandas.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_data.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_func.py -> build/lib.macosx-10.9-universal2-3.10/talib
copying talib/test_stream.py -> build/lib.macosx-10.9-universal2-3.10/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/talib
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c talib/_ta_lib.c -o build/temp.macosx-10.9-universal2-3.10/talib/_ta_lib.o
talib/_ta_lib.c:682:10: fatal error: 'ta-lib/ta_defs.h' file not found
#include "ta-lib/ta_defs.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> ta-lib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
apple@bogon ~ %
C:\Users\Administrator\Desktop\vnpy-3.6.0>python run.py
找不到数据服务驱动vnpy_,使用默认的RQData数据服务
Traceback (most recent call last):
File "C:\veighna_studio\lib\site-packages\vnpy_datamanager\ui\widget.py", line 226, in import_data
start, end, count = self.engine.import_data_from_csv(
File "C:\veighna_studio\lib\site-packages\vnpy_datamanager\engine.py", line 92, in import_data_from_csv
self.database.save_bar_data(bars)
File "C:\veighna_studio\lib\site-packages\vnpy_taos\taos_database.py", line 71, in save_bar_data
self.cursor.execute(create_table_script)
File "C:\veighna_studio\lib\site-packages\taos\cursor.py", line 127, in execute
self._result = taos_query(self._connection._conn, stmt)
File "C:\veighna_studio\lib\site-packages\taos\cinterface.py", line 300, in taos_query
raise ProgrammingError(errstr, errno)
taos.error.ProgrammingError: [0x2600]: syntax error near "-2022-usd-fut_sgx_1m using s_bar(symbol, exchange, interval_, count_) tags('XINA50-2022-USD-FUT', 'SGX', '1m', '0')"
vnpy3.6回测报错,如下图所示
VNPY3.6在vnpy_ctastrategy/vnpy_ctabacktester的CTA策略模块执行参数优化时添加了最大进程数量限制参数max_workers,请教一下,这个参数具体怎么设置? 然后设置最大可以是多少?最大线程数能超过63吗?
咨询一下自己发的帖子可以自己删除吗?有些没必要的想删除了
通过这样的方式可以拿到所有委托数据:
orders = main_engine.get_all_orders()
想在no_ui中获取到所有委托数据orders,但是具体不知道引入那些包? 具体如何才能拿到委托数据?方便具体指导一下吗?万分感激万分感激万分感激万分感激
运行no_ui时,使用sleep阻塞主线程,更重要是因为如果其中有一个CTA初始化失败报错,那么主线程就不会进入下一步,卡在while循环了,或者如果CTA策略需要从数据源实时下载数据延迟,或者CTA策略有上百个时候,还没有等全部初始话完成,就启动了也会报错,望指导。
课时8-K线的自定义合成
问题:
2.6.0版本对部分源代码进行了重构,其中就包括了该课程中的BarGenerator,所以课程具体的源代码与课程中展示的不完全一致。
解决方案:
2.6.0版本对BarGenerator进行了重构,对于update_tick函数做了一些改进,同时对于update_bar函数更新分钟数据和小时数据的逻辑分离成了两个独立的函数,分别为update_bar_minute_window函数和update_bar_hour_window函数,虽然与课程中展示的不完全一致,但是功能都是一致的。因此如果大家想要按照课程中所展示的代码自定义一个可以生成类似7分钟这种分钟数据,应该对update_bar_minute_window函数进行复制后再做修改。可以尝试修改如下:
def update_bar_minute_window(self, bar: BarData) -> None:
""""""
# If not inited, create window bar object
if not self.window_bar:
dt = bar.datetime.replace(second=0, microsecond=0)
self.window_bar = BarData(
symbol=bar.symbol,
exchange=bar.exchange,
datetime=dt,
gateway_name=bar.gateway_name,
open_price=bar.open_price,
high_price=bar.high_price,
low_price=bar.low_price
)
# Otherwise, update high/low price into window bar
else:
self.window_bar.high_price = max(
self.window_bar.high_price,
bar.high_price
)
self.window_bar.low_price = min(
self.window_bar.low_price,
bar.low_price
)
# Update close price/volume/turnover into window bar
self.window_bar.close_price = bar.close_price
self.window_bar.volume += bar.volume
self.window_bar.turnover += bar.turnover
self.window_bar.open_interest = bar.open_interest
# Check if window bar completed
if self.window_bar.datetime.minute != bar.datetime.minute:
self.interval_count += 1
if not (bar.datetime.minute + 1) % self.window:
self.on_window_bar(self.window_bar)
self.window_bar = None
self.interval_count = 0