Commit dc58d48b authored by wenwen.tang's avatar wenwen.tang 😕
parent b2d66be7
......@@ -41,9 +41,9 @@ def format_weight(weight: dict, to=1) -> dict:
low = get_config('portfolios.solver.mpt.low-weight')
high = get_config('portfolios.solver.mpt.high-weight')[0]
# 低风险
minidx = [i for i in id_sort if weight[i] < high][0]
minidx = [i for i in id_sort if weight_series[i] < high][0]
# 高风险
maxidx = [i for i in id_sort if weight[i] > low][-1]
maxidx = [i for i in id_sort if weight_series[i] > low][-1]
if weight_series.sum() < to:
weight_series[minidx] += to - weight_series.sum()
elif weight_series.sum() > to:
......
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