Cryptolio is a cryptocurrency portfolio rebalancing tool based on the strategy described in the Crypto20 whitepaper. Performances can be seen in real time in Crypto20 portal.
Crypto20 backtestings showed optimal results with the following parameters:
- 20 crypto currencies with the top market capitalisation
- 10% max capping level
- Weekly rebalancing interval
For those who missed the Crypto20 ICO or want to keep control of their cryptos, this tool can perform portfolio rebalancing automatically in less than one minute! The only thing to do is to run it once a week!
- Supported platforms: all platforms supported by the cctx library (tested Bittrex and Binance so far)
- Cold wallet support: indicate the amount of cryptos to keep on the cold wallet
- Rebalancing among multiple platforms at the same time
- Automatically find the top cryptos by market capitalisation
- Include or exclude specific cryptos from the portfolio
- Automatic or manual weighting of each crypto
- Place real orders to do the rebalancing
- Backtesting and charts to find optimal parameters
- Get the top cryptos ranked by market capitalisation to include in the ideal portfolio (using coinmarketcap library)
- Compute the total available capital (cold wallet + online platforms cryptos) value in Bitcoin (using ccxt library)
- Compute the weighings (capped and proportionnal to market capitalisation) and quantity of each crypto in the ideal portfolio
- Subtract the cold wallet crypto balances to get the ideal global online portfolio
- Split the ideal global online portfolio to get the specific ideal portfolio for each platform (sometime a crypto in not supported on a platform)
- Compute the delta between the current portfolio and the target portfolio for each platform
- Execute sell orders, then buy orders (using ccxt library)
- Compute the amount of cryptos to send to the cold wallet to keep a good ratio between online and cold wallets
Backtest output example is in backtest.log.
Backtest profit chart example:
Backtest winners chart example:
At the end of the log file there is a summary:
Final capital: 3189.29 $ with capping_level=0.25 and number_of_cryptos=100 3158.87 $ with capping_level=0.25 and number_of_cryptos=20 3133.63 $ with capping_level=0.25 and number_of_cryptos=50 2933.89 $ with capping_level=0.1 and number_of_cryptos=20 2917.50 $ with capping_level=0.15 and number_of_cryptos=20 2829.19 $ with capping_level=0.15 and number_of_cryptos=100 2804.95 $ with capping_level=0.15 and number_of_cryptos=50 2691.88 $ with capping_level=0.1 and number_of_cryptos=50 2686.20 $ with capping_level=0.1 and number_of_cryptos=100 2579.58 $ with capping_level=0.05 and number_of_cryptos=100 2550.81 $ with capping_level=0.05 and number_of_cryptos=50 2512.75 $ with capping_level=0.05 and number_of_cryptos=20 The parameters with maximum number of wins are capping_level=0.25 and number_of_cryptos=100
For privacy reasons, the capital in example outputs is totally fictive.
Rebalancing output example is in rebalancing.log.
The results slightly differs from Crypto20 whitepaper results are they are ran only on 2017 year and include newer data. Crypto20 params are a safe choice though.
Clone the git repository:
git clone https://github.com/frossigneux/cryptolio.git
Install the package:
cd cryptolio pip install .
Set parameters in the configuration file and equitably distribute your funds among the platforms.
Now you can run cryptolio-rebalancing by typing:
cryptolio-rebalancing settings.cfg
And doing backtests by typing:
cryptolio-backtest settings.cfg
The directory backtest_cache contains cached data from coinmarketcap (top 1000 cryptos) from 1th January 2019 to 12th February 2023. New data will be downloaded and inserted into the cache if cached data are not available.
All settings should be set in the settings.cfg file.
Note: multiple platforms can be used at the same time.
This section allows to set manual weighings for some cryptos.
Allowed values are:
Parameter | Description |
---|---|
0 | Exclude the crypto from the portfolio (this crypto will be sold) |
0.15 (for example) | Specific weighting (a float between 0 and 1) bypassing the capping_level parameter |
auto | Force the inclusion of a crypto (weighting will be computed automatically) |
This section allows to set the amount of each crypto actually stored in the cold wallet. The amount can be set to 0 to indicate that the crypto is supported by the cold wallet. All tokens supported by MyEtherWallet are automatically considered as supported.
Parameter | Description |
---|---|
start_date | Backtest start date (default 2019-01-01) |
end_date | Backtest end date (default now) |
week_interval | Number of weeks between two rebalancings |
initial_capital | Initial capital for starting the backtest (default 1000 $) |
capping_level | List of capping levels (comma-separated float values) |
number_of_cryptos | List of number of cryptos included in the portfolio (comma-separated integer values) |
fees | Trading platform fees (default 0.25%) |
draw_charts | Show charts (default true) |
log_scale | Use log scale (default true) |
cache_dir | Cache dir to speed up the backtests (default backtest_cache) |
This section allows to set manual weighings for some cryptos for the backtests.
Feel free to send me your ideas and bug reports!