|
17 | 17 | # abs_deviation=0.10, |
18 | 18 | # rel_deviation=0.40 |
19 | 19 | ) |
20 | | -weights = [0.12, 0.21, 0.42, 0.25] |
| 20 | +weights = [0, 0, 1, 0] |
21 | 21 | pf = ok.Portfolio( |
22 | 22 | ['RGBITR.INDX', 'RUCBTRNS.INDX', 'MCFTR.INDX', 'GC.COMM'], |
23 | 23 | weights=weights, |
|
43 | 43 | # cf_strategy.amount = 10_000_000 * 0.05 |
44 | 44 | # cf_strategy.indexation = 0.09 |
45 | 45 |
|
| 46 | +# Cut Whithdrawals if Drawdown CWID strategy |
| 47 | +cf_strategy = ok.CutWithdrawalsIfDrawdown(pf) |
| 48 | + |
| 49 | +cf_strategy.initial_investment = 10_000_000 |
| 50 | +cf_strategy.frequency = "year" |
| 51 | +cf_strategy.amount = -10_000_000 * 0.05 |
| 52 | +cf_strategy.indexation = 0.09 |
| 53 | +cf_strategy.crash_threshold_reduction = [ |
| 54 | + (.10, .20), |
| 55 | + (.20, .50), |
| 56 | + (.40, 1), |
| 57 | +] |
| 58 | + |
46 | 59 | # d = { |
47 | 60 | # "2015-06": -35_000_000, |
48 | 61 | # } |
49 | 62 | # |
50 | 63 | # cf_strategy.time_series_dic = d |
51 | 64 | # cf_strategy.time_series_discounted_values = False |
52 | 65 |
|
53 | | -# VDS strategy |
54 | | -cf_strategy = ok.VanguardDynamicSpending(pf) |
55 | | -cf_strategy.initial_investment = 1_000_000 |
56 | | -cf_strategy.percentage = -0.08 |
57 | | -cf_strategy.indexation = 0.09 |
58 | | -# cf_strategy.min_max_annual_withdrawal = 10_000_000 / 5, 10_000_000 / 10 # 20%, 10% |
59 | | -cf_strategy.floor_ceiling = -0.10, 0.20 |
60 | | -# cf_strategy.time_series_dic = d |
61 | | -# cf_strategy.time_series_discounted_values = False |
| 66 | +# # VDS strategy |
| 67 | +# cf_strategy = ok.VanguardDynamicSpending(pf) |
| 68 | +# cf_strategy.initial_investment = 1_000_000 |
| 69 | +# cf_strategy.percentage = -0.08 |
| 70 | +# cf_strategy.indexation = 0.09 |
| 71 | +# # cf_strategy.min_max_annual_withdrawal = 10_000_000 / 5, 10_000_000 / 10 # 20%, 10% |
| 72 | +# cf_strategy.floor_ceiling = -0.10, 0.20 |
| 73 | +# # cf_strategy.time_series_dic = d |
| 74 | +# # cf_strategy.time_series_discounted_values = False |
62 | 75 |
|
63 | 76 | pf.dcf.cashflow_parameters = cf_strategy # assign the cash flow strategy to portfolio |
64 | 77 |
|
|
74 | 87 | # # period=15, |
75 | 88 | # # number=100 |
76 | 89 | # # ) |
77 | | -# print(pf.dcf.cashflow_parameters.time_series_dic) |
| 90 | +# print(pf.dcf.cashflow_parameters._crash_threshold_reduction_series) |
78 | 91 |
|
79 | 92 | # wi = pf.dcf.wealth_index(discounting="pv", include_negative_values=False) |
80 | 93 | cf = pf.dcf.cash_flow_ts(discounting="pv", remove_if_wealth_index_negative=True).resample("Y").sum() |
81 | 94 | # wi = pf.dcf.monte_carlo_wealth(discounting="fv", include_negative_values=False) |
82 | 95 | # cf = pf.dcf.monte_carlo_cash_flow(discounting="pv", remove_if_wealth_index_negative=True) |
83 | | -print(cf) |
84 | | -print(cf.pct_change()) |
| 96 | +# print(cf) |
| 97 | +# print(cf.pct_change()) |
85 | 98 | # wi.plot( |
86 | 99 | # # kind="bar", |
87 | 100 | # legend=False |
|
90 | 103 | # plt.show() |
91 | 104 | # |
92 | 105 | # df = cf[0] |
93 | | -# df[df != 0].plot( |
94 | | -# kind="bar", |
95 | | -# legend=False |
96 | | -# ) |
97 | | -# plt.yscale('linear') # linear or log |
98 | | -# plt.show() |
| 106 | +cf.plot( |
| 107 | + kind="bar", |
| 108 | + legend=False |
| 109 | +) |
| 110 | +plt.yscale('linear') # linear or log |
| 111 | +plt.show() |
99 | 112 |
|
100 | 113 | # print(df[df != 0]) |
101 | 114 |
|
|
0 commit comments