From f25f20dbddd27f247ed41dd315a4e76be4a8d5ed Mon Sep 17 00:00:00 2001 From: yutiansut Date: Fri, 10 Jan 2020 12:52:33 +0800 Subject: [PATCH] #update for quantaxis 1.7.4 --- QUANTAXIS/QAData/financial_mean.py | 1 + QUANTAXIS/QAFetch/QAKQ.py | 19 +++++++++++++++++++ QUANTAXIS/QAFetch/__init__.py | 5 ++++- QUANTAXIS/__init__.py | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 QUANTAXIS/QAFetch/QAKQ.py diff --git a/QUANTAXIS/QAData/financial_mean.py b/QUANTAXIS/QAData/financial_mean.py index 60d5ed7eb..b0becabf9 100755 --- a/QUANTAXIS/QAData/financial_mean.py +++ b/QUANTAXIS/QAData/financial_mean.py @@ -356,4 +356,5 @@ '313未知313':'unknown313', '314未知314':'unknown314', '315未知315':'unknown315', + '316未知316':'unknown316', } diff --git a/QUANTAXIS/QAFetch/QAKQ.py b/QUANTAXIS/QAFetch/QAKQ.py new file mode 100644 index 000000000..2e3437097 --- /dev/null +++ b/QUANTAXIS/QAFetch/QAKQ.py @@ -0,0 +1,19 @@ +import requests +import json +import pandas as pd + +def QA_fetch_get_future_domain(): + """ + 获取快期的主连代码 + + return [list] + """ + res = pd.DataFrame(json.loads(requests.get("https://openmd.shinnytech.com/t/md/symbols/latest.json").text)).T + return res.loc[res.ins_name.str.contains('主连')].underlying_symbol.apply(lambda x: x.split('.')[1]).tolist() + + + + + +if __name__ == "__main__": + print(QA_fetch_get_future_domain()) \ No newline at end of file diff --git a/QUANTAXIS/QAFetch/__init__.py b/QUANTAXIS/QAFetch/__init__.py index 69df4f581..137175b5d 100755 --- a/QUANTAXIS/QAFetch/__init__.py +++ b/QUANTAXIS/QAFetch/__init__.py @@ -41,7 +41,7 @@ from QUANTAXIS.QAFetch import QAfinancial from QUANTAXIS.QAFetch.base import get_stock_market from QUANTAXIS.QAFetch import QAQAWEB as QAWEB - +from QUANTAXIS.QAFetch import QAKQ as QAKQ def use(package): if package in ['wind']: @@ -318,6 +318,9 @@ def QA_fetch_get_future_transaction_realtime(package, code): return 'Unsupport packages' +def QA_fetch_get_future_domain(): + return QAKQ.QA_fetch_get_future_domain() + def QA_fetch_get_future_realtime(package, code): Engine = use(package) return Engine.QA_fetch_get_future_realtime(code) diff --git a/QUANTAXIS/__init__.py b/QUANTAXIS/__init__.py index 0967b3882..debae0ddb 100755 --- a/QUANTAXIS/__init__.py +++ b/QUANTAXIS/__init__.py @@ -31,7 +31,7 @@ 2017/4/8 """ -__version__ = '1.7.3' +__version__ = '1.7.4' __author__ = 'yutiansut' import argparse @@ -112,6 +112,7 @@ QA_fetch_get_bond_list, QA_fetch_get_bond_realtime, QA_fetch_get_future_realtime, + QA_fetch_get_future_domain, QA_fetch_get_future_transaction, QA_fetch_get_future_transaction_realtime, QA_fetch_get_globalfuture_day,