I am working on backtesting for my trade bot
Gekko and
I created a simple script to calcuate candles on MtGox data. This script will output a csv file with all candles. Nitrous has created a great tool which can download all trade data and calculate candles based on this trade data. Check it out in the
Mt. Gox data downloader thread.
Downloadable candlesI've ran the script myself for a couple of candle durations on a couple of markets, here are the download links:
Hourly4 HourlyDailyOther timeframes (provided by Nitrous)Calculate your own candlesEDIT2:
If you have a copy of Microsoft excel you can use the data from Bitcoincharts to create your own candles for a number of exchanges and makets. Read the whole method
here. (big thanks to
TradesLikeAPotato)
EDIT:
Nitrous has created a great tool which can download all trade data and calculate candles based on this trade data. Check it out in the
Mt. Gox data downloader thread. If you want to use my older script here is the howto:
You can also use the script to calculate your own candles (for example: weekly, daily, 4hourly, 15min, 5 min, 1min, 514 seconds, etc. candles):
The simple script requires a local copy of a database with MtGox trades. To download this database you should use Nitrous' excellent
trade data downloader.
Once you have this database:
- Install nodejs
- Install npm (you can skip this on Windows and OS X if you used the installers)
- Download the script and put it somewhere close to database dump (from the trade data downloader).
- Go to the directory in command line or terminal.
- Open candleCalculator.js in a texteditor and edit the candle vars to your needs (adjust the startTime, endTime and candleDuration)* also check to see if `mtgoxDump` points to the correct file (it is as long as it's called dump.sql and is in the same directory)
- type in: npm install moment underscore sqlite-wrapper
- type in: node candleCalculator.js
- watch it go! Once every 10 candles it will write them to the csv file (candles-[script start timestamp].csv).
Notes:
- It is advised to index the date column (Money_Trade__) of the database before you start calculating candles. This will extremely speed up the time it takes to calculate the candles: without it takes 40+ hours on my VPS (with SSD) and with it it takes less than 5 minutes to calculate all hourly USD candles.
- As of now the script will report the following OHCL for a candle that did not have any trades: open: NaN, high: -Infinity, low: Infinity, close: NaN. If you don't want them strip them out after run or add a simple check at line 48.
*If you're not sure how to edit the dates and durations please see the
docs of momentjs.