Your Simple Guide To Creating An Effective Rebalancing Tool
Rebalancing is a great method to ensure you sell high and buy low, it takes the emotion out of trying to call the bottom or the top. It really is a staple of investing, although most asset management firms rebalance for you whether its an index fund or your 401(k), for this tool you will have to do the trading yourself. Normally you see a stock portfolio rebalanced quarterly but in crypto a more aggressive rebalancing strategy may be necessary.
In light of this I'm going to share a new Google Sheet I put together that assists you in rebalancing your portfolio.
Features
Before we start here are some cool features:
- Prices pulled from Coinmarketcap
- Automatically tells you what to buy and sell in your portfolio
- Can account for adding recurring deposits to your crypto portfolio
Ok lets begin...
1 - Make a copy of this Google Sheet: Rebalance Tool
2 - Once the Google Sheet is copied open Tools> Script Editor...
3 - Remove default text when script editor loads.
4 - Copy and Paste this into the new script:
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Refresh",
functionName : "refreshLastUpdate"
}];
sheet.addMenu("Refresh", entries);
};
function refreshLastUpdate() {
SpreadsheetApp.getActiveSpreadsheet().getRange('I5').setValue(new Date().toTimeString());
}
function ccprice(name, currency, datetime)
{
var url = "https://api.coinmarketcap.com/v1/ticker/" + name + "?convert=" + currency
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var data = JSON.parse(json);
var priceval = { "EUR" : data[0].price_eur, "USD" : data[0].price_usd, "BTC" : data[0].price_btc,
"AUD" : data[0].price_aud, "BRL" : data[0].price_brl, "CAD" : data[0].price_cad,
"CHF" : data[0].price_chf, "CNY" : data[0].price_cny, "RUB" : data[0].price_rub,
"GBP" : data[0].price_gbp, "HKD" : data[0].price_hkd, "IDR" : data[0].price_idr,
"INR" : data[0].price_inr, "JPY" : data[0].price_jpy, "KRW" : data[0].price_krw,
"MXN" : data[0].price_mxn, "eur" : data[0].price_eur, "usd" : data[0].price_usd,
"btc" : data[0].price_btc, "aud" : data[0].price_aud, "brl" : data[0].price_brl,
"chf" : data[0].price_chf, "cny" : data[0].price_cny, "rub" : data[0].price_rub,
"gbp" : data[0].price_gbp, "hkd" : data[0].price_hkd, "idr" : data[0].price_idr,
"inr" : data[0].price_inr, "jpy" : data[0].price_jpy, "krw" : data[0].price_krw,
"mxn" : data[0].price_mxn, "cad" : data[0].price_cad }
var price = priceval[currency]
return price
SpreadsheetApp.flush();
}
4 - Save Script (any name is fine)
5 - Start editing for your data. Collumns B, C, D are the only manually entered data.
- B - Name of your coin
- C - Ideal value that coin should be in as a percentage of your portfolio
- D - Quantity of coin currently held (You can put 0 if you intent to buy some)
6 - To add or change a coin or the FIAT currency just select the respective $G cell and change the name of the coin. See this screen shot.
7 - To refresh the sheets prices anytime use the menu option refresh. Note: This actively calls the function which will require permissions - google will ask if you want to run it, follow the prompts to approve it. It will only do this the first time you run the script in a new sheet.
The end!
Hope you like the tool, if you have any questions or run into issues I'll try to support you in the comment section. I wish you the best in your journey to wealth!
Tips always appreciated:
BTC: 1LdHmPUAEggc5Rk6UmczSkfT8tYL68txb6
BTC: 1LdHmPUAEggc5Rk6UmczSkfT8tYL68txb6
Sources & References
Kick ass Coinmarketcap api script sampled from: rathergood Github
Refresh function to update google sheet sampled from: Stack Overflow
Cool, but why did you not address one of the most important questions: how often and when to rebalance? Once a year? Once a month? Once a week?
Well for one, this is a post sharing how to make a google sheet work as a rebalancing tool not an educational piece on the topic of rebalancing. I did however mention in the first paragraph that a more aggressive rebalance strategy may be necessary in comparison to a quarterly schedule. The reason is quite simple, there is no one size fits all time period nor is there a set deviation from you target allocation that triggers a rebalance.
Regardless let me cover this question because it does come up. First of all when is a function of how often the vast majority of the time.
So how often? Thats up to you. But if you're totally unsure start with a 2 week period.
Now when? At the end of the two week period unless your deviation from your target allocation on all assets is less than 5%. If nothing as moved more than 5% wait for the next 2 week period.
Everyone will have a personal decision to make about these two questions because withdraw fees, exchange fees, network fees can impact a small portfolio more so than a large portfolio.
I was also wondering how often to rebalance. This is definitely an helpful answer! Another factor that's important to me is how much time I want to spent on trading. So far I couldn't help myself checking coinmarketcap several times a day, with that constant FOMO feeling. Rebalancing with a set period gives me more peace of mind. So, many thanks for the balance sheet and the guidance! And @coinmasteryct thanks for sharing this on your youtube channel!
This looks great, thanks for sharing!
Thanks @olyup!
Misspelled "Rebalancing" in the title. A quick fix for SEO.
Nice catch, here's a full upvote for that one!
Awesome! I'm excited to check this out. Thank you for sharing with the community. We're all in this together!
Hope you like it! I thought it was valuable for me but then again, I'm bias :p
Tip!
Appreciate the tip! I haven't used it yet but it would be a good way to support authors who's post passed their payout window.
Beep beep. Hi @thorthur22!
You have used tip! in your comment - that`s my magic word for sending tips ;)
Click here if you wish to learn more!
Hi @thorthur22! @rexhafiz is sending you 0.1 SBD tip and @tipU upvote :)
@tipU quick guide | earn interest in @tipU profit
Well done, like and resteemed!
Nice to see the CCC so active in here!
Thanks @hco, CCC is a great crypto centric group to share and extract information from so it seems natural to cross post to each.
Excellent post. Thanks for sharing. I've resteemed it as well.
Awesome, glad you liked it and thanks for sharing!
Awesome tool! its a good way to robot sellings and buys and cut the emotion orders
That's one of the best aspects, which makes it effective for novice traders or investors who would normally get emotionally attached to a coins value or performance.
Thanks for the info dude! Shoutout to coinmastery.com which led me to this.
No problem. So how did Coinmastery lead you here? Not sure what their service is.
Carter Thomas's youtube channel. He talked about your spreadsheet in one of his videos and forwarded a link to it. http://coinmastery.com/rebalance
He did credit you on it of course.
Ohh cool, I'll check out his content!
thanks for sharing this. Have saw it first on CCC, so it's fair I comment it here. Keep up the good work!
No problem @mdflorio, I hope you enjoy the tool :)
Question for ya, how do would you determine the target allocations in a portfolio? Is it just arbitrary?
Yes, its arbitrary. You decide based on your risk appetite.
Nice! I'm going to try it out. Thanks man
Awesome! Let me know how you like it - I may release a version 2 down the road with updates from the community.
Thank you so much, thorthur22.
You're welcome! It would seem there is renewed interest in this tool, can I ask how you made your way here?
I think it was mentioned by Carter Thomas on his uTube video (Coin Mastery).
Looks awesome, I definitely want to put some thought into this and adapt it for my needs. More specifically, I've made a decision on the money I've put into crypto not to take it out - at least not for the short term..waiting til Bitcoin hits the high $6,000's (a la Clif High) before I consider pulling some crypto out to invest in more silver.
Anyway, what I'm trying to say is that whenever I "sell" an altcoin, it's just selling into Bitcoin for a bit of arbitrage profit. I want to use your spreadsheet simply replacing USD with Bitcoin (removing BTC from the Asset Class column and valuing all other cryptos in BTC instead of USD). That should work though! :)
Ya you can do that fairly easily. I will say that mostly defeats the purpose of rebalancing but if you make a strategy that works for you then its all good :) Good luck @jobsande!
Oh really, it defeats the purpose? Hmm...I'll have to put a bit more thought into it. It's just in times like these especially, where Clif High predicts the upper $6K range before hitting a major correction, then shooting back up to $11K at some point... in these times it really doesn't make much sense for me to pull out of crypto. When BTC hits those levels I MIGHT consider it at that point, just to lock in some gains :)
Put 0% for USD/ USDT and put BTC at a higher allocation, this ensures your rebalance will allocate more to BTC. There are two things that make rebalancing valuable: removes emotional trading & ensure you sell whats doing well as it goes up and buy what down. Its absoultely critical though that you have very firm belief that all your assets will perform well over time otherwise you will always second guess whether you want to rebalance.
I would love to hear your results with this method you're doing, if you write about your results feel free to tag me so I can check it out!
Awesome tip, yes I definitely will! I mean I'll definitely let you know, not 100% sure if I'll be going through with it...just want to be careful making any commitments I can't keep. But if I do it, and write about it, for sure I'll let you know!
Thanks very much for this tool! Just learned about it from Coin Mastery.
Right on, I was just watching his video talking about this tool! I hope it works well for you - best of luck!
Love this thank you! I saw this on CoinMastery Youtube page. Question: My portfolio is about 13 coins. I cut/paste the names/quantities of them from another spreadsheet, but the current coin price isn't refreshing. I updated the script and pressed refresh as you stated. Any thoughts...
Paste your forumla you have in the cell G10. Did the prices update prior to copying your coins and quantities in?
It's all good now. Thank you so much!
Sweet! Glad you got it figured out :)
Very insightful tips, thanks.
You're welcome! Hope you enjoy the tool.
Thanks a lot for this article. Upvote from me.
No problem! Although the payout window for the post closed awhile ago, I'll take the upvote as moral support :p
This is Great ! Thank you for sharing!!! 👍🙌
No worries, enjoy!
Great post! Thanks alot. I have one issue thou. The "Current allocation" percentage Is completely of. It sums up to 700% and should 100% right. What could be wrong?
Hmm well that percentage is just a sum and should always add up to 100 as you said. I would ensure the format of collumn F is percentages and then look at the E collumn formula to ensure nothing was accidentally changed. You compare the cell formula to the original sheet in the link above.
If you just cant identify the issue then making a fresh copy never hurts. I do it all the time to troubleshoot :)
Thanks for sharing the Google Sheet.
I've added these functions to get data from Bitstamp and Bitfinex. Call them from the cells as you would ccprice (including the last parameter which references the cell I5 that gets updated with the timestamp upon refresh)
function bitfinexPrice(name, datetime)
{
var url = "https://api.bitfinex.com/v1/pubticker/" + name;
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var data = JSON.parse(json);
var price = data["last_price"];
SpreadsheetApp.flush();
return price;
}
function bitstampPrice(name, datetime)
{
var url = "https://www.bitstamp.net/api/v2/ticker/" + name + "/";
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var data = JSON.parse(json);
var price = data["last"];
SpreadsheetApp.flush();
return price;
}
Hi friend, very good !!!!!
You would help me with a vote in my Blog., Thanks !!! ;)
Would you address the comment posted by one guy under Giovanni post?
Quotation:
"maybe I'm just tired and not reading this correctly, but your calculation doesn't work.
If on day 2 when BTC goes up to 3000, and you rebalance "To rebalance your portfolio you sell the excess BTC and get USDT. This will give you a portfolio with 5 BTC and 13750 in USDT".
According to that you've just made USDT out of nowhere without actually selling any of your 5 BTC. I assume you mean that you sell 0.416 BTC to USDT which would actually leave you with 4.583 BTC and 13750 in USDT (the equivalent vales of both)."
and then:
"If you forgot to take away the BTC you sold each time in your calculations it would explain your crazy exponential graph.
After day 3 when BTC goes down to 2300 and you rebalance you'd actually have 5.281 BTC and $12,145USDT = $24290 value. Now this is still better than holding for sure, but does not put you in front of where you've started."
If you link his post or the comment in question I will take a look otherwise I think I'm missing to much info to provide an answer.
In general with stocks, rebalancing is best if its not done to much. I don't know the best timeline for crypto but I would speculate that its weekly or bi-monthly given the volatility.
Do you have any idea why Golem or LBRY Credits will not work?
You have to use the name as coinmarketcap has it:
library-credit
golem-network-tokens
Seems not all coin names can be found in my version of the rebalancing tool. Any idea why for example Stellar Lumens is not recognized?
Click on the coin on coinmarketcap, look at the URL.
CMC has it as just stellar
Thanks, that works!
Np!
Don't forget to mention rebalancing periods please
This post received a 3.0% upvote from @randowhale thanks to @thorthur22! For more information, click here!
i did everything followed instructions ..still not showing the columns and calcs...what am i doing wrong!?
You can always start from scratch if you think something isn't correct. Now keep in mind the coinmarketcap api has gone down or been unable to update price a few times so give it day and try to refresh again.
Amazingly useful stuff, man! Much respect to you for sharing this!!
Hi
For some reason the table stopped to refresh the current price of the coins.
Is it possible to use this sheet to view the results of this strategy applied to the past month?
thank you; one thing though: to add more coins, you didnt explain how; what im doin is copying the previous line and modifying it, currently figuring out if its working
Thanks for posting, really saves a lot of work! I've noticed prices Coinbase/GDAX differ a lot from those at coinmarketcap at times. As the former is where I trade atm, would it be possible to change the script to read prices from there? The API is there, but I've tried a few times to change the script - without success. :( https://developers.coinbase.com/api/v2
Thanks for posting, really saves a lot of work! I've noticed prices Coinbase/GDAX differ a lot from those at coinmarketcap at times. As the former is where I trade atm, would it be possible to change the script to read prices from there? The API is there, I just don't know how to write the Script. :( https://developers.coinbase.com/api/v2
Thanks, very helpful! :)
No Problem!
Hello, Bitcoin Cash is not recognised? Do you know what to put? I've tried 'Bitcoin Cash' 'BCH' 'BitcoinCash' etc. Thanks in advance.
Just went through some comments above and tried - 'Bitcoin-Cash' ~ Works like a dream. Great tool. Thank you!
Try to rebalance your portfolio via coinwizard.me
Hi thor love your rebalancing spread sheet. Now coinmarketcap is updating their api data to v2. I see in your spread sheet your using v1. How would I or you implement the v2 api data to work with your spread sheet? I tried just changing v1 to v2 in the google Script editor but it looks like it didn't work once I saved it. Would it be possible for you to update your spread sheet? Thanks again.
s.