Bitcoin Arbitrage and Trading Robots (Open Source)
4 stars based on
This is not much of a tutorial but it will show you how to write a trading bot in Python 2. This can be used as a moving stoploss function or allow you to buy a dip automatically without having to sit staring at your computer all night. It is intended for people with basic Python skills. Mac and linux users should already have this by default, Windows users can download and install the correct version here https: There are plenty of tutorials already out there.
Once you have Python 2. Just unpack that zip file put it somewhere out of the way. This is done in your account settings on the website. Open a new file in your favourite editor, then copy and paste the following code, saving it in the python-bittrex directory as trendlineTrader. After you save the file, enter your Bittrex api key and secret in the following two lines.
Do not change anything else! Make sure your key and secret are written in the speech marks. This is where it helps to have a free account at http: Here you can easily draw lines on their interactive charts. When you do the coordinates of the end points are highlighted on the axes. This means for use to parametrise a trendline all we need are the start and end points whose x, y coordinates are in fact time, price.
Open a terminal in the btc trading bot python directory. An example Bitcoin buy order of 1 BTC along a trendline btc trading bot python the 1 hour chart looks like this. The btc trading bot python p0 and p1 are the end points of the trendline that we get from the tradingview. I should warn you this is a real trading bot and will buy or sell cryptocurrencies automatically.
The programme will terminate automatically after a buy or sell order is fulfilled or the user closes the terminal. This means we can set a moving stoploss or buy a dip on an inclined support line automatically without supervision.
At present this only works on Bittrex. You must have Python 2. This will not work in Python 3 without modification. By default, this should already be installed on linux machines and Macs 2. Make sure to tick all options. Download python-bittrex API bindings from Github: Copy or download this script and make sure it is saved as trendlineTrader. If using Windows make sure the file extension is. Finished, just make sure to save the file.
USE This is a command line btc trading bot python. There is no GUI. However it is relatively easy. Open your python console, e. Open a chart of the market you want to trade in tradingview. In your browser draw the trendline that you want to trade on. You will need to enter the coordinates of the end points in the python script. In the terminal enter the following command all on one line: It allows btc trading bot python to set a margin of error either side btc trading bot python your trendline, e.
Use a positive number to set the variance above the trendline. Running the script is just one line. For each interval, the script calculates your buy or sell price and automatically places an order for you. If the order is not filled during the interval, it cancels the order and recalculates a new target and then places a new order for the next interval. The script terminates once the buy or sell order has been filled or the proces is terminated by the user.
Valid intervals are btc trading bot python, 60,D" else: Consider a smaller value. Please enter valid Bittrex market, e. Please enter a valid Bittrex market, e. An example Bitcoin buy order of 1 BTC along btc trading bot python trendline on the 1 hour chart looks like this python trendlineTrader. If you have any questions, just ask in the comments section. Have fun and happy trading! Authors get paid when people like you upvote their post.