From a281a14f65c561ec123f259f4e0c776784d8598a Mon Sep 17 00:00:00 2001 From: yutiansut Date: Wed, 20 Jun 2018 20:36:36 +0800 Subject: [PATCH] #update --- QUANTAXIS/QAEngine/QACurioEngine.py | 29 +++++++++++++++++++++++++++++ QUANTAXIS/QAWeb/fetch_block.py | 9 ++++++--- conf.py | 5 +++-- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 QUANTAXIS/QAEngine/QACurioEngine.py diff --git a/QUANTAXIS/QAEngine/QACurioEngine.py b/QUANTAXIS/QAEngine/QACurioEngine.py new file mode 100644 index 000000000..36634e770 --- /dev/null +++ b/QUANTAXIS/QAEngine/QACurioEngine.py @@ -0,0 +1,29 @@ +from curio import UniversalQueue, run, sleep, spawn +from threading import Thread + + +def consumer(queue): + while True: + item = queue.get() + if item is None: + break + print('Got:', item) + + +async def producer(n, m, queue): + for x in range(n): + await queue.put(x) + await sleep(m) + await queue.put(None) + + +async def main(): + q = UniversalQueue() + Thread(target=consumer, args=(q,)).start() + t = await spawn(producer, 100, 1, q) + t1 = await spawn(producer, 100, 0.2, q) + t2 = await spawn(producer, 100, 0.5, q) + await t.join() + await t1.join() + await t2.join() +run(main) diff --git a/QUANTAXIS/QAWeb/fetch_block.py b/QUANTAXIS/QAWeb/fetch_block.py index 704418af1..88fca86c1 100644 --- a/QUANTAXIS/QAWeb/fetch_block.py +++ b/QUANTAXIS/QAWeb/fetch_block.py @@ -4,10 +4,13 @@ import QUANTAXIS as QA import pandas as pd import re -block_tdx = QA.DATABASE.stock_block -block_ths = QA.DATABASE.stock_block_ths -codelist = QA.QA_fetch_stock_list_adv() +try: + block_tdx = QA.DATABASE.stock_block + block_ths = QA.DATABASE.stock_block_ths + codelist = QA.QA_fetch_stock_list_adv() +except: + pass def get_block(block): block = [block] if isinstance(block, str) else block diff --git a/conf.py b/conf.py index 808a77a8d..469a8d490 100644 --- a/conf.py +++ b/conf.py @@ -15,6 +15,7 @@ import sphinx_rtd_theme import os import sys +import QUANTAXIS as QA # sys.path.insert(0, os.path.abspath('.')) @@ -25,9 +26,9 @@ author = 'yutiansut' # The short X.Y version -version = '1.0.39' +version = QA.__version__ # The full version, including alpha/beta/rc tags -release = '1.0.39' +release = QA.__version__ # -- General configuration ---------------------------------------------------