Commit da666688 authored by wenwen.tang's avatar wenwen.tang 😕

https://www.tapd.cn/59187493/documents/show/1159187493001000730

依照文档进行模型优化,bugfix
parent dc58d48b
......@@ -173,10 +173,12 @@ class FundDividendSortinoAssetOptimize(SortinoAssetOptimize):
exclude = f.get('exclude')
volatility = f.get('volatility')
records = [fund for fund in funds if fund['customType'] == customType and fund['id'] in annual.keys()]
records = sorted(records, key=lambda x: annual[x['id']])
if exclude is not None:
exclude = exclude if len(records) > exclude else len(records)
if exclude > 0:
records = records[:len(records) - exclude]
filtered.extend(records[-exclude:])
records = records[:- exclude]
if volatility is not None:
records = [record for record in records if annual.get(record['id']) > volatility]
filtered.extend(records)
......
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