Skip to content

Commit

Permalink
0.9.29 update
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Sep 22, 2023
1 parent f68db2a commit 7724ada
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions czsc/sensors/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class FeatureAnalyzeBase:
"""【基类】特征计算与分析"""
"""【基类】特征计算与分析,适用于时序量价类因子"""

def __init__(self, symbols, read_bars, **kwargs) -> None:
"""初始化函数
Expand Down Expand Up @@ -124,7 +124,7 @@ def report(self):

for feature in self.new_features:
logger.info(f"特征 {feature} 的取值范围:{self.dfs[feature].describe().round(4).to_dict()}")
df1, res1 = cross_sectional_ic(self.dfs, x_col=feature, y_col='n1b', method=corr_method, dt_col='dt')
df1, res1 = cross_sectional_ic(self.dfs, x_col=feature, y_col='n1b', method=corr_method, dt_col='dt')
logger.info(f"特征 {feature} 与未来1日收益的相关系数:{res1}")
_ = self.layering(feature, 0.95, 1)
_ = self.layering(feature, 0.9, 1)
Expand Down
1 change: 0 additions & 1 deletion czsc/utils/bar_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def resample_bars(df: pd.DataFrame, target_freq: Union[Freq, AnyStr], raw_bars=T


class BarGenerator:
"""使用日线合成周线、月线、季线"""

def __init__(self, base_freq: str, freqs: List[str], max_count: int = 5000):
self.symbol = None
Expand Down
7 changes: 3 additions & 4 deletions examples/close_sma5_dist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from czsc.sensors.feature import FeatureAnalyzeBase
import czsc


class SMA5Dist(FeatureAnalyzeBase):
class SMA5Dist(czsc.FeatureAnalyzeBase):

@property
def new_features(self):
Expand Down Expand Up @@ -31,5 +31,4 @@ def add_features(self, df):
from czsc.connectors.research import get_raw_bars, get_symbols

sd = SMA5Dist(symbols=get_symbols('中证500成分股'), read_bars=get_raw_bars, freq='日线', sdt='20210101', edt='20230101',
max_workers=10,
results_path=r"C:\sma5dist")
max_workers=10, results_path=r"C:\sma5dist")

0 comments on commit 7724ada

Please sign in to comment.