Due to popular demand, I have decided to start a new series of articles dedicated to helping you build your own crypto trading bot from scratch. Along with building your very own crypto trading algorithms, this series of articles will also serve as crash-course in Python, if you’re looking for a project-based approach to your learning.
In order to make this accessible to more people, today we’re going to start with the very basics: how to set up you local environment, namely: how to install Python, pip and an IDE.
If you’re more of a visual person, you can always start with the video:
How to install Python
In order to install python, simply navigate over to python.org and download the latest version for your Operating System. Proceed with the installation wizard and follow the on-screen prompts. You can leave everything as default, but tick the box which reads “add Python to PATH”.
What is PATH?
PATH is essentially an environment variable on unix-like operating systems which contains a set of directories (or paths) where executable programs are located. Working with Python and Pip, it’s recommended that both are added to PATH, in order to make CMD comands shorter and easier to execute.
For example, if you had multiple Python versions installed, the one that’s on PATH would compile the CMD command:
If your Python 3.10.1 is not on PATH, you would have to explicitly define the version of Python to run that command:
In order to avoid getting confused in Python’s strange versioning system, it’s best to always add the latest version of Python to PATH.
How to install Pip?
Before we run through the steps needed to install Pip, let’s first understand what pip is and why you’re going to need it.
What is pip for Python?
Pip is the default package manager for Python. Just like most backend languages, Python comes with a default library that gives you out-of-the box solutions for different programming requirements. For example, requests is a built-in Python library that enables you to make HTTP requests using Python. But in many cases, you will need additional tools, or packages, or modules in order to be able to build what you want.
This is where pip comes into play. Pip allows you to install and manage additional packages that are not part of the standard library that comes with installing Python.
Installing pip for Python
If you have Python 3.10+ installed on your machine, this comes with a package called ensurepip. This package allows you to install Pip in a package environment by running the following command from command prompt (or terminal).
You should now have pip installed and working on your machine.
What is an IDE and how to install it?
An IDE or Integrated Development Environment is a software made for building applications, scripts or simply put, writing code. An IDE usually comes with a set of tools that will facilitate your coding, and will include common features for popular coding languages in its user interface. Here’s a preview of the Atom IDE:
The reason I’m recommending you Atom, is that it’s easy to use, and it’s beginner friendly. It won’t write your crypto trading bot for you, but it will make it easier on you, especially if it’s your first time building one.
Another benefit to using Atom is that it’s open source, and “hackable”. What I mean by that is that it grows with you. You can install multiple add-ons and configure Atom to your needs.
How to Install Atom?
Installing Atom is easy, simply navigate over to atom.io, download and run the installer. Once complete, you will need to install one additional extension so that you can run and test the code that you will be writing. By default, atom cannot run Python code. It can open and edit Python files, but it cannot execute them.
Execute Python files with Atom
Simply installing the script package should enable you to execute and debug your Python code by using the run command (by default Ctrl+Shift+B)
Create your first Python file
Go ahead and create a file (can be any file type) and edit its file extension to say .py. Now open this file with Atom and write your first line of code:
Now press Ctrl+Shift+b.
Congrats, you have successfully executed your first line of code from a python file that you created. Subscribe below to follow the learning series and build your first crypto trading bot in Python.