Skip to content
Home ยป Automated Crypto Trading Bot on Google Cloud

Automated Crypto Trading Bot on Google Cloud



For: Me

Project Goal

This project automates cryptocurrency trading using a serverless architecture on Google Cloud Platform (GCP). The aim is to identify and execute buy and sell orders based on predefined conditions, removing the need for constant manual monitoring. It focuses on purchasing crypto assets during significant price dips after a period of relative stability and selling them when a small profit is available.

How it was built

This system comprises several Python-based Google Cloud Functions, each performing a distinct task:

Blacklist Generation: A function calculates a blacklist of low-volume crypto assets by analyzing their trading activity over 15 minutes, excluding them from potential purchases. It uses the Bitvavo API to fetch market data and identifies symbols with insufficient trading volume.

Price Monitoring: Another function tracks the price history of various crypto assets. It fetches current prices using the Bitvavo API and stores the most recent 30 values. It then calculates price differences over time. If it finds a dip of more than 3% and no recent price peaks, it adds the asset to a buy list.

Buy Execution: A function acts upon the buy list and executes market buy orders using the Bitvavo API. It also sets a sell trigger price of 2.5% profit and stores this in a file for future reference.

Sell Trigger Check: A function checks the current price of owned assets against stored sell trigger prices. If a target price is reached, it sends a message to Pub/Sub to execute a sell order.

Sell Execution: A function then executes the sell order using the Bitvavo API and removes the symbol from the stored list.

All functions are triggered by Pub/Sub messages and data is stored and retrieved from Google Cloud Storage. This ensures a decoupled, scalable, and robust system.

Technologies used

  • Python: Core programming language.
  • Google Cloud Functions: Serverless compute platform.
  • Google Cloud Storage: Scalable object storage.
  • Google Cloud Pub/Sub: Asynchronous messaging service.
  • Bitvavo API: Cryptocurrency exchange data and trading.
  • datetime and time: Libraries for time transformations and calculations.
  • base64: Decoding Pub/Sub messages.
  • re: Regular expressions for symbol extraction.

Leave a Reply

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