Code Monkey home page Code Monkey logo

tradebot's Introduction

This was mostly a university and personal project and will no longer be updated

TradeBotWide

TradeBot is a cryptocurrency trading bot that uses the Binance API, and a strategy based on a couple of 5 minute chart indicators

  • (RSI, MACD, Bollinger Bands)

Download the latest release

How?

  • The bot uses 5 different indicators: DBB, EMA, MACD, RSI, SMA. The three main indicators will fire off a buy signal when a certain state has been achieved.
  • When the bot has collected enough signals, an order will be placed on the market.
  • Vice versa, if enough sell signals are signals are fired, a sell order will be placed.

The config for the bot can be changed using the config.txt file

Modes

Live

  • This is not a financial service or investment advice!

    • The default config and strategy implemented in the source code of the project serve as an example and are open-source.

    • While we intend to contribute to make the bot work well out-of-the-box, we make no specific claims about the profitability of it in the current market climate!

  • Backtest your config and make sure you are ready to use this mode at your own risk!

  • This mode trades with real money on the Binance platform

  • API key and Secret key required

  • You can choose to add your credentials to the credentials.txt file for easier use

  • Currently only supports market orders, this will cause a slight efficiency loss.

Simulation

  • Real-time trading simulation based on actual market data

  • Trades are only simulated based on market prices

  • No actual orders are made

Backtesting

  • Simulation based on historical data

  • Allows for quick testing of the behavior and profitability of the bot

  • Data needs to be loaded from a .dat file created with the Collection mode

Collection

  • Collects raw market price data (aggregated trades) from a specified time period

  • Collected data is saved in a file in the backtesting directory

  • Collected data can be exported to a .csv format

  • Never run more than one TradeBot with this mode at the same time, you will likely hit the API request limit.

Config

  • MACD change indicator - Change of MACD line to count as a buy signal (decimal)
  • RSI positive side minimum - Strong buy signal (2) if RSI is below this (integer)
  • RSI positive side maximum - Buy signal if RSI is below this (integer)
  • RSI negative side minimum - Sell signal if RSI is above this (integer)
  • RSI negative side maximum - Strong sell signal (2) if RSI is above this (integer)
  • Simulation mode starting value - Amount of FIAT to start with in Simulation (integer)
  • Percentage of money per trade - How much of available fiat to put into each trade (decimal)
  • Trailing SL - Trailing Stop Loss (decimal)
  • Take profit - Profit to close trade at (decimal)
  • Confluence - How many indicators have to give a buy signal to buy (integer)
  • Close confluence - How many indicators have to give a sell signal to sell (integer)
  • Use confluence to close - Whether to use sell signals to close or not (true/false)
  • Currencies to track - What currencies to track in simulation and live (ex BTC, ETH, ADA...)
  • FIAT - What currency to trade against (ex USDT)

See the included config file for a ready to use example

Setup the credentials.txt file to automatically log into live mode without having to enter your credentials

Issues, suggestions and contributing

If you run into any issues while using the bot or if you want to request any changes or new features, open a new issue to let us know.

If you would like to contribute to the development and profitability of the bot, simply open a PR or let us know.

There are some open issues that set a general direction for development once the current implementation of the bot works reliably in Live mode (modularize, separate backend, create GUI, communicate with GUI through API).

tradebot's People

Contributors

ebrahimimahdi avatar markrkalder avatar markusaksli avatar martentyrk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tradebot's Issues

Simulation Commands lack instructions

Current Behavior:

When launching bot in simulation mode, user is presented with a series of commands.

Expected Behavior:
Update config with an explanation of the commands for simulation mode. Currently unclear as to how to accurately test the bot.

linux

Can it run on linux?

Updated config.txt

Is there an updated config.txt file anywhere? Or a place where i can find some?
I'm not 100% on how to make my own and the current one takes a LONG time to find an order [ been 19hours for me ]

Persistence

Currently, the bot simply uses 100% of the available funds in the account it gets access to and treats all of the currencies as open trades (opened at the price at the time of launching). The bot will not remember any of the trades it opens and depends entirely on the information from Binance.

This is not ideal for a number of reasons. This could be reworked to both limit the scope of the bot and to more accurately track the stats on the open trades. This would require the implementation of:

  • An allotted budget for the bot
  • Persistent storage for open and closed trade information
  • Functionality to update the status of the trades if too much manual selling has occurred on the account

No backtesting files detected

Hello. Thanks for your software. There was a problem using from backtest. After creation, the program does not find it, despite the fact that it is physically created in the directory. Example:
Enter bot mode (live, simulation, backtesting, collection)
backtesting

---Entering backtesting mode

Backtesting data files:

[1] MATICUSDT_2021.01.01-2021.03.20.dat
[2] MATICUSDT_2021.03.01-2021.03.20.dat

Enter a number to select the backtesting data file
---Setting up...
java.io.FileNotFoundException: backtesting\MATICUSDT_2021.01.01-2021.03.20.dat (Нет такого файла или каталога)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.(FileInputStream.java:157)
at java.base/java.io.FileInputStream.(FileInputStream.java:112)
at data.PriceReader.(PriceReader.java:10)
at trading.Currency.(Currency.java:85)
at modes.Backtesting.startBacktesting(Backtesting.java:51)
at system.Main.main(Main.java:80)
java.lang.NullPointerException
at trading.Currency.log(Currency.java:187)
at modes.Backtesting.startBacktesting(Backtesting.java:68)
at system.Main.main(Main.java:80)
Testing failed, try again

maybe a stupid question

Describe what you would like to be changed, added, or improved.
the bot must run 24/7 or it works also if the pc is turned off or the application is closed?

TradeBot won't start

