• Stars
    star
    274
  • Rank 149,841 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Experimental trading bot for crypto currency on Binance.com

Trading bot for binance

Inspired by the Auto-buy the John McAfee coins he posts on Twitter at Bittrex by Mattias Geniar I decided to hack a small trading bot for binance.

This is an experimental bot for auto trading on the binance.com platform.

This implementation was inspired by a python trading bot, but I re-wrote this in a strong typed language and added more fault tolerance.

I don't hold a lot of coins in any currency, so please don't try to hack me and enjoy this bot instead <3

DISCLAIMER - you probably don't want to use this!

Probably there are way smarter bots out there, probably more than a hundred or thousand. I just can`t find smart ones open source ;-).

If you want to use this, give it a try, maybe modify the source, experiment and open a PR. Please start using small amounts!

This is highly experimental!!

You could lose coins!

You could lose a lot of coins!

But you could gain some coins Β―\_(ツ)_/Β―

Please observe this bot while operating and give feedback, open a PR, contribute code <3

Don`t leave the bot alone while operating!

I am not responsible for anything done with this bot. 
You use it at your own risk. 
There are no warranties or guarantees expressed or implied. 
You assume all responsibility and liability.

I am not responsible for any money you lose!

Please be aware, this bot follows a simple approach to gain profit and this code base don`t have a good test coverage. Actually the code base has no coverage at all. It is nice to play with and maybe a starting point for more smarter bots.

How it works

How it works

This picture above is just an example and was not subject of a real trade

Basically this bot tries to capture bursts and buys in, if a configurable amount of gain over 3 seconds is detected. The bot will check every 3 seconds to the order books of binance and compare asks and bids and will sell the just bought amount if no more gain is detected. If something unexpected happens, the bot tries to sell everything.

Please don`t use this bot if you are holding coins in the trading currency, because the bot will sell all coins after unexpected events!

If you choose a highly fluctuating currency, you have a high chance to hit a maybe a dozen of those bursts per hour. Sometimes it works quite good, sometimes not :)

Prerequisites

  1. You need a highly volatile crypto currency, for example XVG or TRX (I use XVG) - you should not hold coins of this currency
  2. You need a more stable crypto currency, for example LTC or ETH (I use ETH)
  3. You need to understand that you are responsible for any trades this bot is going to execute!
  4. You need to create an API key for binance.com
  5. You need to clone this repo (you need maven and java installed) and run the code OR just use docker

Configuration

API_KEY - the api key for you binance account - no default
API_SECRET - the api secret for you binance account - no default
TRADE_PROFIT - the profit in % your burst should have - 1.3 default
TRADE_AMOUNT - the trading amount per action - 150 default
BASE_CURRENCY - the base currency for all trades - ETH default
TRADE_CURRENCY - the trading currency for all trades - XVG default

Run in docker

You have docker installed? Awesome! Just run the following command:

docker run -ti \
-e API_KEY='YOUR_KEY_FROM_BINANCE' \
-e API_SECRET='YOUR_SECRET_FROM_BINANCE' \
-e TRADE_PROFIT='1.3' \
-e TRADE_AMOUNT='50' \
-e BASE_CURRENCY='ETH' \
-e TRADE_CURRENCY='XVG' \
unterstein/binance-trader

Run and compile source code

You need to have java and maven installed on your box. Run the following commands in your workspace directory:

# (Optional) Install maven
git clone [email protected]:binance-exchange/binance-java-api.git
cd binance-java-api
mvn clean install
cd ..
git clone [email protected]:unterstein/binance-trader.git
cd binance-trader
mvn spring-boot:run -DAPI_KEY=$YOUR_API_KEY -DAPI_SECRET=$YOUR_API_SECRET

Package and run on server

# Run on desktop to package:
mvn clean package
scp target scp target/binancebot-0.0.1-SNAPSHOT.jar whateverhost:whateverpath

ssh whateverhost
# Run on server
java -jar -DAPI_KEY=$YOUR_API_KEY -DAPI_SECRET=$YOUR_API_SECRET -Dserver.port=$YOUR_HTTP_PORT binancebot-0.0.1-SNAPSHOT.jar

Output

You should see an output like shown in the picture below: Output

Feedback

Please give feedback and report your experience :)

Donations

If this bot made you money in any way, I appreciate a donation:

  • $BTC: 13sTnjH2CMBVzxiQ41PUenBnKFpjx9emHT
  • $XRP: rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh (tag: 103358538)
  • $LTC: Le7DSYFtvSHRhX5ndxj3jo1oZYEQCzeYkg
  • $ETH: 0x3a3a32de226a34f8ab5c1eba66a81fb00b03d187
  • $BCH: lol no
  • ^ lol, love this joke :-)

This bot is offered free of charge with no guarantees whatsoever.

More Repositories

1

dhbw-java-lecture

Code according to my lecture at dhbw stuttgart -> https://wwwlehre.dhbw-stuttgart.de/~unterstein/
Java
15
star
2

dcos-for-java-devs

Sources to the talk `DC/OS for java developers`
Java
13
star
3

dcos-beer-demo

Scala
12
star
4

dhbw-java-2020

Java
6
star
5

elastic-alexa

Have some fun with alexa and elasticsearch
Java
6
star
6

microservices-logging-talk

Logging in the era of microservices
Java
4
star
7

wicket-tales

Real-Life Wicket Tales
Java
3
star
8

dcos-microservices

Sources to the talk `Operate microservices on top of DC/OS`
Java
3
star
9

microlist-play

todo list application with playframework.org
Java
3
star
10

dcos-galera

DC/OS MariaDB Galera Cluster configuration for Marathon
Shell
3
star
11

play-elasticplugin

ElasticSearch Plugin for Play 2.4
Java
3
star
12

play-neo4j-template

a plain template for play apps with scala, neo4j, bootstrap, and so on
Java
2
star
13

microlist

todo list application
JavaScript
2
star
14

reddcoin-graph

Creating a community graph out of the ReddCoin Twitter Tipbot usage
Java
2
star
15

dhbw-java-project-2019

Projekt 2018
Java
2
star
16

requireweb

a small web app for gathering requirements
Scala
2
star
17

unterstein.github.io

HTML
1
star
18

dcos-neo4j

Run neo4j at scale on DC/OS
Shell
1
star
19

todofxlist

todo list in javafx - used in my dhbw lecture
Java
1
star
20

dcos-elasticsearch-service

How to write a `datastore as a service`? Today: Elasticsearch on DC/OS
Scala
1
star
21

play-spring-data-elasticsearch-example

Just a short example how to use elasticsearch with spring data and play 2.4
Scala
1
star
22

dcos-maven-plugin

DC/OS Maven Plugin
1
star
23

lagom-playground

lagom playground
Java
1
star
24

wunderlist

The awesome and free GTD Tool Wunderlist
JavaScript
1
star
25

neo4j-beer-demo

Short demo of importing openbeerdb.com from mysql to neo4j via scala and spring jdbc templates
Scala
1
star
26

scalafiddle

Do you know JSFiddle? Yes? This is similar, but for scala!
Scala
1
star