Executing Trades on Coinbasepro using Predictions from a Crypto Trading Algorithm
In my previous article “Designing My First Trading Algorithm For Crypto Bot”, I shared my journey of designing an algorithm for a crypto trading bot. In this article, I will be showing you how to use the predictions made by the algorithm to execute trades on Coinbasepro.
Before we begin, it is important to note that this code is a work in progress and should not be used with real money as it may potentially result in significant losses. It is also important to get a Coinbasepro API key, but not to put any money in the test account, and to watch the relevant videos and insert your own trading algorithms before running the code.
To start, we will need to import the necessary libraries and modules such as cbpro, and import the password file that contains your Coinbasepro API keys.
import cbpro
import passwords
# the passwords are saved in variables in python file passwords.py in same directory
Next, we will need to authenticate with the Coinbasepro API using your API keys.
# Authenticate with the Coinbasepro API
client = cbpro.AuthenticatedClient(passwords.api_key, passwords.api_secret, passwords.api_passphrase)