Skip to content

Commit

Permalink
v3.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chen-001 committed Dec 18, 2022
1 parent 2396829 commit bf8818b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 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__ = "2022-12-14 01:02:39"
__version__ = "3.6.1"
__updated__ = "2022-12-15 20:52:25"
__version__ = "3.6.2"
__author__ = "chenzongwei"
__author_email__ = "[email protected]"
__url__ = "https://github.com/chen-001/pure_ocean_breeze"
Expand Down
11 changes: 8 additions & 3 deletions pure_ocean_breeze/data/read_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__updated__ = "2022-12-13 00:59:02"
__updated__ = "2022-12-16 00:48:25"

import os
import numpy as np
Expand Down Expand Up @@ -32,6 +32,7 @@ def read_daily(
ret: bool = 0,
ret_inday: bool = 0,
ret_night: bool = 0,
vol_daily: bool = 0,
vol: bool = 0,
vol_inday: bool = 0,
vol_night: bool = 0,
Expand Down Expand Up @@ -79,6 +80,8 @@ def read_daily(
为1则表示读取日内收益率, by default 0
ret_night : bool, optional
为1则表示读取隔夜波动率, by default 0
vol_daily : bool, optional
为1则表示读取使用分钟收盘价的标准差计算的波动率, by default 0
vol : bool, optional
为1则选择读取滚动20日日间波动率, by default 0
vol_inday : bool, optional
Expand Down Expand Up @@ -159,6 +162,8 @@ def read_daily(
/ read_daily(close=1, start=start).shift(1)
- 1
)
elif vol_daily:
df = pd.read_parquet(homeplace.factor_data_file + "草木皆兵/草木皆兵_初级.parquet")
elif vol:
df = read_daily(ret=1, start=start)
df = df.rolling(20, min_periods=10).std()
Expand Down Expand Up @@ -202,7 +207,7 @@ def read_daily(
else:
raise IOError("阁下总得读点什么吧?🤒")
df = df[df.index >= pd.Timestamp(str(start))]
return df
return df.dropna(how='all')


def read_market(
Expand Down Expand Up @@ -378,7 +383,7 @@ def read_index_single(code: str) -> pd.Series:
-------
pd.Series
日行情数据
"""
"""
try:
chc = ClickHouseClient("minute_data")
hs300 = (
Expand Down
22 changes: 14 additions & 8 deletions pure_ocean_breeze/labor/process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__updated__ = "2022-12-14 00:27:19"
__updated__ = "2022-12-16 00:45:28"

import warnings

Expand Down Expand Up @@ -1231,8 +1231,18 @@ def show_corrs_with_old(
daily = 1
else:
daily = 0
nums = os.listdir(homeplace.final_factor_file)
nums = sorted(
set(
[
int(i.split("多因子")[1].split("_月")[0])
for i in nums
if i.endswith(".parquet")
]
)
)
olds = []
for i in range(1, 100):
for i in nums:
try:
if daily:
old = database_read_final_factors(order=i)[0]
Expand All @@ -1243,13 +1253,9 @@ def show_corrs_with_old(
break
if df is not None:
olds = [df] + olds
corrs = show_corrs(
olds, ["new"] + [f"old{i}" for i in range(1, len(olds))], method=method
)
corrs = show_corrs(olds, ["new"] + [f"old{i}" for i in nums], method=method)
else:
corrs = show_corrs(
olds, [f"old{i}" for i in range(1, len(olds))], method=method
)
corrs = show_corrs(olds, [f"old{i}" for i in nums], method=method)
return corrs


Expand Down
4 changes: 4 additions & 0 deletions 更新日志/version3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 更新日志🗓 — v3

* v3.6.2 — 2022.12.18
> 1. 给read_daily函数增加了vol_daily参数,用于读取使用分钟收益率的标准差计算的每日波动率
> 1. 使read_daily读出的数据不再包含全为空值的行
> 1. 修复了因子标号跳跃导致的show_corrs_with_old函数显示不全的bug
* v3.6.1 — 2022.12.14
> 1. 修复了drop_duplicates_index的bug
> 1. 给pure_moonnight增加了without_breakpoint参数,用于控制iplot画图忽略空格
Expand Down

0 comments on commit bf8818b

Please sign in to comment.