Skip to content

Commit

Permalink
0.9.24 update
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Jul 13, 2023
1 parent d41a3d6 commit 1386e63
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions czsc/sensors/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,22 @@ def __init__(self, events: List[Union[Dict[str, Any], Event]], symbols: List[str

self.kwargs = kwargs
logger.info(f"事件匹配传感器初始化完成,共有{len(self.events)}个事件,{len(self.symbols)}个标的")
self.data = self._multi_symbols(self.symbols, max_workers=self.kwargs.pop("max_workers", 1))
self.data.to_feather(os.path.join(self.results_path, "data.feather"))
file_data = os.path.join(self.results_path, "data.feather")
if os.path.exists(file_data):
self.data = pd.read_feather(file_data)
logger.info(f"读取事件匹配数据:{file_data}")
else:
self.data = self._multi_symbols(self.symbols, max_workers=self.kwargs.pop("max_workers", 1))
self.data.to_feather(os.path.join(self.results_path, "data.feather"))

_res = []
for event_name in self.events_name:
df = self.get_event_csc(event_name)
df = df.set_index("dt")
_res.append(df)
df = pd.concat(_res, axis=1, ignore_index=False).reset_index()
file_csc = os.path.join(self.results_path, f"cross_section_counts.xlsx")
df.to_excel(file_csc, index=False)
file_csc = os.path.join(self.results_path, f"cross_section_counts.csv")
df.to_csv(file_csc, index=False)
logger.info(f"截面匹配次数计算完成,结果保存至:{file_csc}")

# csc = cross section count,表示截面匹配次数
Expand Down

0 comments on commit 1386e63

Please sign in to comment.