The TradeBot is a great bot - great job but I can't get it running since 06/24/2021. The console opens and nothing appears even after a long wait. Previously, it worked very well. I checked on various operating systems such as Windows 7 x64, Windows Server 2012, Linux Mint 19. JAVA version - 1.8.0_291-b10. Please help.

1

Rework the codebase to be more modular

Rework the entire current codebase to be essentially a backend instead of the current basic console app standalone solution.

  • The printed information needs to be returned in the relevant methods instead of being printed.
  • Use streams and listeners for constantly updating information (collection progress, trade events, etc)
  • Get rid of modes (or at least be able to switch between them)
  • Generate logs using an appropriate logging solution like log4j

This is the prerequisite for #8. This means the console exe with launch4j can be replaced with a different front-end. Once this is done the bot backend could also be entirely detached from the local executable, run as a server, and communicate via API responses.

RSI badly computed

RSI check is baddly computed as it cannot return -2 because temp > NEGATIVE_MIN (70 by default) is computed before temp > NEGATIVE_MAX (80 by default)

RSI.java line 93

Reverse the 2 tests

Release EXE requires JRE to run

Describe the bug
As per the title, the current EXE doesn't run when the JRE is not present, further more I have installed Java 11 JDK and it doesnt recognise that either (though that may be my system/java setup)

To Reproduce
Steps to reproduce the behavior:
Download EXE
Run Tradebot.exe
Program prints "TradeBot: This application requires a Java Runtime Environment 1.8 - 12"

Logs
TradeBot: This application requires a Java Runtime Environment 1.8 - 12

Desktop:

  • OS: Windows 10

Wording

Hi,

First of all, really great work!

I have a substantive question. What does Confluence mean in this context?

Best Stefan

GUI

Incorporate the bot functionality into a graphical interface instead of the current console app solution. Depending on the chosen framework this could be built into an app or web app as well as a desktop application.

Make indicators optional and allow different candle lenghts

First of all I would like to thank you for your dedication to creating this BOT that for the short time I tested it seems to work well and even stable.

I would like to know if it is possible to just activate one indicator instead of having 3 to activate constantly.
That is, instead of having the 3 (BB, MACD and RSI) just activate the purchase with one that I define, be it MACD, SMA or any other.

Another thing is whether it is possible to change the time chart from 5 to 15 minutes or 1 hour.

Thanks .

Executable replaces - with ? on win 10

Not sure why this happens yet, running the java code from IDEA or a built JAR is fine but the packed executable replaces - with ? in both console and log files.

us tld support?

Describe the bug
does this support us tld?

Proposed fix
config option for us tld

live mode problem

First of all I want to congratulate you on your work! .. I wait for the new update impatiently!
I have been testing the bot many times in simulation mode and it seems to work quite well and is stable.
But now I am starting to test it with real money and it does not execute the orders, the problem is that it remains frozen for hours with the following text "placing a buy market order for XXX / XXX active"
I have tested it with various currency amounts from 1 to 12 and I always get the same. API keys are correct, what can happen?

On the other hand, what is the maximum number of currencies you recommend per bot? ... for the new version it is possible to change the time intervals of the candles between 1m to1D? it would be fantastic!

Config reloading

There needs to be a method to reload the config on the fly for both the current bot and keeping the direction of the project in mind.

Backtesting problem

As I understand it, before we can backtest, it would be necessary to use the collect function first.

but then this problem happens:

collection

---Entering collection mode
---No backtesting files detected
Enter collectable currency (BTC, LINK, ETH...)
BTC
Invalid symbol.
BTCUSD
Invalid symbol.

IT DOESN'T MATTER WHICH SYMBOL I PUT THE RESULT THAT I SEE INVALID SYMBOL

---Out of funds, cannot open trade!

If there is no balance, then it will be infinite: ---Out of funds, cannot open trade!
Make a one-time warning about the lack of balance.
And let the bot stop trying to buy more. Thanks

Backtesting is too ideal compared to live

Originally discovered in #22

This should be reigned in by implementing the commission, a delay for trades, API limits for opening trades, and maybe some estimation for spread during backtesting.

Full backtesting log no longer has price or indicator values logged

Full log now just contains trades and 5min timestamps for some reason

FULL LOG:

2021/04/01 00:04:59  
2021/04/01 00:09:59  
2021/04/01 00:14:59  
2021/04/01 00:19:59  
2021/04/01 00:24:59  
2021/04/01 00:29:59  
2021/04/01 00:34:59  
2021/04/01 00:39:59  
2021/04/01 00:44:59  
2021/04/01 00:49:59  
2021/04/01 00:54:59  
2021/04/01 00:59:59  
2021/04/01 01:04:59  
2021/04/01 01:09:59  
2021/04/01 01:14:59  
2021/04/01 01:19:59  
2021/04/01 01:24:59  
2021/04/01 01:29:59  
2021/04/01 01:34:59  
2021/04/01 01:39:59  
2021/04/01 01:44:59  
---2021/04/01 01:46:01 opened trade (0.1702 BTCUSDT), at 58757.950, Trade opened due to: MACD histogram grew by 51.027%	
2021/04/01 01:49:58  

20 year trader doc from turkey

Describe what you would like to be changed, added, or improved.
İ have very kompleks algorıthms works very well manually.
İf you ınterested on that we can do it together.i don't know coding

Indicator weights

Config needs values for how much each indicator contributes to confluence.

Backtesting data basic info inclusion

Backtesting files should include the symbol, number of entries, start timestamp, and end timestamp at the start of the file to include some information to identify the data. This also allows the files to be renamed without losing functionality.

Simple DCA

I'm not a big fan of stop loss.

I like more to buy in a new uptrend. Think it's a good feature for your 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.