How I Use Data Science to Build my Crypto Portfolio

By October 12, 2021DeFi
Click here to view original web page at medium.com

First things first I gotta say that this is NOT financial advice in any way. This is just a strategy that has been working for me and has some interesting technical components that I think are worth sharing. Just make sure that if you do decide to invest in cryptocurrency you do your own research. Now, here’s how this strategy works.

The Concept

We all know that a coin’s value fluctuates based on the value of the US Dollar all throughout the day. You might also know that there are several cryptocurrencies whose values also fluctuate based on their own unique values. For example, while the BTC/USD pair might increase 5% in a day, the BTC/ETH pair could increase 10% on the same day. That’s the whole concept of this strategy, trading cryptocurrencies for other cryptocurrencies. That way my assets all stay in the same place but can grow on their own.

My favorite site to do this is Pancakeswap where they have their own native $CAKE token and the ability to swap to basically any other token.

Subscribe to Coinmonks Youtube Channel to get daily crypto news.

Getting The Data

Another great thing about Pancakeswap is the API, which gives you access to all the current trading pairs. They’re always adding and taking away coins so it’s good to have this API to keep up with these updates. You can learn more about it here. Here’s how I use it to make a list of all the current assets available:

The other API we need is from CryptoCompare, this one will help us get historical prices for each token so that we can visualize the trendline with the tokens from Pancakeswap. Here’s an example of how to use this API:

The best part is both of these APIs are FREE! There is a premium version of the CryptoCompare API but for this project, the free tier is all I need!

Analysis

I want to make a graph that compares the average value (daily high + daily low divided by 2) of two tokens throughout a defined range either in days or hours. I can graph the token’s relative % change on one x-axis and their price ratio on a separate x-axis. This way I can see how both tokens are moving comparatively and based on their USD trading prices. Ideally, You’d find two tokens that have a consistent comparative value, which I found was much easier to find than a consistent comparison to a coin’s USD value. Take this graph for example:

Image by Author

On the left x-axis, you’ve got % change, which represents how each token’s price is changing relative to the US Dollar. The right x-axis represents the trading pair's relative value. In this example, I’m comparing $LINK and $CAKE and the value fluctuates between 1.2 $CAKE per $LINK and 1.4 $CAKE per $LINK. Knowing this, if I see that the pair is currently trading at the lower end of this range, I should swap $CAKE for $LINK and once it’s trading at the higher end, I swap $LINK for $CAKE.

This change doesn’t seem significant, but if you’re able to find recognizable patterns like this it can make the process easier and, more importantly, repeatable. If you exchange 100 CAKE for LINK at the 1.2 and then swap back at 1.4 you’ll get a profit of roughly 16 CAKE! See how much less movement there is in the red line? You’ll rarely see stability like that when looking at a token’s USD value. That’s why I like this strategy!

Here’s all the code I used to create this graph, note that with this code I’m only comparing tokens against $CAKE because I like staying in Pancakeswap:

Using the list we created earlier from the Pancakeswap API, we can run this function with each token. You can also add a condition to only show graphs where the ratio of $CAKE to the other token(z) is decreasing which could be very handy!

This strategy has helped me identify patterns between multiple cryptocurrencies, even some that I never thought about investing in. With this method, I’ve been able to build a diversified portfolio and make semi-predictable trades to build its value! Of course, before I ever trade for a new token I do plenty of research on the project, the team behind it, and read as much as I can about its utility and use-cases. You should always do the same!

I hope that this story has inspired you to create your own data-driven investing strategy! If you enjoyed reading please consider following me at https://bench-5.medium.com/

Thank you for reading! :)

Also, Read

All Today's Crypto News In One Place