当前位置: 首页 > 软件库 > Web3 > 开源货币/比特币 >

Crypto-Trading-Bot

授权协议 MIT License
开发语言 Python
所属分类 Web3、 开源货币/比特币
软件类型 开源软件
地区 不详
投 递 者 司马羽
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Crypto Trading Bot

Deprecation Notice

Firstly, I'd like to thank everyone who's shown an interest in this repo. I'd also like to apologize for my lack of support overthe last few years - I received no money from this repo and only did it as a hobby in my free time, something I haven't had a lotof in recent years.

I've decided to officially stop supporting this repo, but I'll still gladly look at PR's if anyone would like to make updates orenhancements. There is some good news however, I've been working with a few very talented and dedicated people to transform thisrepo into an easy to use web and mobile application. If you'd like easy access to all the functionality of this repo and MUCH more,head over to QuidPro and check us out. If you use referral code isq6vK09 when signing up, you'll get alot of free benefits, and you'll be supporting me directly. Happy trading everyone!

Introduction

Use Crypto Trading Bot to autonomously trade and monitor over 250 crypto currencies on Bittrex. Users can configure their owncustom trading parameters which will control when the bot buys and sells. If you'd like to use only the trading indicators andnot the automated trading functionality, you can check out thetracker branch.

Features:

  • Tracking for over 250 coins on Bittrex
  • Automated trading based on user configurations
  • Automated technical analysis (TA)
  • Trade analysis and tracking
  • Email alerts for trades and signals
  • Slack notifications for trades and signals
  • Informative console outputs for user monitoring
  • Logging to track and document errors on the Bittrex API
  • Well documented script

Users can add their own algorithms and trading strategies based on technical analysis signals such as RSI, 24 Hour Volume,and Unit Price.

Shoutouts:

  • Bittrex for an awesome API
  • Eric Somdahl for writing the Python wrapper for the Bittrex API
  • Abenezer Mamo for creating the Crypto Signals project which formed thefoundation for this project
  • QuidPro for their awesome automated crypto trading tool

How to setup

  1. This project requires Python 3.X.X, which can be be found here.

  2. To install the dependencies for this project, run one of the following commands:

    • Windows: pip3 install -r requirements.txt

      NOTE: If you receive a 'pip3' is not recognized as an internal or external command error, youneed to add pip3 to your environmental path variable.

    • Unix: sudo pip3 install -r requirements.txt

  3. Add a directory named database to the root directory of your project and add a secrets.json file to it. If yourun the project without adding this file, the program will create it for you and populate it with the template values.The contents of the file should mirror the following:

    {
        "bittrex": {
            "bittrexKey": "BITTREX_API_KEY",
            "bittrexSecret": "BITTREX_SECRET"
        },
        "gmail": {
            "recipientName": "Folks",
            "addressList": [
                "EXAMPLE_RECIPIENT_1@GMAIL.COM",
                "EXAMPLE_RECIPIENT_2@GMAIL.COM",
                "ETC..."
            ],
            "username": "EXAMPLE_EMAIL@GMAIL.COM",
            "password": "GMAIL_PASSWORD"
        },
        "slack": {
            "channel": "SLACK_CHANNEL",
            "token": "SLACK_TOKEN"
        }
    }
    1. To use the Bittrex functionality, you need to setup the following:

      • bittrex_key is your Bittrex API key you can get from here
      • bittrex_secret is your Bittrex API secret key

      NOTE: The READ INFO, TRADE LIMIT, and TRADE MARKET permissions need to be enabled on your API key inorder for the trade functionality to be available

    2. To use the Gmail functionality, you need to setup the following:

      • username is your Gmail account's username (usually your account's email address)
      • password is your Gmail account's password
      • address_list is the list of recipients you'd like to send emails to

      If you don't want to use the email notifications, you can leave out the gmail code.

    3. To use the Slack functionality, you need to setup the following:

      • channel is your Slack groups's channel (usually starts with a '#' character)
      • token is your Slack account's authentication token (you need to create a Slack app on the Slack API websitefor your group - from which you can generate this authentication token)

      If you don't want to use the Slack notifications, you can leave out the slack code.

  4. Add a settings.json file to the newly created database directory. If you run the project without adding this file,the program will create it for you and populate it with the template values. The contents of the file should mirror thefollowing:

    {
        "sound": false,
        "tradeParameters": {
            "tickerInterval": "TICKER_INTERVAL",
            "buy": {
                "btcAmount": 0,
                "rsiThreshold": 0,
                "24HourVolumeThreshold": 0,
                "minimumUnitPrice": 0,
                "maxOpenTrades": 0
            },
            "sell": {
                "lossMarginThreshold": 0,
                "rsiThreshold": 0,
                "minProfitMarginThreshold": 0,
                "profitMarginThreshold": 0
            }
        },
        "pauseParameters": {
            "buy": {
                "rsiThreshold": 0,
                "pauseTime": 0
            },
            "sell": {
                "profitMarginThreshold": 0,
                "pauseTime": 0
            },
            "balance": {
                "pauseTime": 0
           }
        }
    }
    1. To use the Sound functionality, you need to setup the following:

      • sound is a boolean that determines whether audio notifications should be played

      If you don't want to receive audio notifications, you can leave out the sound code or set it to false.

    2. To use the Trade functionality, you need to setup the following:

      • tickerInterval is the exchange ticker interval you want to use. It should be one of the following: oneMin,fiveMin, thirtyMin, hour, week, day, month
      • buy:
        • btcAmount is the amount of BTC you want the bot to spend per buy
        • rsiThreshold is the upper RSI buy threshold. An RSI lower than this will result in a buy signal
        • 24HourVolumeThreshold is the lower 24 hour volume buy threshold. Coin pairs with a 24 hour volume lower thanthis will not be considered for buying
        • minimumUnitPrice is the lower unit price buy threshold. Coin pairs with a unit price lower than this will notbe considered for buying
        • maxOpenTrades is the maximum amount of open trades the bot is allowed to have at one time
      • sell:
        • lossMarginThreshold is the lower loss margin threshold. Coin pairs with a profit margin lower than thiswill be sold if their RSI is above the sell rsiThreshold. If this value is omitted or set to zero (0),this parameter will be ignored and coin pairs will not be sold at a loss
        • rsiThreshold is the lower RSI sell threshold. An RSI higher than this will result in a sell signal
        • minProfitMarginThreshold is the upper minimum profit margin sell threshold. Coin pairs with a profit marginlower than this will not be sold
        • profitMarginThreshold is the upper profit margin sell threshold. Coin pairs with a profit margin higher thanthis will be sold regardless of its RSI
    3. To use the Pause functionality, you need to setup the following:

      • buy:
        • rsiThreshold is the lower RSI pause threshold. An RSI higher than this will result in the coin pair not beingtracked for pauseTime minutes
        • pauseTime is the amount of minutes to pause coin pair tracking by
      • sell:
        • profitMarginThreshold is the upper profit margin pause threshold. A profit margin lower than this will resultin the coin pair not being tracked for pauseTime minutes
        • pauseTime is the amount of minutes to pause coin pair tracking byIf you prefer to sell at a small loss rather than holding onto (pausing) sell coin pairs, the lossMarginThresholdtrade parameter should be set appropriately and then the sell pause parameter may be omitted.
      • balance:
        • pauseTime is the amount of minutes you would like to wait in between balance notification Slack messages(i.e. every x minutes, you will receive a Slack message containing a breakdown of your exchange balanceand the percentage change since your last balance notification message).

How to run

Navigate to the src file directory in terminal, and run the command python app.py to start the trading bot.

NOTE: I would highly recommend getting the python IDE PyCharm by JetBrains. Its a great development tool and makesrunning and debugging this project a breeze. A free community edition can be foundhere.

Trading

This system allows you to autonomously make and track crypto currency trades on Bittrex. It uses a local database strategyto ensure data is not lost.

To use this functionality, first set the desired trade parameters in the settings.json file. An example of reasonablysuccessful trading parameters can be found below:

{
    "sound": false,
    "tradeParameters": {
        "tickerInterval": "fiveMin",
        "buy": {
            "btcAmount": 0.001,
            "rsiThreshold": 20,
            "24HourVolumeThreshold": 25,
            "minimumUnitPrice": 0.00001,
            "maxOpenTrades": 3
        },
        "sell": {
            "lossMarginThreshold": -2.5,
            "rsiThreshold": 50,
            "minProfitMarginThreshold": 0.5,
            "profitMarginThreshold": 2.5
        }
    },
    "pauseParameters": {}
}

The analyse_buys() and analyse_sells() functions will then apply the buy_strategy(coin_pair) andsell_strategy(coin_pair) functions to each valid coin pair on Bittrex. These functions will check each coin pair forbuy/sell signals by utilising the the following two functions:

from directory_utilities import get_json_from_file

settings_file_directory = "../database/settings.json"
settings = get_json_from_file(settings_file_directory)

buy_trade_params = settings["tradeParameters"]["buy"]
sell_trade_params = settings["tradeParameters"]["sell"]

def check_buy_parameters(rsi, day_volume, current_buy_price):
    """
    Used to check if the buy conditions have been met

    :param rsi: The coin pair's current RSI
    :type rsi: float
    :param day_volume: The coin pair's current 24 hour volume
    :type day_volume: float
    :param current_buy_price: The coin pair's current price
    :type current_buy_price: float

    :return: Boolean indicating if the buy conditions have been met
    :rtype: bool
    """
    rsi_check = rsi is not None and rsi <= buy_trade_params["buy"]["rsiThreshold"]
    day_volume_check = day_volume >= buy_trade_params["buy"]["24HourVolumeThreshold"]
    current_buy_price_check = current_buy_price >= buy_trade_params["buy"]["minimumUnitPrice"]
    
    return rsi_check and day_volume_check and current_buy_price_check


def check_sell_parameters(rsi, profit_margin):
    """
    Used to check if the sell conditions have been met

    :param rsi: The coin pair's current RSI
    :type rsi: float
    :param profit_margin: The coin pair's current profit margin
    :type profit_margin: float

    :return: Boolean indicating if the sell conditions have been met
    :rtype: bool
    """
    rsi_check = rsi is not None and rsi >= sell_trade_params["sell"]["rsiThreshold"]
    lower_profit_check = profit_margin >= sell_trade_params["sell"]["minProfitMarginThreshold"]        
    upper_profit_check = profit_margin >= sell_trade_params["sell"]["profitMarginThreshold"]
    loss_check = (sell_trade_params["lossMarginThreshold"] is not None and
                  0 > sell_trade_params["lossMarginThreshold"] >= profit_margin)

    return (rsi_check and lower_profit_check) or upper_profit_check or loss_check

See the source code for a more detailed description.

Donations

If you found this project helpful and would like to support me, you can donate to one of the following crypto addresses:

  • BTC: 1E3xMaoFfuk52HaCb7KRbHmezeUumcyRjy
  • ETH: 0x2f647427313229E6AB320F826f759B9fCFd34658

Liability

I am not your financial adviser, nor is this tool. Use this program cautiously as it will trade with your crypto-currencies.None of the contributors to this project are liable for any loses you may incur. Be wise and always do your own research.

 相关资料
  • self reminder: patience is the mother of science *** REFUGEES WELCOME! ***       *** FATAL ROUTES? *** K is a very low latency market making trading bot with a fully featured web interface. It can pla

  • Binance Trading Bot Automated Binance trading bot with trailing buy/sell strategy This is a test project. I am just testing my code. Warnings I cannot guarantee whether you can make money or not. So u

  • Deep Trading Agent Deep Reinforcement Learning based Trading Agent for Bitcoin using DeepSense Network for Q function approximation. For complete details of the dataset, preprocessing, network archite

  • TradingVue.js TradingVue.js was a hackable charting lib for traders. You could draw literally ANYTHING on top of candlestick charts. [Not Maintained] Why If you create trading software - this lib is p

  • Overview 因为Java的Crypto API始终有点难用,SpringSide在core module中的org.springside.modules.security.utils中提供了封装。 API的出入参数都是byte[]数组,需要配合Encodes来转换成Hex或Base64存储。 Digests消息摘要 去年一轮的密码被盗风波后,使用salt并迭代N次的sha-1式密码存储已经是

  • The crypto component hosts all the implementations of cryptographic primitives we use in Libra: hashing, signing, and key derivation/generation. The NextGen directory contains implementations of crypt