Skip to content

Commit 5d2d323

Browse files
committed
chore: update main.py and main_notebook.ipynb
1 parent 43db91f commit 5d2d323

File tree

2 files changed

+286
-68
lines changed

2 files changed

+286
-68
lines changed

main.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
pd.set_option("display.float_format", lambda x: "%.2f" % x)
1313

14-
al = ok.AssetList(["MEBCTR.INDX", "MCFTR.INDX"], ccy="RUB", inflation=False)
15-
16-
td = al.tracking_difference()
17-
18-
print(td.tail())
1914

2015
# portfolio = ['RUCBTRNS.INDX', 'RGBITR.INDX', 'MCFTR.INDX', 'GC.COMM' ] # Список активов
2116
# weights = [.22, .09, .45, .24]
@@ -31,25 +26,35 @@
3126
# print(pf.dividend_yield_annual)
3227

3328

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+
5148
# 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)
5358

5459

5560

0 commit comments

Comments
 (0)