Skip to content

Open source crypto trading platform to automate trading strategies.

Notifications You must be signed in to change notification settings

diogomatoschaves/MyCryptoBot

Repository files navigation

MyCryptoBot

build_badge build_badge build_badge codecov

Welcome to the MyCryptoBot repository, a free, open source, and extensible trading platform that utilizes a microservices architecture. The platform empowers you to run your own trading bots and strategies locally or in the cloud. At present, the app is integrated with Binance, supporting both the testnet and live Futures accounts.

For those looking to validate trading strategies against historical data, stratestic offers a comprehensive backtesting framework and integrates seamleassly with this trading platform.

Please check the disclaimer before using this repository.

Installation & Usage

The detailed steps for installing and using this application locally and remotely on Heroku are provided in the INSTALLATION.md file. However, we recommend that you understand the app's structure before diving into the installation steps.

Introduction

The primary goal of this repository is to provide a platform that enables you to deploy your strategies, run them locally or on a remote server, and manage all your trading activities with a user-friendly web UI. The app comprises three micro-services that are interconnected via a database and served by a frontend web app. There is a ready-made functionality to deploy the services to Heroku, which will require an account and associated monthly costs.

The app's architecture consists of the following:

MyCryptoBot Architecture

Data Service

This service acts as the data warehouse of the app. It acquires data from external sources, such as exchanges, preprocesses it, and stores it in a database. When a new trading bot is initiated through the user interface, a new data pipeline is initiated, fetching live data from the various sources. Whenever a new candle is completed, a request is sent to the Model app for processing the new data according to the strategy.

This service can also be used to retrieve historical data for any symbol.

from data.sources.binance import get_historical_data
data = get_historical_data("BTCUSDT", "1h", "2021-01-01", "2021-01-31", save_file=True)

Model Service

The Model service is responsible for processing the data and generating a signal (Buy or Sell) according to the selected strategy. Whenever a request is received to generate a new signal, the data is loaded, processed, and a signal is produced, which is then sent to the Order Execution service with an order to be executed.

This is also the module where you can add a new strategy. Check ADD_NEW_STRATEGY.md for more details on how to do this.

Order Execution Service

The Order Execution service acts as a layer to handle the communication between the app and the exchange. It receives buy and sell orders from the Model service with a signal, assesses whether an action is required (if the received signal differs from the current one), and responds accordingly.

Web App

The user interface enables the user to start and stop trading bots, view open positions, executed trades, statistics, and more. The following are brief descriptions of the various views of the app.

Dashboard

This serves as the main view of the application, presenting a comprehensive overview of the equity evolution, trading bot data, open positions, and associated trades over time. Summary statistics are displayed to provide key insights. Users can easily navigate to different sections of the app by clicking on the corresponding section or utilizing the left-hand side menu.

Trading Bots

This page provides an overview of all existing trading bots along with their current status. Users have the ability to edit, start, and stop these bots directly from this view. Clicking on a specific trading bot leads to a detailed page, showcasing the equity evolution, statistics, and a comprehensive list of all trades associated with that bot.

Additionally, users can create a new trading bot by selecting the New Trading Bot button. Simply fill in all the required details, and the new bot will be created and initiated automatically.

Positions

This page displays the currently open positions linked to the trading bots.

Trades

This page shows all the trades executed by any of the trading bots. It is possible to filter by live or testnet trades.

Software Requirements

  • Poetry (For creating an environment for local development.)
  • Docker (For running the app locally.)
  • Heroku CLI (For deploying the app to a Heroku.)
  • AWS S3 (For storing machine learning models in the cloud.)