diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a042df..f5fbb8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## v0.11.3 - 2021.01.31 + ### added - 场内账单增加忽略基金的 # 前缀支持 @@ -10,12 +12,16 @@ - 更新了主流国际市场 2021 休市日 +- 增加了可转债工具箱对 B 评级可转债的支持 + ### fixed - 进一步修改申购费自定义的小数点错误:第一笔申购情形 - 修复了 _float 中遇到百分数的 bug +- 转2修正为可转债类型 + ## v0.11.2 - 2021.01.01 ### added diff --git a/doc/samples/qdiipred.py b/doc/samples/qdiipred.py index 5deb235..212ca14 100644 --- a/doc/samples/qdiipred.py +++ b/doc/samples/qdiipred.py @@ -49,7 +49,6 @@ def cached_get_bar(code, *args, **kws): "SZ164824", "SH513030", "SZ160140", - "SZ161714", "SZ165510", "SZ164906", "SH513050", diff --git a/setup.py b/setup.py index be6a182..9b09526 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setuptools.setup( name="xalpha", - version="0.11.2", + version="0.11.3", author="refraction-ray", author_email="refraction-ray@protonmail.com", description="all about fund investment", diff --git a/xalpha/__init__.py b/xalpha/__init__.py index 176bad8..e6a58ac 100644 --- a/xalpha/__init__.py +++ b/xalpha/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.11.2" +__version__ = "0.11.3" __author__ = "refraction-ray" __name__ = "xalpha" diff --git a/xalpha/toolbox.py b/xalpha/toolbox.py index ef5e8a7..fdc7cdb 100644 --- a/xalpha/toolbox.py +++ b/xalpha/toolbox.py @@ -829,7 +829,7 @@ def process_byday(self, date=None): ) * np.sqrt(244) if not self.refvolatility: self.volatility = 0.17 - if self.rating in ["A-", "A", "A+"]: + if self.rating in ["A-", "A", "A+"] or self.rating.startswith("B"): self.volatility = 0.25 elif self.rating in ["AA-"]: self.volatility = 0.2 @@ -855,9 +855,9 @@ def process_byday(self, date=None): ).days if not self.refbondrate: ratestable = get_bond_rates(self.rating, self.date_obj.strftime("%Y-%m-%d")) - if self.rating in ["A", "A+", "AA-"]: + if self.rating in ["A", "A+", "AA-"] or self.rating.startswith("B"): ## AA 到 AA- 似乎是利率跳高的一个坎 - cutoff = 2 + cutoff = 3 # changed from 2 by considering more credit risk else: cutoff = 4 if self.days / 365 > cutoff: diff --git a/xalpha/trade.py b/xalpha/trade.py index 7733d15..dadf855 100644 --- a/xalpha/trade.py +++ b/xalpha/trade.py @@ -754,7 +754,7 @@ def get_type(self): ): self.type_ = "场内基金" elif code.startswith("SH11") or code.startswith("SZ12"): - if self.name.endswith("转债"): + if self.name.endswith("转债") or self.name.endswith("转2"): self.type_ = "可转债" else: self.type_ = "债券" diff --git a/xalpha/universal.py b/xalpha/universal.py index 2af48bc..799acbd 100644 --- a/xalpha/universal.py +++ b/xalpha/universal.py @@ -869,7 +869,7 @@ def get_bond_rates(rating, date=None): """ rating = rating.strip() rating_uid = { - "N": "2c9081e50a2f9606010a3068cae70001", + "N": "2c9081e50a2f9606010a3068cae70001", # 国债 "AAA": "2c9081e50a2f9606010a309f4af50111", "AAA-": "8a8b2ca045e879bf014607ebef677f8e", "AA+": "2c908188138b62cd01139a2ee6b51e25", @@ -878,6 +878,11 @@ def get_bond_rates(rating, date=None): "A+": "2c9081e91b55cc84011be40946ca0925", "A": "2c9081e91e6a3313011e6d438a58000d", "A-": "8a8b2ca04142df6a014148ca880f3046", + "A": "2c9081e91e6a3313011e6d438a58000d", + "BBB+": "2c9081e91ea160e5011eab1f116c1a59", + "BBB": "8a8b2ca0455847ac0145650780ad68fb", + "BB": "8a8b2ca0455847ac0145650ba23b68ff", + "B": "8a8b2ca0455847ac0145650c3d726901", } # 上边字典不全,非常欢迎贡献 :) def _fetch(date):