From 574ab3c3928f9fe4917af45eb7feca794cc4bc1b Mon Sep 17 00:00:00 2001 From: yutiansut Date: Sat, 16 May 2020 23:53:56 +0800 Subject: [PATCH 1/4] # --- QUANTAXIS/QAFetch/QAQuery_Advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QUANTAXIS/QAFetch/QAQuery_Advance.py b/QUANTAXIS/QAFetch/QAQuery_Advance.py index a3b9f6717..2bbcb55e3 100755 --- a/QUANTAXIS/QAFetch/QAQuery_Advance.py +++ b/QUANTAXIS/QAFetch/QAQuery_Advance.py @@ -519,7 +519,7 @@ def QA_fetch_future_day_adv( end=None, if_drop_index=True, # 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉 - collections=DATABASE.index_day + collections=DATABASE.future_day ): ''' :param code: code: 字符串str eg 600085 From dfa45745fcb3fb375db62455457c9350e0341561 Mon Sep 17 00:00:00 2001 From: yutiansut Date: Sat, 16 May 2020 23:54:42 +0800 Subject: [PATCH 2/4] # --- QUANTAXIS/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QUANTAXIS/__init__.py b/QUANTAXIS/__init__.py index 05bdea971..b193b16cc 100755 --- a/QUANTAXIS/__init__.py +++ b/QUANTAXIS/__init__.py @@ -31,7 +31,7 @@ 2017/4/8 """ -__version__ = '1.9.20' +__version__ = '1.9.21' __author__ = 'yutiansut' import argparse From 5cb93cf03f66c8f59c4b1026fcd1abe00f2b0fc9 Mon Sep 17 00:00:00 2001 From: yutiansut Date: Sun, 17 May 2020 01:09:31 +0800 Subject: [PATCH 3/4] # --- QUANTAXIS/QAARP/QARisk.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/QUANTAXIS/QAARP/QARisk.py b/QUANTAXIS/QAARP/QARisk.py index 1f712e920..58131cc88 100755 --- a/QUANTAXIS/QAARP/QARisk.py +++ b/QUANTAXIS/QAARP/QARisk.py @@ -409,9 +409,11 @@ def beta(self): beta比率 组合的系统性风险 """ try: - res = round(float(self.calc_beta(self.profit_pct.dropna(), - self.benchmark_profitpct.dropna())), - 2) + # res = round(float(self.calc_beta(self.profit_pct.dropna(), + # self.benchmark_profitpct.dropna())), + # 2) + + res = round(float(self.calc_beta(self.assets.pct_change().dropna().values, self.benchmark_assets.pct_change().dropna().values)),2) except: print('贝塔计算错误。。') res = 0 @@ -468,7 +470,7 @@ def calc_annualize_return(self, assets, days): def calc_profitpctchange(self, assets): #return assets[::-1].pct_change()[::-1] - return assets.diff().pct_change() + return assets.diff().pct_change().fillna(0) def calc_beta(self, assest_profit, benchmark_profit): From 63010daf0f701449e09417f5916b27e5657bfb21 Mon Sep 17 00:00:00 2001 From: yutiansut Date: Sun, 17 May 2020 01:16:53 +0800 Subject: [PATCH 4/4] # --- QUANTAXIS/QAARP/QARisk.py | 2 +- QUANTAXIS/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/QUANTAXIS/QAARP/QARisk.py b/QUANTAXIS/QAARP/QARisk.py index 58131cc88..dca515203 100755 --- a/QUANTAXIS/QAARP/QARisk.py +++ b/QUANTAXIS/QAARP/QARisk.py @@ -470,7 +470,7 @@ def calc_annualize_return(self, assets, days): def calc_profitpctchange(self, assets): #return assets[::-1].pct_change()[::-1] - return assets.diff().pct_change().fillna(0) + return assets.pct_change().fillna(1) def calc_beta(self, assest_profit, benchmark_profit): diff --git a/QUANTAXIS/__init__.py b/QUANTAXIS/__init__.py index b193b16cc..0c3500958 100755 --- a/QUANTAXIS/__init__.py +++ b/QUANTAXIS/__init__.py @@ -31,7 +31,7 @@ 2017/4/8 """ -__version__ = '1.9.21' +__version__ = '1.9.23' __author__ = 'yutiansut' import argparse