Coder Social home page Coder Social logo

juanparker1 / create-backtest-optimize-sell-cryptocurrency-trading-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chirema/create-backtest-optimize-sell-cryptocurrency-trading-bot

0.0 0.0 0.0 598 KB

Learn how to create, backtest, optimize and sell your cryptocurrency trading bot

Python 98.33% Dockerfile 1.60% Shell 0.08%

create-backtest-optimize-sell-cryptocurrency-trading-bot's Introduction

How to create, backtest, optimize and sell a cryptocurrency trading bot

This is the repository for a series of medium articles "How to create, backtest, optimize and sell a cryptocurrency trading bot":

Getting Started

Make sure that you install all the requirements of the project and download all the training data for the testing and optimization of your trading bot.

Installing the dependencies

pip install -r requirements.txt

Part 1: Create and backtest your trading bot

Read the medium article: "How to create and backtest your trading bot".

Tutorial Data

Use python3 download-kline.py -s BTCUSDT -i 1d -y 2021 2020 2019 to download the tutorial data.

Future use

You can use python download-kline.py with the arguments below, to download any data you want for your trading bot.

Argument Explanation
-h show help messages
-s Single symbol or multiple symbols separated by space
-y Single year or multiple years separated by space
-m Single month or multiple months separated by space
-d single date or multiple dates separated by space
-startDate Starting date to download in [YYYY-MM-DD] format
-endDate Ending date to download in [YYYY-MM-DD] format
-folder Directory to store the downloaded data
-c 1 to download checksum file, default 0
-i single kline interval or multiple intervals separated by space
-t Trading type: spot, um (USD-M Futures), cm (COIN-M Futures)

e.g download ETHUSDT BTCUSDT BNBBUSD kline of 1 week interval from year 2020, month of Feb and Dec with CHECKSUM file:
python3 download-kline.py -s ETHUSDT BTCUSDT BNBBUSD -i 1w -y 2020 -m 02 12 -c 1

e.g. download ETHUSDT kline from 2020-01-01 to 2021-02-02 to directory /Users/bob/Binance:
python3 download-kline.py -s ETHUSDT -startDate 2020-01-01 -endDate 2021-02-02 -folder '/Users/bob/Binance'

Part 2: Optimize your trading bot

Read the medium article: "How to backtest your trading bot".

Part 3: Deploy your trading bot

Read the medium article: coming soon.

For a production read trading bot production we use the investing algorithm framework. The trading bot uses trading data from BINANCE and also has its portfolio configured with BINANCE. If you would like to use a different broker, we recommend you to visit the documentation page of the investing algorithm framework.

For this article, two trading bots are made. One with the backtesting framework and the other with plain python.

Both have the same functionality and behavior, however in this way you can see that you can mix and match different frameworks and libraries with your trading bot.

Configuration

You must provide your (Binance) Broker api key and secret key in order to have a properly functioning trading bot.

In the "main.py" file of the production trading bot folder you must replace the template values of the portfolio definition.

Replace 'API_KEY' and 'SECRET_KEY' with your keys found at Binance

Default configuration

app = App(
    resource_directory=os.path.abspath(
        os.path.join(os.path.realpath(__file__), os.pardir)
    ),
    config={
        "PORTFOLIOS": {
            "PRODUCTION_PORTFOLIO": {
                "API_KEY": "<YOUR_API_KEY>",
                "SECRET_KEY": "<YOUR_SECRET_KEY>",
                "TRADING_SYMBOL": "USDT",
                "MARKET": "BINANCE",
                "SQLITE": False
            }
        }
    }
)

Production configuration


NOTE

The used values are dummy values.


app = App(
    resource_directory=os.path.abspath(
        os.path.join(os.path.realpath(__file__), os.pardir)
    ),
    config={
        "PORTFOLIOS": {
            "PRODUCTION_PORTFOLIO": {
                "API_KEY": "7p6voD97MqAvtSktyyJqiSHg5aRj3aPZ733rUJhU",
                "SECRET_KEY": "7p6voD97MqAvtSktyyJqiSHg5aRj3aPZ733rUJhU",
                "TRADING_SYMBOL": "USDT",
                "MARKET": "BINANCE",
                "SQLITE": False
            }
        }
    }
)

Production ready trading bot with the backtesting framework

The production ready trading bot made with the backtesting framework can be found at the location:

/production/backtesting_framework

Starting the trading bot

You can start the trading bot by running:

python  production/backtesting_framework/main.py

Production ready trading bot with own metrics

The production ready trading bot made with self-made metrics can be found at the location:

/production/base

Part 4: Sharing and monetizing your trading bot on ELTYER

Read the medium article: coming soon.

Authors

Parts of the code are based on https://github.com/binance/binance-public-data (MIT)

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.