from rebalancer import Portfolio, Calculator, Currency
from datetime import date

# define your portfolio
ticker = ['XDWD.L', 'XMME.L', 'IMAE.AS', 'SCHA']
shares = [130, 127, 79, 25]
target = [0.55, 0.25, 0.15, 0.05]
# define at which date you value your portfolio, your home currency and how much to invest
valuation_date = date(2021, 8, 20)
home_currency = Currency.CHF
investment_amount_in_home_currency = 10000
# evaluate current portfolio
pf = Portfolio(ticker, shares, target)
calc = Calculator(pf, valuation_date, home_currency)
current_portfolio = calc.evaluate_portfolio()
# plot current asset allocation
calc.plot_current_asset_allocation()
# get buy-only rebalance amounts
invest_by_asset = calc.buy_only_rebalancing(investment_amount_in_home_currency)
# plot new asset allocation
calc.plot_asset_allocation_after_rebalancing()