You Need Personalized Crypto Universes for Optimal Profits

Andreas
Coinmonks
4 min readOct 2, 2023

--

Leveraging CoinMarketCap’s Tags to Harness Full Crypto Potential.

With over ten thousand cryptocurrencies listed on CoinMarketCap, the task of categorizing each one into a specific and accurate universe is daunting, if not nearly impossible. It’s an oversimplification to pigeonhole a cryptocurrency into just one universe given the multifaceted nature of digital assets and the rapid pace of development in the blockchain industry. Yet, the importance of establishing clear and accurate universes cannot be overstated; they are often the key ingredient in making profitable trading models and optimal portfolio allocations.

Meticulously defined universes can tremendously change the way we see the market, how we trade, and how we tweak models.

DALL-E generated

Now, everyone has heard of key sectors and categories in crypto, and everyone has bet on a trending universe. But not so many can properly define the DeFi universe or be ultra specific about an Enterprise-solutions sub-universe. And that’s okay.

However, to truly stand out and gain a competitive edge with our trading models, it’s crucial to start crafting custom universes. Indeed, relying on conventional universes and categorizations might leave potential opportunities unexplored. But they can still help us as a starting point. By fetching CoinMarketCap’s tags and integrating in-depth industry knowledge, traders can easily (and rapidly) define their own unique universes.

Traders should define unique universes, tailor-made to their investment thesis and market outlook.

This custom-made approach not only offers a more refined lens to understand the industry but can lead to significant advantage. Note that defining a personalized universes demands research and knowledge, and discretionary decision making will be needed. However, in these times of “systematic” trading models and AI-driven strategies, it could be interesting to tweak our models based on our understanding of the crypto industry.

Let’s set the stage for innovative personalized crypto universes and potentially more profitable trading strategies.

Although we’ll use real market data, please keep in mind that this article is a tutorial, not financial advice, and aims to enhance our finance knowledge and Python skills.

Part 1. Fetching All Tags for the Top 100 Coins from CoinMarketCap

You will need to have a FREE CoinMarketCap account. Go to this link and select the free API plan. You will then have your own personal API dashboard where you will be able to fetch your personalized CoinMarketCap API key. Just save it and replace ‘YOUR API KEY’ in the following code if you are following along.

To kick things off, we’ll tap into the CoinMarketCap API to retrieve all available tags.

The DataFrame will showcase the top 100 coins, their respective tags, and a placeholder for a future ‘universe’ variable.

import requests
import pandas as pd

# YOUR API KEY FROM COINMARKETCAP
api_key = 'YOUR API KEY'

# URL for the CoinMarketCap endpoint. We fetch the top 100 coins
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'

# Our request
headers = {'X-CMC_PRO_API_KEY': api_key}
parameters = {'start': '1', 'limit': '100', 'convert': 'USD'}

# Sending the request
response = requests.get(url, headers = headers, params = parameters)

# '200' if the request is successful
if response.status_code == 200:
data = response.json()['data']

rows = []

# Iterate through the top 100 coins
for rank, crypto in enumerate(data, 1):
name = crypto['name']
symbol = crypto['symbol']
tags = crypto['tags'] if 'tags' in crypto else []
quote = crypto['quote']['USD']
market_cap = "${:,.0f}".format(quote['market_cap'])
price = "${:,.1f}".format(quote['price'])

# Collecting each row as a dictionary
rows.append({
'Rank': rank,
'Name': name,
'Symbol': symbol,
'Market Cap': market_cap,
'Price': price,
'Tags': ", ".join(tags),
'Universe': 'Placeholder' # We add the 'Universe' column. This is where you will custom your universe
})

df = pd.DataFrame(rows)

else:
print(f"Error fetching data: {response.status_code}")
Our DataFrame ‘df’ with tags

We can see that each coin has several tags, like ‘mineable’, ‘pow’, ‘smart-contracts’, ‘payments’, ‘solana-ecosystem’, or ‘winklevoss-capital-portfolio’.

CoinMarketCap’s tags provide valuable information that will help us discretionarily define universes for digital assets.

For instance, Ethereum has the tag ‘layer-1’ similar to BNB. But should we categorize both Ethereum and BNB into the ‘layer-1’ universe? This is where discretionary decisions come into play, and depending on different investment theses, the answer (and thus the universes) might differ.

Subscribe to get FinancePy discretionary universes.

Part 2. Analyzing the Occurrences of Each Tag

Let’s dive deeper into CoinMarketCap’s tags and analyze the occurrences of each tag.

from collections import Counter

# First we extract the tags from 'df' and split it by ', '
all_tags = df['Tags'].str.split(', ').tolist()

# Flatten the list of lists
flattened_tags = []
for sublist in all_tags:
for tag in sublist:
flattened_tags.append(tag)

# Then we count the occurrences of each tag
tag_counts = Counter(flattened_tags)

# We create a DataFrame for better visualization
tag_counts_df = pd.DataFrame(tag_counts.items(), columns = ['Tag', 'Count']).sort_values(by = 'Count', ascending = False)

tag_counts_df.head(50)
Occurrences of each tag

What Now?

It’s interesting to see that many tags represent several well-known portfolios. The ‘defi’ tag appears the most with a count of 26.

We could simply get the top coins by marketcap from each of the top 10 portfolios and create a new ‘top-portfolio’ universe. Or we could define new ‘defi’ sub-universes and base our strategy on a specific ‘defi’ sub-universe.

The possibilities are endless. Explore them and discover untapped potential.

Thanks for reading and stay tuned for more articles! If you enjoyed reading this article, please follow FinancePy for more full Python scripts.

You can also follow FinancePy on Substack

--

--

Andreas
Coinmonks

Data Scientist at a digital asset hedge fund. Formerly in M&A. Data science for in-depth research on asset allocations and strategies.