1. Start a new python cryptocurrency project in PyCharm.
  2. Install related module needs for this new project.
  3. Write a simple program to find out whether the new module is working or not.

Hello and welcome to another episode of the “Python Programming Journey” article series. Starting from today I have restructured the Python category of this website into these few sections.

  1. Project: Create around 3 projects within this year. I have already started the web analytic project a few days ago and today I have included this new cryptocurrency project. I will restart one of the previous projects which are now on Github anytime soon. All these projects will be uploaded to Github once they have shown some progress and I welcome those of you who know python to contribute to these open projects on Github as well.
  2. Example: We will continue to solve some simple problems with Python once a while on this website.
  3. Tool: Python developer needs a tool, thus once in a while, I will introduce to you all some new tools or IDE used to write the python program.

With that said I am now ready and have a ton of python related materials to write about throughout this year.

As I have mentioned before at the beginning of this article we will start a new Cryptocurrency project with Python, so let get started!

Start a new python cryptocurrency project in PyCharm :

Start the PyCharm IDE, if you do not have one then you can download it for free on its website. After you have opened up PyCharm IDE, Goto File->New Projects. Fill in the necessary details to create this new cryptocurrency project.

Install the cryptocurrency module needs in this project then write a simple python program to see the outcome :

Right-click on the project folder, then select New->Directory, give the new directory a name then click on the ‘OK’ button to create the new project directory where we will keep all the python files in it. Right-click on the newly created directory and select Mark Directory as -> Source Root. Next, we will need to install three python packages (Pandas for extracting data, Requests which is required by the Cryptocompy package and Cryptocompy for retrieving the related cryptocurrency market data) before writing that simple python program. Goto File->Settings to open up the Settings panel, then on the left side of the Settings panel select Project Interpreter. On the right side of the Settings’ panel, click on the plus sign to open up the installation panel, then type in the name of those packages to search for them and then install them to your project. You might need to close the installation panel and click on the plus sign again to start the installation panel again to install another package after you have installed one of the packages.

Finally, right-click on the new directory you have created just now and then select New->Python File, give the new python file a name and then click on the ‘OK’ button to create that new python file. Next, enter these lines of code into that new python file you have just created.

import pandas as pd
from cryptocompy import price

coin_data = price.get_current_price("BTC", ["EUR", "USD"])
print(pd.DataFrame.from_records(coin_data)) # read the returned dictionary object with Pandas then print those data
The average price of BTC vs EUR and BTC vs USD

I just take a look at Google search for these two prices and find out there is a little bit different as compared to those from the REST call, therefore I think those prices might be the average price either from Google or from the CryptoCompare data. Cryptocompy is actually using the CryptoCompare API call to gather those data. If we use the cryptocompy package to make the API call then we do not need to sign up for a free API key from CryptoCompare to make a call to get the required data, therefore I think maybe the data is a little bit outdated which means perhaps the author of this package has downloaded the weekly data and stored on his or her online storage site and thus that API call is actually calling the author website instead of direct call to the CryptoCompare data storage site. If we make a direct call to the CryptoCompare site then there will be a 100,000 calls per month limit under the free API plan package. Anyhow, I will use this python package for a while just for this project.

Hey people, this article takes me a lot of time to create, if you like this article then don’t forget to share it with your friends. Don’t forget to subscribe to the Python-related rss feed through this link with your favorite rss reader to get notified and read the latest article related to Python programming!

Please follow and like us:
error0

2 Comments

Leave a Reply

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