All Projects → siavashadpey → rebalance

siavashadpey / rebalance

Licence: other
A portfolio rebalancing tool.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to rebalance

okama
Investment portfolio and stocks analyzing tools for Python with free historical data
Stars: ✭ 87 (+262.5%)
Mutual labels:  portfolio, rebalancing
freeturn
Freelance mission control
Stars: ✭ 50 (+108.33%)
Mutual labels:  portfolio
Gatsby Theme Byfolio
A simplified way to create a portfolio using GatsbyJS
Stars: ✭ 240 (+900%)
Mutual labels:  portfolio
trekhleb.github.io
🧬 My personal website with a list of my projects that help people learn and blog posts about life, web-development, and machine-learning.
Stars: ✭ 145 (+504.17%)
Mutual labels:  portfolio
Home
The personal website/portfolio of Hashir Shoaib. Built using React and Bootstrap.
Stars: ✭ 246 (+925%)
Mutual labels:  portfolio
kristoffer
It's a website.
Stars: ✭ 25 (+4.17%)
Mutual labels:  portfolio
Python Trading Robot
A trading robot, that can submit basic orders in an automated fashion using the TD API.
Stars: ✭ 235 (+879.17%)
Mutual labels:  portfolio
bartzalewski.com-v2
My 2nd portfolio website
Stars: ✭ 31 (+29.17%)
Mutual labels:  portfolio
gatsby-contentful-portfolio
Portfolio theme for Gatsby
Stars: ✭ 107 (+345.83%)
Mutual labels:  portfolio
vimeography
The easiest way to display beautiful video collections on your WordPress site.
Stars: ✭ 14 (-41.67%)
Mutual labels:  portfolio
cointop
A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀
Stars: ✭ 3,589 (+14854.17%)
Mutual labels:  portfolio
Gatsby Starter Portfolio Jodie
Image-heavy photography portfolio with colorful accents & customizable pages. Includes adaptive image grids powered by CSS grid and automatic image integration into projects.
Stars: ✭ 249 (+937.5%)
Mutual labels:  portfolio
antonybudianto-web-old
Personal website
Stars: ✭ 14 (-41.67%)
Mutual labels:  portfolio
Govuk Prototype Kit
Rapidly create HTML prototypes of GOV.UK services
Stars: ✭ 239 (+895.83%)
Mutual labels:  portfolio
CharlesCreativeContent
Thank You For Supporting me and the community I Support!
Stars: ✭ 46 (+91.67%)
Mutual labels:  portfolio
Cryptoshadow
CryptoCurrency Tracker for Android & iOS built with @flutter
Stars: ✭ 238 (+891.67%)
Mutual labels:  portfolio
win95
Windows 95 Portfolio built with Vue.js
Stars: ✭ 83 (+245.83%)
Mutual labels:  portfolio
Renato66.github.io
Portfolio
Stars: ✭ 25 (+4.17%)
Mutual labels:  portfolio
nuro.dev
🌿 Personal Portfolio
Stars: ✭ 260 (+983.33%)
Mutual labels:  portfolio
vue-quasar-company-profile-website
Kudos - Company profile website made using Vue.js and Quasar Framework
Stars: ✭ 119 (+395.83%)
Mutual labels:  portfolio

Rebalance

Build Status Coverage Code Factor Documentation Status

A calculator which tells you how to split your investment amongst your portfolio's assets based on your target asset allocation.

To use it, install the package and write a driver file as described below.

Installation

Clone the repository:

git clone https://github.com/siavashadpey/rebalance.git

Install the package:

cd rebalance
pip3 install .

Example

Make a driver file:

The driver file is where we create our portfolio. We specify all of its assets and the available cash we have to invest.

Follow the steps below for a detailed description. Alternatively, you can simply modify the example driver file.

cd rebalance
touch driver_file.py

Import all necessary packages:

from rebalance import Portfolio

First we create our portfolio:

# My portfolio
p = Portfolio()

Then we add our assets:

We must specify the ticker symbol and the quantity of each asset we currently have in our portfolio.

The portfolio used in this example is one of Canadian Portfolio Manager's model portfolios. This blog along with Canadian Couch Potato advocate low-cost, globally diversified index funds for DIY investors.
# Assets in portfolio
# The price will be retrieved automatically
tickers = ["XBB.TO",   # iShares Core Canadian Universe Bond Index ETF
           "XIC.TO",   # iShares Core S&P/TSX Capped Composite Index ETF
           "ITOT",     # iShares Core S&P Total U.S. Stock Market ETF
           "IEFA",     # iShares Core MSCI EAFE ETF
           "IEMG"]     # iShares Core MSCI Emerging Markets ETF
quantities = [36, 64, 32, 8, 7]
p.easy_add_assets(tickers=tickers, quantities=quantities)

We also need to add cash to our portfolio:

This is the amount that we are investing. We can add cash in different currencies.

# Cash in portfolio
cash_amounts = [3000., 200.]
cash_currency = ["USD", "CAD"]
p.easy_add_cash(amounts=cash_amounts, currencies=cash_currency)

Finally, we need to specify our target asset allocation:

The target asset allocation used in this example is that of an aggressive portfolio with 80% equities and 20% bonds (XBB.TO).
# Target asset allocation (in %)
target_asset_alloc = {
"XBB.TO": 20,
"XIC.TO": 20,
"ITOT":   36,
"IEFA":   20,
"IEMG":    4
}

Let the optimizer rebalance our portfolio!

# rebalance
p.selling_allowed = False # We don't want to sell any of our assets for this case
p.rebalance(target_asset_alloc, verbose=True)

You should see something similar to this (the actual values might differ due to changes in prices and exchange rates).

 Ticker      Ask     Quantity      Amount    Currency     Old allocation   New allocation     Target allocation
                      to buy         ($)                      (%)              (%)                 (%)
---------------------------------------------------------------------------------------------------------------
  XBB.TO    33.43       30         1002.90      CAD          17.52            19.99               20.00
  XIC.TO    24.27       27          655.29      CAD          22.61            20.01               20.00
    ITOT    69.38       10          693.80      USD          43.93            35.88               36.00
    IEFA    57.65       20         1153.00      USD           9.13            19.88               20.00
    IEMG    49.14        0            0.00      USD           6.81             4.24                4.00

Largest discrepancy between the new and the target asset allocation is 0.24 %.

Before making the above purchases, the following currency conversion is required:
    1072.88 USD to 1458.19 CAD at a rate of 1.3591.

Remaining cash:
    80.32 USD.
    0.00 CAD.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].