quantfans / quantdigger Goto Github PK
View Code? Open in Web Editor NEW基于python的量化交易平台
基于python的量化交易平台
the import plotting
in demo shows the error no module named plotting
.
(QA) E:\code\quantdigger>python demo.py
[I 210123 00:24:34 dsutil:17] register datasource: <class 'quantdigger.datasource.impl.csv_source.CsvSource'> => csv
[I 210123 00:24:34 dsutil:17] register datasource: <class 'quantdigger.datasource.impl.tushare_source.TuShareSource'> => tushare
[I 210123 00:24:34 dsutil:17] register datasource: <function CachedTuShareSource at 0x000001A5AB59A840> => cached-tushare
[I 210123 00:24:34 dsutil:17] register datasource: <class 'quantdigger.datasource.impl.mongodb_source.MongoDBSource'> => mongodb
[I 210123 00:24:34 dsutil:17] register datasource: <class 'quantdigger.datasource.impl.sqlite_source.SqliteSource'> => sqlite
Traceback (most recent call last):
File "demo.py", line 1, in
from quantdigger import *
File "E:\code\quantdigger\quantdigger_init_.py", line 3, in
from quantdigger.engine.strategy import *
File "E:\code\quantdigger\quantdigger\engine\strategy.py", line 2, in
from quantdigger.engine.execute_unit import ExecuteUnit
File "E:\code\quantdigger\quantdigger\engine\execute_unit.py", line 9, in
from quantdigger.engine.context import Context
File "E:\code\quantdigger\quantdigger\engine\context_init_.py", line 1, in
from .data_context import OriginalData
File "E:\code\quantdigger\quantdigger\engine\context\data_context.py", line 25
self.default_pcontract: str = None
^
SyntaxError: invalid syntax
(QA) E:\code\quantdigger>
from quantdigger.engine.strategy import TradingStrategy
from quantdigger.util import pcontract, stock
这些模块貌似都没有上传啊
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
如题
ConfigUtil.set(source='tushare')
profiles = add_strategies(['000001.SH-1.DAY'], [
{
'strategy': DemoStrategy('A1'),
'capital': 5000000.0,
}
])
报错:
File "C:\Users\***\AppData\Local\Programs\Python\Python37\lib\site-packages\quantdigger-0.6.0-py3.7.egg\quantdigger\engine\context\data_context.py", line 125, in __init__
self.open = NumberSeries(raw_data.open.values, 'open')
AttributeError: 'SourceWrapper' object has no attribute 'open'
很不错,但是看了一下源码,貌似没有维护本地数据的模块.对于大量细粒度数据的回测,没有本地数据很慢.比如要回测过去10年1分钟数据(更细的还有TICK...)
是不是应该弄一个HDF5文件,然后弄一个模块每天或实时维护它?
看了数据源格式没有包含复权的数据,项目如何支持复权价计算?
PS
RT
运行策略组合DEMO 源码 后报错
File "pandas_libs\parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File b'./data\CONTRACTS.csv' does not exist: b'./data\CONTRACTS.csv'
D:\worksoft\anaconda3\lib\site-packages\quantdigger-0.6.0-py3.6.egg\quantdigger\engine\execute_unit.py in _load_data(self, strpcons, dt_start, dt_end, n, spec_date)
216 dt_start = spec_date[strpcon][0]
217 dt_end = spec_date[strpcon][1]
--> 218 assert(dt_start < dt_end)
219 if n:
220 wrapper = self._data_manager.get_last_bars(strpcon, n)
TypeError: '<' not supported between instances of 'int' and 'str'
把capital错写成captial了
在这个函数中,我注意到 duration[t] = 0 if drawdown[t] <= 0 else duration[t-1] + 1
,这计算出来的是新高到下一个新高中的天数,而不是“最大回撤”的天数,不知是我理解有误还是特意为之?
def max_drawdown(networth):
""" 统计最大回测和相应的回测周期。
networth: 历史净值
"""
hwm = [0] # 历史最大值序列变量
eq_idx = networth.index
drawdown = pd.Series(index=eq_idx)
duration = pd.Series(index=eq_idx)
for t in range(1, len(eq_idx)):
cur_hwm = max(hwm[t-1], networth[t])
hwm.append(cur_hwm)
drawdown[t] = hwm[t] - networth[t]
# <=0 新高,计数0
duration[t] = 0 if drawdown[t] <= 0 else duration[t-1] + 1
return drawdown.max(), duration.max()
请教数据源是哪里啊
datastruct.py: class Order:
self._hash = hash(self.id)
TypeError: unhashable type: 'OrderID'
File "/media/psf/Home/Documents/work-ubuntu/quant/quantdigger/tests/test.py", line 54, in
set_symbols(['BB.SHFE-1.Minute'], 0)
File "/media/psf/Home/Documents/work-ubuntu/quant/quantdigger/tests/quantdigger/engine/strategy.py", line 22, in set_symbols
_simulator = ExecuteUnit(pcontracts, dt_start, dt_end, n, spec_date)
File "/media/psf/Home/Documents/work-ubuntu/quant/quantdigger/tests/quantdigger/engine/execute_unit.py", line 43, in init
self._default_pcontract = self.pcontracts[0]
IndexError: list index out of range
Backend Qt4Agg is interactive backend. Turning interactive mode on.
done
此时没有matplotlib.finance 怎么破
MACOS配置的本地的csv数据源,调了很久终于可以跑起来了,结果一到plt.show()就系统直接重启了,,,,,一头雾水!
在策略运行完用matplotlib显示后,鼠标右移超过最右边的bar会显示该错误。可能talib的运行结果与
显示挂钩了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.