Skip to content

Commit

Permalink
v4.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
chen-001 committed Jul 14, 2023
1 parent d294ec3 commit 0d8ffc8
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 18 deletions.
4 changes: 2 additions & 2 deletions pure_ocean_breeze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion pure_ocean_breeze/data/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
针对一些不常见的文件格式,读取数据文件的一些工具函数,以及其他数据工具
"""

__updated__ = "2023-07-07 10:32:50"
__updated__ = "2023-07-10 12:46:10"

import os
import pandas as pd
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pure_ocean_breeze/data/write_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__updated__ = "2023-07-02 02:35:59"
__updated__ = "2023-07-14 15:11:40"

import time

Expand Down
20 changes: 15 additions & 5 deletions pure_ocean_breeze/labor/process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__updated__ = "2023-07-07 10:21:18"
__updated__ = "2023-07-13 12:17:42"

import warnings

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pure_ocean_breeze/state/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 16 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__updated__ = "2023-07-03 01:28:50"
__updated__ = "2023-07-14 15:12:11"

from setuptools import setup
import setuptools
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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"],
},
)
11 changes: 10 additions & 1 deletion 更新日志/version4.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -49,7 +58,7 @@
>
> ```python
> import pure_ocean_breeze as p
>
>
> p.ini()
> ```
> 2. 初始化函数与`Homeplace`参数新增了存储逐笔数据的路径
Expand Down

0 comments on commit 0d8ffc8

Please sign in to comment.