From d25bf4b7ab63fe40204108fe78871e7a1cc243cd Mon Sep 17 00:00:00 2001 From: yutiansut Date: Wed, 3 Oct 2018 11:17:24 +0800 Subject: [PATCH 1/5] #update --- QUANTAXIS/QAEngine/QAAsyncioEngine.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/QUANTAXIS/QAEngine/QAAsyncioEngine.py b/QUANTAXIS/QAEngine/QAAsyncioEngine.py index d9f5626af..c2f903708 100644 --- a/QUANTAXIS/QAEngine/QAAsyncioEngine.py +++ b/QUANTAXIS/QAEngine/QAAsyncioEngine.py @@ -15,22 +15,25 @@ """ - class QAAsync(): def __init__(self): - self.event_loop = asyncio.get_event_loop() + self.event_loop = asyncio.new_event_loop() self.elthread = threading.Thread(target=self.event_loop.run_forever) # self.elthread.setDaemon(True) self.elthread.start() - def submit(self, func, callback, *args, **kwargs): - - # self.job=asyncio.run_coroutine_threadsafe(func(*args,**kwargs),self.event_loop) + def create_task(self, func, callback, *args, **kwargs): + # schedule a task + #task = self.event_loop.create_task(func(*args,**kwargs)) task = asyncio.ensure_future(func(*args, **kwargs)) task.add_done_callback(callback) - #print('get job async {}'.format(args)) + return task + + + def submit2(self, coro): + return asyncio.run_coroutine_threadsafe(coro, self.event_loop) def callback(future): From 88a510f1a1e14c82c03b29e0926f9c878c58202f Mon Sep 17 00:00:00 2001 From: yutiansut Date: Wed, 3 Oct 2018 11:17:31 +0800 Subject: [PATCH 2/5] # --- QUANTAXIS/QAEngine/QAAsyncioEngine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QUANTAXIS/QAEngine/QAAsyncioEngine.py b/QUANTAXIS/QAEngine/QAAsyncioEngine.py index c2f903708..d5ecaf962 100644 --- a/QUANTAXIS/QAEngine/QAAsyncioEngine.py +++ b/QUANTAXIS/QAEngine/QAAsyncioEngine.py @@ -32,7 +32,7 @@ def create_task(self, func, callback, *args, **kwargs): return task - def submit2(self, coro): + def submit(self, coro): return asyncio.run_coroutine_threadsafe(coro, self.event_loop) From 869d8fb6be5204859103006885be919938ee4012 Mon Sep 17 00:00:00 2001 From: yutiansut Date: Thu, 4 Oct 2018 19:10:15 +0800 Subject: [PATCH 3/5] #update for reindex method --- QUANTAXIS/QAData/base_datastruct.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/QUANTAXIS/QAData/base_datastruct.py b/QUANTAXIS/QAData/base_datastruct.py index 82dcb5ece..156998f98 100644 --- a/QUANTAXIS/QAData/base_datastruct.py +++ b/QUANTAXIS/QAData/base_datastruct.py @@ -731,6 +731,28 @@ def new(self, data=None, dtype=None, if_fq=None): def reverse(self): return self.new(self.data[::-1]) + def reindex(self, ind): + """reindex + + Arguments: + ind {[type]} -- [description] + + Raises: + RuntimeError -- [description] + RuntimeError -- [description] + + Returns: + [type] -- [description] + """ + + if isinstance(ind,pd.MultiIndex): + try: + return self.new(self.data.reindex(ind)) + except: + raise RuntimeError('QADATASTRUCT ERROR: CANNOT REINDEX') + else: + raise RuntimeError('QADATASTRUCT ERROR: ONLY ACCEPT MULTI-INDEX FORMAT') + def tail(self, lens): """返回最后Lens个值的DataStruct From 7f0bba1714714bfbc821f8804b181ac6c5e71145 Mon Sep 17 00:00:00 2001 From: yutiansut Date: Thu, 4 Oct 2018 19:11:02 +0800 Subject: [PATCH 4/5] #update to 1.1.7 --- QUANTAXIS/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QUANTAXIS/__init__.py b/QUANTAXIS/__init__.py index f55c05981..a78bfd596 100755 --- a/QUANTAXIS/__init__.py +++ b/QUANTAXIS/__init__.py @@ -32,7 +32,7 @@ 2017/4/8 """ -__version__ = '1.1.7.dev3' +__version__ = '1.1.7' __author__ = 'yutiansut' logo = ' \n \ ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` \n \ From 1657aa52359a41e996532ebb9ab9f516ab72b990 Mon Sep 17 00:00:00 2001 From: yutiansut Date: Thu, 4 Oct 2018 19:18:12 +0800 Subject: [PATCH 5/5] #update --- CHANGELOG.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d608cc0d..417cd231d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ - [QUANTAXIS 更新纪要](#quantaxis-更新纪要) - - [1.1.7 (unreleased)](#117-unreleased) + - [1.1.8(unreleased)](#118unreleased) + - [1.1.7](#117) - [1.1.6](#116) - [1.1.5](#115) - [1.1.4.dev1](#114dev1) @@ -63,11 +64,14 @@ - [1.0.25](#1025) -## 1.1.7 (unreleased) +## 1.1.8(unreleased) + +## 1.1.7 1. 优化 QA_DataStruct_future_day/min 2. 增加了QA_fetch_xxx_adv系列中的 QA_fetch_future_day_adv/QA_fetch_future_min_adv函数 - +3. 增加了QA_DataStruct的reindex方法, 方便从指标中提取部分行情 +4. 增加了商品期权的支持 to do: