Git Product home page Git Product logo

binancecryptotrader's Introduction

Crypto Trading Bot

This project is a simple crypto trading bot that utilizes the Binance API to get information about markets and execute trades. The bot uses a mean reversion strategy to identify potential buying opportunities and sets a stop loss threshold to minimize losses.

Getting Started

To use the bot, you will need to have a Binance account and generate an API key and secret. You will also need to install the python-binance library using pip install python-binance.

Clone the repository to your local machine.

Create a virtual environment and activate it. Install the required dependencies using pip install -r requirements.txt. Open config.py and add your Binance API key and secret. Customize the parameters in main.py such as symbol, quantity, interval, mean_reversion_threshold, and stop_loss_threshold. Run python main.py to start the bot.

Parameters

symbol: The trading pair to use, e.g. "BTCUSDT". quantity: The quantity to trade, e.g. 0.01 BTC. interval: The interval for retrieving historical price data, e.g. "1h". mean_reversion_threshold: The threshold for mean reversion strategy, e.g. 0.05. stop_loss_threshold: The stop loss threshold for closing position, e.g. -0.1.

Strategy

The mean reversion strategy is a simple trading strategy that involves buying an asset when its price is below its historical mean by a certain threshold, and selling the asset when its price is above its historical mean by a certain threshold. The idea is that the price will eventually revert back to its mean, providing a profitable trading opportunity.

In this bot, we use the 1-hour candlestick chart to calculate the historical mean and standard deviation of the trading pair. We then check the current price of the trading pair and determine whether it is below or above the mean by the mean_reversion_threshold. If the price is below the mean, we place a buy order. If the price is above the mean, we do nothing.

To minimize losses, we set a stop loss threshold of stop_loss_threshold. If the price drops below this threshold, we sell the asset to limit our losses.

Disclaimer

This project is for educational purposes only and does not constitute financial advice. Trading cryptocurrencies involves risks, and you should do your own research before making any investment decisions. The author of this project is not responsible for any losses incurred from using this bot.

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.