Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evaluate_pairs 兼容参数pairs为空dataframe的情况 #162

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion czsc/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ def evaluate_pairs(pairs: pd.DataFrame, trade_dir: str = "多空") -> dict:
"""
from czsc.objects import cal_break_even_point

pairs = pairs.copy()
if pairs.empty:
pairs = pairs.reindex(columns=["标的代码", "策略标记", "交易方向", "开仓时间","平仓时间", "开仓价格", "平
仓价格", "持仓K线数", "事件序列", "持仓天数", "盈亏比例"])
else:
pairs = pairs.copy()
if trade_dir in ["多头", "空头"]:
pairs = pairs[pairs["交易方向"] == trade_dir]
else:
Expand Down
Loading