An algorithm to determine what the highest performing cryptocurrency assets are

Here’s a question for you – out of the top 10 cryptocurrencies by market cap, which one do you think it’s the highest performing coin since 2017, from a purely economical standpoint?

Well believe it or not, it’s Binance’s own BNB coin. It actually outperformed every other crypto out there by a longshot. I had some free time this morning so I was playing around with a script to help me understand historical performance of several cryptocurrencies, when I decided to just drop the top 10 coins in and see what the most performing ones are, and by how much. 

Before running the script I was positive it was going to be DOGE. So here I am sitting, waiting for the historical data to download so my script can plot some crypto charts. All the while crossing my fingers and hoping that a memcoin is not the most performing asset in the past 4 years.

The script finished running and the result it out, thank Satoshi it’s not DOGE. Oh but wait, this is even more interesting – it’s BNB.

Since 2017 BNB has gone up more than 20,000%.


The crypto algorithm I wrote is able to download historical data for you, and analyse any number of coins. It’s handy if you want to get a quick comparative analysis of the % gain of any number of cryptocurrencies, and luckily, it’s not terribly hard to get it working. All you need is a bit of python knowledge to follow along.

Coding the crypto analysis tool

The code is also available on GitHub.

Start by creating a text file and call it coins.txt. Inside this text file, drop some coin names that you would like to analyze. They need to include a pairing symbol and must be 1 coin per row, no comma:

Create a file. We’ll be using this file to poll the Binance API for the financial data that we require. Since we’re using the open endpoints, API keys and secret are not required.

Let’s import a few dependencies and define an empty Binance client:

Now let’s write a function to open and read the coins from our coins.txt file:

The last function in this file will fetch the historical data for us and save in a CSV format:

This function will also check if the file aready exists, so it won’t download it again if that’s the case it’ll just load it instead. The function takes 3 arguments: coin, since and kline_interval. Check the comment underneath the function for the correct format that we’re going to pass to these args.

Save the file, and now it’s time to create our main execution file, where we will be importing the contents of this file into.

Go ahead and create a file and install the following dependencies:

I won’t go into too much detail on the libraries used here, but you might want to familiarise yourself with threading, matplotlib and pandas. 

Let’s start some threads. The script is made to download multiple datafiles at once, so in order to avoid waiting to download each historical datafile at once, we will use threading to download these files concurrently, like so:

Now we need a function that returns the filenames of all the datafiles we downloaded:

Lastly, we’re going to define our main function where we’re plotting this data and running the script:

All that’s left to do now is to create an empty folder in your script directory and call it data. You’re done, you can now analyse historical crypto gains for all the coins that you want.

Did you enjoy this article? Please consider subscribing to the newsletter for more awesome content.

If you appreciate my content and would like to see more, you can support me by donating here or via the Brave Browser. This is much appreciated as it helps me to keep the content free and open source. Thank you!

3 thoughts on “An algorithm to determine what the highest performing cryptocurrency assets are

  1. I am getting these errors:

    Traceback (most recent call last):
    File “C:\Users\PycharmProjects\crypto-performance-tracker\”, line 1, in
    from binancedata import *
    File “C:\Users\PycharmProjects\crypto-performance-tracker\”, line 2, in
    from binance.client import Client
    ImportError: cannot import name ‘Client’ from ‘binance.client’ (C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\binance\

      1. Hi Andrei,

        Thank you. You were right. For some reason I totally forgot to install python-binance package.

        I added all available USDT Pairs to check the results. One issue I am facing is with the graphs. The colours are being repeated and all pairs with the same colour are being consolidated.

Leave a Reply

Your email address will not be published. Required fields are marked *