Commit 97a3a779 authored by stephen.wang's avatar stephen.wang

Merge remote-tracking branch 'origin/dev-dividend' into dev-dividend

parents 17d2a2e8 dc58d48b
...@@ -41,9 +41,9 @@ def format_weight(weight: dict, to=1) -> dict: ...@@ -41,9 +41,9 @@ def format_weight(weight: dict, to=1) -> dict:
low = get_config('portfolios.solver.mpt.low-weight') low = get_config('portfolios.solver.mpt.low-weight')
high = get_config('portfolios.solver.mpt.high-weight')[0] 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: if weight_series.sum() < to:
weight_series[minidx] += to - weight_series.sum() weight_series[minidx] += to - weight_series.sum()
elif weight_series.sum() > to: 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