From 5aa6f16179fbce4b7f9980c46e5da1e32e771266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=98=89=E4=BF=8A?= <654181984@qq.com> Date: Wed, 31 May 2023 10:25:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddeprecate=20log=E5=86=97?= =?UTF-8?q?=E4=BD=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rqrisk/risk.py | 12 ++++++++++-- rqrisk/utils.py | 7 ++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/rqrisk/risk.py b/rqrisk/risk.py index fa43331..3bff158 100644 --- a/rqrisk/risk.py +++ b/rqrisk/risk.py @@ -179,15 +179,23 @@ def calmar(self): else: return self.annual_return / self.max_drawdown + @indicator_property(min_period_count=1) + def _excess_return_rate(self): + return np.expm1(np.log1p(self._active_returns).sum()) + @deprecate_property def excess_return_rate(self): # activate return rate - return np.expm1(np.log1p(self._active_returns).sum()) + return self._excess_return_rate @deprecate_property def excess_annual_return(self): + return self._excess_annual_return + + @indicator_property(min_period_count=1) + def _excess_annual_return(self): # active annual return - return (1 + self.excess_return_rate) ** (self._annual_factor / self.period_count) - 1 + return (1 + self._excess_return_rate) ** safe_div(self._annual_factor, self.period_count) - 1 @indicator_property(min_period_count=2, value_when_pc_not_satisfied=0.) def excess_volatility(self): diff --git a/rqrisk/utils.py b/rqrisk/utils.py index 51e2272..9562215 100644 --- a/rqrisk/utils.py +++ b/rqrisk/utils.py @@ -16,10 +16,7 @@ # 详细的授权流程,请联系 public@ricequant.com 获取。 import numpy as np -import logging - - -logger = logging.getLogger() +import warnings class IndicatorProperty: @@ -88,7 +85,7 @@ def deprecate_property(func): @property def inner(self): - logger.warning("\"{}\" is deprecate.".format(func.__name__)) + warnings.warn("'{}' is deprecate.".format(func.__name__)) return func(self) return inner From dbca8ba6c968c6a4caf056c721e3a1bdcf1f7cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=98=89=E4=BF=8A?= <654181984@qq.com> Date: Wed, 31 May 2023 10:29:32 +0800 Subject: [PATCH 2/3] fix versioneer --- versioneer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioneer.py b/versioneer.py index 5e9c41f..913c16e 100644 --- a/versioneer.py +++ b/versioneer.py @@ -1394,7 +1394,7 @@ def render_pep440_ricequant(pieces): raise Exception("Only post release tag allowed, tag %s" % tag) if pieces["distance"] > 0: rendered += ".post%d" % (parsed_tag._version.post[1] + 1) - rendered += ".dev%d-g%s" % (pieces["distance"], pieces["short"]) + rendered += ".dev%d" % pieces["distance"] elif pieces["distance"] == 0: rendered += ".post%d" % parsed_tag._version.post[1] if pieces["dirty"]: @@ -1404,13 +1404,13 @@ def render_pep440_ricequant(pieces): # 如果最近的tag是正式版tag,那么就是在开发该系列的.post1 elif parsed_working == parsed_tag: if pieces["distance"] > 0: - rendered += ".post1.dev%d-g%s" % (pieces["distance"], pieces["short"]) + rendered += ".post1.dev%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dirty" # 如果正在开发到是一个新的系列,那么就从该系列的.dev0开始 else: if pieces["distance"] >= 0: - rendered += ".dev%d-g%s" % (pieces["distance"], pieces["short"]) + rendered += ".dev%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dirty" @@ -1428,7 +1428,7 @@ def render_pep440_ricequant(pieces): "distance"] == 0: return rendered - rendered += ".g%s" % pieces["short"] + rendered += "+%s" % pieces["short"] return rendered From f5db425336772fb248276bd630018b914d8416a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=98=89=E4=BF=8A?= <654181984@qq.com> Date: Thu, 1 Jun 2023 10:24:48 +0800 Subject: [PATCH 3/3] update version --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 49a18bc..c269920 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,7 @@ [metadata] name = rqrisk -version = 1.0.6 +version = 1.0.7 [versioneer] VCS = git