|
11 | 11 |
|
12 | 12 | pd.set_option("display.float_format", lambda x: "%.2f" % x) |
13 | 13 |
|
14 | | -al = ok.AssetList(["MEBCTR.INDX", "MCFTR.INDX"], ccy="RUB", inflation=False) |
15 | | - |
16 | | -td = al.tracking_difference() |
17 | | - |
18 | | -print(td.tail()) |
19 | 14 |
|
20 | 15 | # portfolio = ['RUCBTRNS.INDX', 'RGBITR.INDX', 'MCFTR.INDX', 'GC.COMM' ] # Список активов |
21 | 16 | # weights = [.22, .09, .45, .24] |
|
31 | 26 | # print(pf.dividend_yield_annual) |
32 | 27 |
|
33 | 28 |
|
34 | | -# assets = ['MCFTR.INDX', 'RGBITR.INDX'] |
35 | | -# weights = [0.60, 0.40] |
36 | | -# pf = ok.Portfolio(assets, weights=weights, ccy='RUB', rebalancing_period='year', inflation=False) |
37 | | -# |
38 | | -# ind = ok.IndexationStrategy(pf) |
39 | | -# ind.initial_investment = 4_000 # the initial investments size |
40 | | -# ind.amount = -10 # set withdrawal/contribution size |
41 | | -# ind.frequency = "month" # set cash flow frequency TODO: add parameter |
42 | | -# ind.indexation = None # set indexation size |
43 | | -# pf.dcf.cashflow_parameters = ind |
44 | | -# |
45 | | -# pf.dcf.set_mc_parameters( |
46 | | -# distribution="norm", |
47 | | -# period=2, |
48 | | -# number=100 |
49 | | -# ) |
50 | | -# |
| 29 | +assets = ['RGBITR.INDX', 'RUCBTRNS.INDX', 'MCFTR.INDX', 'GC.COMM'] |
| 30 | +weights = [0.16, 0.40, 0.25, 0.19] |
| 31 | +pf = ok.Portfolio(assets, weights=weights, ccy='RUB', rebalancing_period='year', inflation=False) |
| 32 | +pf.dcf.discount_rate = 0.09 |
| 33 | + |
| 34 | +ind = ok.IndexationStrategy(pf) |
| 35 | +ind.initial_investment = 2_000_000 * 90 |
| 36 | +ind.amount = -4000 * 90 |
| 37 | +ind.frequency = "month" |
| 38 | +ind.indexation = 0.09 |
| 39 | + |
| 40 | +pf.dcf.cashflow_parameters = ind |
| 41 | + |
| 42 | +pf.dcf.set_mc_parameters( |
| 43 | + distribution="norm", |
| 44 | + period=50, |
| 45 | + number=1000 |
| 46 | +) |
| 47 | + |
51 | 48 | # df = pf.dcf.monte_carlo_survival_period() |
52 | | -# print(df) |
| 49 | +# print(df.describe()) |
| 50 | + |
| 51 | +w, err = pf.dcf.find_the_largest_withdrawals_size( |
| 52 | + goal="maintain_balance_pv", |
| 53 | + percentile=20, |
| 54 | + tolerance_rel=0.01, |
| 55 | +) |
| 56 | + |
| 57 | +print(w, err) |
53 | 58 |
|
54 | 59 |
|
55 | 60 |
|
|
0 commit comments