Commit 49c4634a authored by wenwen.tang's avatar wenwen.tang 😕

bugfix

parent ce1261ab
...@@ -34,8 +34,12 @@ class DefaultPortfoliosChecker(PortfoliosChecker): ...@@ -34,8 +34,12 @@ class DefaultPortfoliosChecker(PortfoliosChecker):
# 若存在匹配值则执行后跳出循环 # 若存在匹配值则执行后跳出循环
if len(keys) > 0: if len(keys) > 0:
# 选取非同公司的、风险等级小于等于原基金的 基金 # 选取非同公司的、风险等级小于等于原基金的 基金
ids = [fund['id'] for fund in funds if fund['companyType'] != list(companies)[0] and min_risk = min(fund['risk'] for fund in funds if str(fund['id']) in keys)
fund['risk'] <= min(fund['risk'] for fund in funds if fund['id'] in keys)] ids = []
while len(ids) == 0:
ids = [fund['id'] for fund in funds if fund['companyType'] != list(companies)[0] and
fund['risk'] <= min_risk]
min_risk += 1
best = self.find_highest_score(ids, day) best = self.find_highest_score(ids, day)
# 若刚好有一个匹配,直接替换 # 若刚好有一个匹配,直接替换
if len(keys) == 1: if len(keys) == 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment