How I tripled the return on bitcoin with math, algorithms, and Python | Sajid Lessani | May 2021 –

Now that we’ve covered a bit of the backstory, let’s start testing and see how they can help predict the market.

If you want to write code at the same pace, you first need to install some configurations and packages.

Also, if you are too impatient and want to know how to quickly implement this strategy, you can directly check the entry at the end of this article. I am using this strategy live, and you can see the result for yourself :).

I signed up explaining the theory, the code and giving additional advice on how to develop it. You can apply it yourself at home.

First of all, if you want to follow my progress and before launching, you need to install on your computer Python 3 version and the following packages:

  • Pandas
  • Numpy
  • Yfinance
  • Plot (Not required, but useful for tracking)
  • If one of these packages is not already installed, you can use pip command as shown below.

pip install yfinance
pip install plotly

After making sure the following packages are installed, we can start by talking about our data pipeline and our data model.

Data pipeline and modeling:

Now that we have confirmed that the above packages are installed on our computer, we can set up data processing.

The data model will be split into 3 distinct phases.

First of all of them we will query cryptocurrency data in real time using Yahoo Finance API

Second, set a period, create new columns for our calculated fields and update these values ​​every second.

The third, draw this live chart and check if our signals are correct.

I won’t go into the details of the code and API in this article; you can find more information on how to revive the market by reading the article below:

Now that we have a clear blueprint for our model, we can start coding!

If you already have some experience with Python, you can skip to step two. The first step is to import the packages.

The first step is to import the required packages.

You will start by importing previously installed packages using the following lines of code:

The lines above ask for numpy, pandas, yfinance and plot imports.

Once we are settled, move on to the next step.

Now that the libraries have been imported, we can import data from our cryptocurrency.

Now that all the required packages have been downloaded. We will use a pair BTC-USD as an example to customize our imports via the Yahoo Finance API.

The list of cryptocurrency options can be expanded, just like the currency.

For example, if you are from India or Canada, you can use INR or GUZHAT; both will work fine whether you need Ripple or Ethereum data.

For a complete explanation of how to get the correct ticker, I suggest you take a look at the code explanation video at the end of the article.

Let’s go back to our API structure.

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker