UPDATE FOR BITFINIX ISSUES (12/23/2017): ADDED IN https://github.com/ccxt/ccxt and Coinigy, instead of custom wrapping all the api's Currently refactorng all of the code to use models for the database, ccxt for doing buys and sells and so forth. Adding in data seeds so strategies can be used right off the bat.
bowhead
a REST-API and console-based cryptocurrency trading bot boilerplate and framework Written by Joel De Gan, 2017
Bowhead (a type of whale) is the codename for a boilerplate within Laravel for building Cryptocurrency and Forex automated systems.
Utilizing a RESTful API, Bowhead can be used as a middle-layer for your favorite language to interface with multiple brokerages and market makers, just add your API keys.
Bowhead utilizes all the TALib functions implemented in the Trader extenstion for PHP and creates some of it's own indicators which are composites of those from TALib.
Focus of the project.
The primary focus is to have an easy to use boilerplate/framework that you can rapidly create a fully functional trading system on various strategies on BTC funded trading platforms that typically do not require that you are "verified" this way you can trade with funds without funneling them through your bank and having to deal with some potential tax issues (depending on the country you live in)
Companion article
This project has a companion article which walks you through how to set it up and walks you through setting up your first strategy and running it on Whaleclub and on 1Broker, which you will need accounts on both. Additionally the following are recommended exchnges:
Usage of Coinigy(free 1-month trial) also is being added.
The companion article is on Medum and is:
Part 1: Let’s write a cryptocurrency bot (part 1).
Part 2: Let’s write a cryptocurrency bot (part 2)
Part 3: Let’s write a cryptocurrency bot (part 3)
I highly suggest you read through it and follow along to get it up and running.
basic setup
You will need
- PHP7.1
- Redis
- MySql
- the PHP Pecl Trader extension,
for Python you will need the dotenv package.
pip install python-env
Notes
This project was initially done in the Laravel-Lumen (lightweight) framework however the move to a fully open sourced boilerplate/framework I felt that having the full ability of Laravel could be important, particularly Jobs and other parts which utilize queues could be invaluable.
Bowhead was written and tested on a Mac and I have it running in the cloud on an Ubuntu linux server in AWS making real money trades every day on the Crypto markets, on Forex pairs and on binary options.
One limitation that may mess up this running on Windows is the usage of a named pipe for passing data between Python and PHP in real time, there are ways around this, such as using Redis, or piping the output to a parser.
I am open to suggestions for how to get it to work on Windows
A note about editors.
I would like to additionally say that when you are working with Laravel, it it is almost mandatory to use an editor like PHPStorm, you 'can' use something like Atom but it would be like trying to use notepad to work on a dotNet project, you can technically 'do it' but it will be frustrating and you will not have a good time. I cannot recommend PHPStorm more highly. They have a free trial and with updates it extends the trial period, even still, if you choose to purchase it, it's not expensive.
additional libraries
I have added a couple utility libs that I like to use with this.
- Console class, this is for colorizing, doing progress bars and doing text tables in console which look like the following.
╔═══════════════════════════════════════════════╗
║ BTC │ ║
║ LTC │ ║
╚════════╧══════════════════════════════════════╝
If you feel in a tipping mood send BTC to
14d9xxG1h5DkaDihiDBwzp5nj82dTcWfHc
DONE:
- Write my own Coinbase, Whaleclub, 1Broker wrappers.
- Create Indicators wrapper for TALib.
- Create Candles wrapper for TALib
- Collect console functions into one Console class.
- Streaming data from Oanda
- Streaming data from Bitfinex
- Dockerfile easy-setup done and tested.
- Signals module
- Strategies module
- REST mapping module
IN PROGRESS:
- REST-API
- Write my own Oanda, Bitfinex and Poloniex API wrappers.
TODO:
- Standardize the calls to brokerages so the method names are the same across all of them.
- reporting, logging and backtesting tools.