Skip to content

A Python Binance cryptocurrency trader using a simple profitable strategy

Notifications You must be signed in to change notification settings

andrewboyley/crypto-trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cryptocurrency Trader

forthebadge forthebadge

This is a fairly simple cryptocurrency trading bot that is meant to be left running and will make you a profit over time. It has about a 65% win rate which means that it may make some losing trades but will still be profitable in the long run. This project is still EXTREMELY buggy and so I urge you to use this with care until I can polish it up a bit.

Trading View Strategy

Installation

You need to have a Binance spot trading account to use this project (I tried my best to avoid the image validation thing, try use 2FA).

  1. Generate a Binance API and SECRET key

    WRITE THESE DOWN IN A SAFE PLACE. The secret key will not be visible if you come back to the page a second time

  2. Pull this repository to your local machine (or wherever you want to run the bot)

    git clone https://github.com/andrewboyley/crypto-trader.git
    cd crypto-trader
    
  3. Create a file called .env

    This is where you will store you keys. Make sure that this file is secure so that nobody can see it. Create two variables and insert your keys like this:

    API=YOUR-API-KEY-HERE
    SECRET=YOUR-SECRET-KEY-HERE
    
  4. Install dependencies

    • Write a script and requirements.txt file to do this

    I know, I need to improve this. For now, make sure you do the following.

    1. Install TA-Lib for your OS

      Follow this instructions on the TA-Lib website to install TA-Lib locally

    2. Install Python dependencies

      Install the following with a pip install command (requirements.txt coming soon)

      • numpy
      • matplotlib
      • TA-Lib
      • python-binance
      • python-dotenv
      • pandas
  5. Customize your configuration

    Edit the config.py to your liking. You can modify the list of coins that the bot will monitor and change the time interval for the klines (although I have found that 30 minutes works best)

  6. Start the bot

    • TODO: Make this into a Linux service so that it runs on boot
    python3 main.py
    
  7. Invest into DOGE

    💎 ✋ 🚀 🌑

Strategy

The bot has a relatively simple strategy that I have blatently stolen from a Trading View users Pine Script. I highly recommend that you check it out on Trading View. Every 30 seconds, the bot will fetch the klines from Binance and compute the following:

  • Exponential Moving Averages (8, 13, 21, 34 and 55)
  • Relative Strength Index 14
  • Stochastic

It will enter long if all of the following is true:

  • Each EMA signal being larger than the next (ema8 > ema13, ema13 > ema21 etc)
  • RSI < 65
  • Stochastic < 80

It will exit this trade if any of the following is true:

  • RSI > 70
  • EMA21 < EMA55
  • Stochastic > 95

About

A Python Binance cryptocurrency trader using a simple profitable strategy

Topics

Resources

Stars

Watchers

Forks

Languages