diff --git a/pure_ocean_breeze/__init__.py b/pure_ocean_breeze/__init__.py index 071b9c6..2bed341 100644 --- a/pure_ocean_breeze/__init__.py +++ b/pure_ocean_breeze/__init__.py @@ -2,8 +2,8 @@ 一个量化多因子研究的框架,包含数据、回测、因子加工等方面的功能 """ -__updated__ = "2023-07-04 16:16:50" -__version__ = "4.0.5" +__updated__ = "2023-07-13 08:36:22" +__version__ = "4.0.6" __author__ = "chenzongwei" __author_email__ = "winterwinter999@163.com" __url__ = "https://github.com/chen-001/pure_ocean_breeze" diff --git a/pure_ocean_breeze/data/tools.py b/pure_ocean_breeze/data/tools.py index c6a407f..fdab2a3 100644 --- a/pure_ocean_breeze/data/tools.py +++ b/pure_ocean_breeze/data/tools.py @@ -2,7 +2,7 @@ 针对一些不常见的文件格式,读取数据文件的一些工具函数,以及其他数据工具 """ -__updated__ = "2023-07-07 10:32:50" +__updated__ = "2023-07-10 12:46:10" import os import pandas as pd @@ -537,6 +537,7 @@ def get_monthly_factor( old_date = old.index.max() if old_date == self.fac.date.max(): logger.info(f"本地文件已经是最新的了,无需计算") + self.fac=old else: try: new_date = self.find_begin( diff --git a/pure_ocean_breeze/data/write_data.py b/pure_ocean_breeze/data/write_data.py index 683a47d..cfb9e61 100644 --- a/pure_ocean_breeze/data/write_data.py +++ b/pure_ocean_breeze/data/write_data.py @@ -1,4 +1,4 @@ -__updated__ = "2023-07-02 02:35:59" +__updated__ = "2023-07-14 15:11:40" import time diff --git a/pure_ocean_breeze/labor/process.py b/pure_ocean_breeze/labor/process.py index 96398ad..5ea2224 100644 --- a/pure_ocean_breeze/labor/process.py +++ b/pure_ocean_breeze/labor/process.py @@ -1,4 +1,4 @@ -__updated__ = "2023-07-07 10:21:18" +__updated__ = "2023-07-13 12:17:42" import warnings @@ -3417,7 +3417,12 @@ def cal_one(date1, date2): max_workers=n_jobs ) as executor: factor_new_more = list( - tqdm.auto.tqdm(executor.map(cal_one, cuts), total=len(cuts)) + tqdm.auto.tqdm( + executor.map( + cal_one, cut_points[:-many_days], cut_points[many_days:] + ), + total=len(cut_points[many_days:]), + ) ) factor_new = factor_new + factor_new_more else: @@ -3468,7 +3473,12 @@ def cal_two(date1, date2): max_workers=n_jobs ) as executor: factor_new_more = list( - tqdm.auto.tqdm(executor.map(cal_two, cuts2), total=len(cuts2)) + tqdm.auto.tqdm( + executor.map( + cal_two, pairs, dates + ), + total=len(pairs), + ) ) factor_new = factor_new + factor_new_more else: @@ -5646,7 +5656,7 @@ def optimize_one_day( else: return None - def optimize_many_days(self, startdate: int = 20130101): + def optimize_many_days(self, startdate: int = STATES['START']): dates = [i for i in self.facs.index if i >= pd.Timestamp(str(startdate))] for date in tqdm.auto.tqdm(dates): fac = self.facs[self.facs.index == date].T.dropna() @@ -5692,7 +5702,7 @@ def make_contrast(self, weight, index, name) -> list[pd.DataFrame]: comments = comments_on_twins(rets[f"{name}增强组合超额净值"], abret.dropna()) return comments, rets - def run(self, startdate: int = 20130101) -> pd.DataFrame: + def run(self, startdate: int = STATES['START']) -> pd.DataFrame: """运行规划求解 Parameters diff --git a/pure_ocean_breeze/state/states.py b/pure_ocean_breeze/state/states.py index 1c6673f..935859a 100644 --- a/pure_ocean_breeze/state/states.py +++ b/pure_ocean_breeze/state/states.py @@ -2,14 +2,14 @@ 一些默认的参数 """ -__updated__ = "2022-11-04 14:41:09" +__updated__ = "2023-07-13 12:18:16" STATES = { "NO_LOG": False, "NO_COMMENT": False, "NO_SAVE": True, "NO_PLOT": False, - "START": 20130101, + "START": 20140101, "db_host": "127.0.0.1", "db_port": 3306, "db_user": "root", diff --git a/setup.py b/setup.py index 1a36dab..abc3d80 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -__updated__ = "2023-07-03 01:28:50" +__updated__ = "2023-07-14 15:12:11" from setuptools import setup import setuptools @@ -15,7 +15,8 @@ def get_version(package): init_py = open(os.path.join(package, "__init__.py")).read() return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) -install_requires=[ + +install_requires = [ # "numpy", "pandas<=1.5.3", "scipy", @@ -43,11 +44,16 @@ def get_version(package): "deprecation", "questdb", "mpire", + "py7zr", + "unrar", + "rarfile", + "zipfile", + "chardet", ] -if sys.platform.startswith('win'): - install_requires=install_requires+['psycopg2'] +if sys.platform.startswith("win"): + install_requires = install_requires + ["psycopg2"] else: - install_requires=install_requires+['psycopg2-binary'] + install_requires = install_requires + ["psycopg2-binary"] setup( name="pure_ocean_breeze", @@ -65,5 +71,9 @@ def get_version(package): license="MIT", packages=setuptools.find_packages(), requires=[], - extras_require={'windows':['psycopg2'],'macos':['psycopg2-binary'],'linux':['psycopg2-binary']} + extras_require={ + "windows": ["psycopg2"], + "macos": ["psycopg2-binary"], + "linux": ["psycopg2-binary"], + }, ) diff --git "a/\346\233\264\346\226\260\346\227\245\345\277\227/version4.md" "b/\346\233\264\346\226\260\346\227\245\345\277\227/version4.md" index 77adb23..a33d3b4 100644 --- "a/\346\233\264\346\226\260\346\227\245\345\277\227/version4.md" +++ "b/\346\233\264\346\226\260\346\227\245\345\277\227/version4.md" @@ -1,6 +1,15 @@ ## 更新日志🗓 — v4 +* v4.0.6 — 2023.7.14 + +> 1. 修复了pure_dawn读取已有因子值时`__call__`方法返回错误的问题 +> 2. 修复了pure_fall_frequent中关于计算因子值的bug +> 3. 修复了optimize_many_days函数和pure_linprog的run方法不受STATES['START']影响的bug +> 4. 随着时间的推移,将STATES['START']值修改为20140101 +> 5. 更新了依赖库 + + * v4.0.5 — 2023.7.7 > 1. 修复了pure_fall_nature中缺少fields参数和参数传递的bug @@ -49,7 +58,7 @@ > > ```python > import pure_ocean_breeze as p -> +> > p.ini() > ``` > 2. 初始化函数与`Homeplace`参数新增了存储逐笔数据的路径