pulsecat
|
|
July 06, 2013, 10:26:17 PM |
|
With backtesting on this I found 0.80/0.80 was better... thus perhaps best to change the gekko config file to: " sellTreshold: -0.80, buyTreshold: 0.80 " ? Note that Gekko is a very technical tool, if you are having a lot of trouble with editing configuration files and watching the command line instead of a screen with a graph I recommand you to check out these similar projects. They are more focused on a user friendly tool. Those who are experiencing problems with installing tools mentioned above, may also try http://CryptoTrader.org - web-based scripting platform that allows to run your own trading algorithms on historical mtgox data very easily. For details, check out this comment https://bitcointalk.org/index.php?topic=222696.msg2668832#msg2668832nice Don't buy strategy
|
|
|
|
whydifficult (OP)
|
|
July 07, 2013, 12:04:49 AM |
|
anything out that will do LTC or alt-coins at all ??
Gekko has plans, but those are deffered until the new BTC-e API stabilizes. With backtesting on this I found 0.80/0.80 was better... thus perhaps best to change the gekko config file to: " sellTreshold: -0.80, buyTreshold: 0.80 " ?
Good idea, I'll look into what will be nice beginner settings. But I do need to make it clear that Gekko is more an trading algo platform then something that works out of the box. nice Don't buy strategy I like it a lot actually, this way the bot doesn't change position as agressive as the default one which saves a lot in fees. But this also means that the bot may not pick up light trends. I am running a couple of paper traders but my real trading Gekko has thresholds of -0.9 and 0.4 (with other EMA short & long) as it appeared very stable over the last couple of weeks. --- By the way, I wanted to use your backtester to verify my EMA and backtesting implementation. But I can't find the raw candle date. How did you calculate your candles? Similar to my candle fetcher (which uses the trade data MtGox put in Google BigQuery)?
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
pulsecat
|
|
July 07, 2013, 02:54:59 PM Last edit: July 07, 2013, 07:31:41 PM by pulsecat |
|
By the way, I wanted to use your backtester to verify my EMA and backtesting implementation. But I can't find the raw candle date. How did you calculate your candles? Similar to my candle fetcher (which uses the trade data MtGox put in Google BigQuery)? Yes, at Cryptotrader.org, the script calculates candles the same way, though it also takes volumes into consideration and use data fetched from Mtgox via websockets API for inputs. I think the good way to make sure our calculations are correct, is to compare script output with similar data provided by popular online chart tools like Bitcoincharts ('Load raw data' link at the page bottom).
|
|
|
|
nii236
Member
Offline
Activity: 85
Merit: 10
|
|
July 07, 2013, 05:36:15 PM |
|
Can anyone help me with running the bot? It just returns immediately from the program when I type "node gekko". No error messages or anything. npm, nodejs is installed. I did a git clone for installation of Gekko itself. nii236@NiiEEE ~/bitcoin/gekko $ node gekko nii236@NiiEEE ~/bitcoin/gekko $
Also, is there a way to disable certain types of trades. I want to do the following: When EMA crossover signals a buy, buy on MtGox ONLY When EMA crossover signals a sell, sell on BitStamp ONLY Is this possible?
|
|
|
|
whydifficult (OP)
|
|
July 07, 2013, 07:54:47 PM |
|
Yes, at Cryptotrader.org, the script calculates candles the same way, though it also takes volumes into consideration and use data fetched from Mtgox via websockets API for inputs. I think the good way to make sure our calculations are correct, is to compare script output with similar data provided by popular online chart tools like Bitcoincharts ('Load raw data' link at the page bottom).
Good point, I'll also check a couple backtesters with different EMA parameters to see if they would come to the same profit conclusion. Can anyone help me with running the bot? It just returns immediately from the program when I type "node gekko". No error messages or anything. npm, nodejs is installed. I did a git clone for installation of Gekko itself. nii236@NiiEEE ~/bitcoin/gekko $ node gekko nii236@NiiEEE ~/bitcoin/gekko $
Hmm that's strange, do you have the newest version of Gekko? And what platform do you have? All logging goes to stdout (which means the terminal session most of the time). Also, is there a way to disable certain types of trades. I want to do the following:
When EMA crossover signals a buy, buy on MtGox ONLY When EMA crossover signals a sell, sell on BitStamp ONLY
Is this possible?
Well you would have to run two Gekkos: One where you disable buying by making the buyTreshold "Infinity" (without the quotes). And another one where you'd set the sellTreshold at "-Infinity", if you put those in two different config files you can specify to Gekko what config to use on running. Read more about that here. This way you can also configure the MtGox one to watch MtGox and the Bitstamp one to watch Bitstamp (if you want them to).
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
nii236
Member
Offline
Activity: 85
Merit: 10
|
|
July 07, 2013, 09:31:49 PM |
|
Yes I'm running a fresh clone of your GitHub project. I'm on Linux Mint at the moment and I'm pretty much stumped by what is causing this.
I suppose I can try and reinstall node and nodejs and see what happens...
|
|
|
|
whydifficult (OP)
|
|
July 07, 2013, 10:26:24 PM |
|
Yes I'm running a fresh clone of your GitHub project. I'm on Linux Mint at the moment and I'm pretty much stumped by what is causing this.
I suppose I can try and reinstall node and nodejs and see what happens...
Yea, I've never experienced something like this. You can try to create a new file called `test.js` with the following content: Run it with `node test` and see if it logs test or not (if it doesn't your node is not working / outputting correctly).
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
nii236
Member
Offline
Activity: 85
Merit: 10
|
|
July 07, 2013, 10:43:13 PM |
|
Hmm still no difference. For what its worth, I removed node and reinstalled it and still same problem. I also ran into an issue with "npm install". I posted it below. Any ideas? npm http GET https://registry.npmjs.org/mtgox-apiv2 npm http GET https://registry.npmjs.org/underscore npm http GET https://registry.npmjs.org/moment npm http GET https://registry.npmjs.org/btc-e npm http GET https://registry.npmjs.org/bitcoincharts npm http GET https://registry.npmjs.org/emailjs npm http GET https://registry.npmjs.org/prompt-lite npm http GET https://registry.npmjs.org/bitstamp npm http GET https://registry.npmjs.org/async npm http GET https://registry.npmjs.org/line-reader
npm ERR! Error: failed to fetch from registry: underscore npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12 npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9) npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18) npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22) npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58) npm ERR! at Request.emit (events.js:88:20) npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:209:10) npm ERR! at ClientRequest.emit (events.js:67:17) npm ERR! at onConnect (/usr/lib/nodejs/request/tunnel.js:151:23) npm ERR! at Array.0 (/usr/lib/nodejs/request/tunnel.js:132:7) npm ERR! You may report this log at: npm ERR! <http://bugs.debian.org/npm> npm ERR! or use npm ERR! reportbug --attach /home/nii236/bitcoin/gekko/npm-debug.log npm npm ERR! npm ERR! System Linux 3.8.0-19-generic npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! cwd /home/nii236/bitcoin/gekko npm ERR! node -v v0.6.19 npm ERR! npm -v 1.1.4 npm ERR! message failed to fetch from registry: underscore npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/nii236/bitcoin/gekko/npm-debug.log npm not ok
|
|
|
|
whydifficult (OP)
|
|
July 07, 2013, 11:20:46 PM |
|
Your node version is pretty old: you are running v0.6.19 while the current version is v0.10.12. I think that this is your problem. You can quickly update node by downloading the npm module n globally: `npm install -g n` and than run `n latest` and it will install the latest node version. Or you can compile it yourself.
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
whydifficult (OP)
|
|
July 09, 2013, 11:14:18 PM |
|
maybe silly question but,
does you backtest includes fees for open and close of trade ?
When Gekko is backtesting it uses the close of candles both as the price to determine trends using EMA and the price at which to trade if a new trend is detected and it simulates a trade. The fee applied to the simulated trade defaults to 0.6% (the default at Mt. Gox with low amounts). You can configure this fee amount in the config.
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
mobile
Sr. Member
Offline
Activity: 400
Merit: 250
the sun is shining, but the ice is still slippery
|
|
July 09, 2013, 11:25:14 PM |
|
This is fantastic. I have been pouring over this for the past couple days. Thank you for your work in developing this. On my next BTC buy in will toss a donation your way.
I feel like I have a bit of learning to do in regards to getting this to work before I propose any formal questions for you regarding its operation. I will quickly mention that I installed everything with no problems to speak of but it only gets as far as displayed down below (ive let it sit for hours). The buy advice (at time of advising) was actually 50cents higher then the highest bid so obviously Im missing something but felt like composing my troubles anyways. Thanks again. Cheers....
2013-07-09 19:14:15 (INFO): I'm gonna make you rich, Bud Fox. 2013-07-09 19:14:15 (INFO): Let me show you some Exponential Moving Averages 2013-07-09 19:14:15 (INFO): Using normal settings to monitor the live market 2013-07-09 19:14:16 (INFO): NOT trading with real money 2013-07-09 19:14:16 (INFO): Profit reporter active on simulated balance 2013-07-09 19:14:16 (INFO): Calculating EMA on historical data... 2013-07-09 19:15:28 (INFO): ADVICE is to BUY @ 76.700 (0.357)
|
1 MoBi1eNbqh8QMuvtZjYzQGV8NEckJJYcT rep| GnuPG <3 CLAM <3
|
|
|
Diabolicus
Member
Offline
Activity: 90
Merit: 10
|
|
July 10, 2013, 07:54:01 AM Last edit: July 10, 2013, 08:07:25 AM by Diabolicus |
|
I agree, truly fantastic work. Instead of having the bot pull fixed parameters from the config.js, would it be possible to adjust it so it also accepts parameters via the command line? And would it also be possible to have the bot auto-append the profit report results to a .csv table, along with the settings used?
Something like: node gekko --EMA1 10 --EMA2 21 --buy_threshold 0.25 --sell threshold -0.25 --fee 0.6 --output results.csv
That way you could cycle through different parameters very comfortably via a batch file and find the optimal settings.
Edit: it would be even more comfortable, if there was an option to set upper and lower values and an increment for each parameter in the config.js
Example: buy_threshold_upper 0.5 buy_threshold_lower 0.1 buy_threshold_increment 0.01 output results.csv
The results of each iteration could be written to a table like this: buy_threshold sell_threshold <other setings> amount_of_trades simulated_profit <other results> 0.50; -0.25; ...; 200; 1500%; ... 0.49; -0.25; ...; 210; 1510%; ... 0.48; -0.25; ...; 220; 1490%; ... ... 0.10; -0.25; ...; 200; 1200%; ...
Of course, the more variables there are, the more exponential grows the number of possible iterations, I'm aware of that. But it would be awesome ;-)
|
|
|
|
dirtscience
Newbie
Offline
Activity: 28
Merit: 0
|
|
July 10, 2013, 03:34:46 PM |
|
Here is the first version of my (open source) trading bot for node called Gekko. You can find the whole project on Gekko's Github repo. Currently Gekko is able to advice or do real trades at Mt. Gox, BTC-e and Bitstamp using EMA (exponential moving averages), as described in Goomboo's Journal. It can monitor the live market or backtest on historical data. Main featuresGekko uses technical analysis (only EMA at this moment) to determine when to enter the market, at such a moment it can: - Advice on what you should do (and mail the advice to you).
- Calculate the profits of all the advices so far.
- Automatically trade at Mt. Gox, BTC-e and Bitstamp
Even though there are multiple EMA trading bots in javascript (as Chrome plugins) all of Gekko's code is written from scratch. The goal of the project is for me to learn more about such systems, therefor I'm trying to keep the code as readable as possible to also attract non programmers. Background infoThis project is a learning excercise of me, a student with some experience in programming (mostly web) and zero experience in economics and trading. I figured writing my own trade bot would be the best way to learn about implementing mathematical trading algorithms. So here is my very first attempt at anything related to trading / algorithmic decision making.
I'm developing Gekko fully open source in the hope of getting feedback from folks with more experience in this field. Because I not only want to attract programmers I am doing my best to make the code as readable as possible, this includes a lot of comments and probably not the most efficient (but expressive) code.
As this is a learning experience for me all feedback is extremely appreciated. If you don't want to contribute to the code you can always just send me an email. Installing GekkoWindows user? Here is a step-by-step guide on how to get Gekko running! Because Gekko runs on node you need node installed. You can find more detailed instructions on how to install Gekko in the install section of the README. Gekko's outputOn default Gekko will give advice on what to do (on start and at every interval) and a report of the profits you would have when you had listened to the advice. (ADVICE) 2013-05-19 23:18:14 HOLD @ 122.596 (-0.140) (PROFIT REPORT) 2013-05-19 23:18:14 0.000 % profit (in 0 trades) You can tweak all EMA settings (see below) and also configure Gekko to do the trading automatically for you at both BTC-e and Mt. Gox and Bitstamp. Read more in the documentation. Gekko's backtesting outputYou can use Gekko to backtest strategies, you can read more in the docs on how to configure Gekko to do backtesting. After running a backtest, Gekko will display the results like this: 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) start time: 2013-04-24 07:00:00 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) end time: 2013-05-23 16:00:00 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) timespan: 29 days
2013-06-30 13:25:30 (INFO): (PROFIT REPORT) start price: 121.6 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) end price: 125.44 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) Buy and Hold profit: 3.158%
2013-06-30 13:25:30 (INFO): (PROFIT REPORT) amount of trades: 15 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) original simulated balance: 245.404 USD 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) current simulated balance: 281.819 USD 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) simulated profit: 36.415 USD (14.839%) 2013-06-30 13:25:30 (INFO): (PROFIT REPORT) simulated yearly profit: 447.030 USD (182.161%)
Configuring GekkoYou can currently configure the following EMA parameters: // timeframe per candle interval: 60, // in minutes
// EMA weight (α) // the higher the weight, the more smooth (and delayed) the line shortEMA: 10, longEMA: 21,
// amount of samples to remember and base initial EMAs on candles: 100,
// max difference between first and last trade to base price calculation on sampleSize: 10, // in seconds
// the difference between the EMAs (to act as triggers) sellTreshold: -0.25, buyTreshold: 0.25
FeedbackAs I'm just a student without any trading experience, I'm mostly looking for feedback on how to improve Gekko. So what features would you like to see? What would you like to see improved? Whats up with the gay picture?
|
|
|
|
Epoch
Legendary
Offline
Activity: 922
Merit: 1003
|
|
July 10, 2013, 05:43:42 PM |
|
Whats up with the gay picture?
You must be pretty young if you aren't familiar with Wall Street.
|
|
|
|
whydifficult (OP)
|
|
July 10, 2013, 09:34:49 PM |
|
This is fantastic. I have been pouring over this for the past couple days. Thank you for your work in developing this. On my next BTC buy in will toss a donation your way.
I feel like I have a bit of learning to do in regards to getting this to work before I propose any formal questions for you regarding its operation. I will quickly mention that I installed everything with no problems to speak of but it only gets as far as displayed down below (ive let it sit for hours). The buy advice (at time of advising) was actually 50cents higher then the highest bid so obviously Im missing something but felt like composing my troubles anyways. Thanks again. Cheers....
Thanks! Just make sure to tune it in a way that it's profitable. Else it can be a pretty expensive toy. I am still improving the data retrieving part of the bot (when I have some free time), but I think that the way Gekko asks data is sime time behind the websocket (the source Clark Moody is using). I'll look into this. I agree, truly fantastic work. Instead of having the bot pull fixed parameters from the config.js, would it be possible to adjust it so it also accepts parameters via the command line? And would it also be possible to have the bot auto-append the profit report results to a .csv table, along with the settings used?
Something like: node gekko --EMA1 10 --EMA2 21 --buy_threshold 0.25 --sell threshold -0.25 --fee 0.6 --output results.csv
That way you could cycle through different parameters very comfortably via a batch file and find the optimal settings.
Edit: it would be even more comfortable, if there was an option to set upper and lower values and an increment for each parameter in the config.js
Example: buy_threshold_upper 0.5 buy_threshold_lower 0.1 buy_threshold_increment 0.01 output results.csv
The results of each iteration could be written to a table like this: buy_threshold sell_threshold <other setings> amount_of_trades simulated_profit <other results> 0.50; -0.25; ...; 200; 1500%; ... 0.49; -0.25; ...; 210; 1510%; ... 0.48; -0.25; ...; 220; 1490%; ... ... 0.10; -0.25; ...; 200; 1200%; ...
Of course, the more variables there are, the more exponential grows the number of possible iterations, I'm aware of that. But it would be awesome ;-)
Good point, I was thinking about this the other day and I think that I will implement a version with an increment first and log all results in a CSV. Thanks for your thoughts! I'll put it on my todo list when I have some more time. For a long term goal I was thinking about either particle swarm optimization or an genetic algoritm to optimize the parameters automatically. But at that time I want to have a lot more indicators and a way to use many at the same time (maybe neural network). But this will take a lot of time. Whats up with the gay picture?
Gekko is named after this pretty rich guy. Profile pic is some other guy who can fly.
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
jago25_98
|
|
July 11, 2013, 10:52:00 AM |
|
ah the bot gave me a buy advice around $71 finally.
Basically what's happening is that I only get output when there is a change in advice when I was expecting each hour to say something like "No change detected, advising to HOLD"
|
Bitcoiner since the early days. Crypto YouTube Channel: Trading Nomads | Analyst | News Reporter | Bitcoin Hodler | Support Freedom of Speech!
|
|
|
ewibit
Legendary
Offline
Activity: 2955
Merit: 1050
|
|
July 11, 2013, 11:42:44 AM |
|
what means (NaN)? 2013-07-11 12:33:39 (INFO): ADVICE is to HOLD @ 86.840 (NaN) 2013-07-11 13:03:39 (INFO): ADVICE is to HOLD @ 86.400 (NaN) 2013-07-11 13:33:40 (INFO): ADVICE is to HOLD @ 86.200 (NaN)
|
|
|
|
Timbo925
|
|
July 11, 2013, 11:55:05 AM |
|
ah the bot gave me a buy advice around $71 finally.
Basically what's happening is that I only get output when there is a change in advice when I was expecting each hour to say something like "No change detected, advising to HOLD"
Turning on debug mode will give you much more information. In the settings file their is a line to enable it by changing false to true. If you do this it might be a good idea to run gekko like this. node gekko |& tee GekkoMyLog.txt This will give split the output of the gekko to the terminal screen but also to a text file so you have everything as a backup in a nice text file. Also handy if you have a problem you can post the file to help determine the problem
|
|
|
|
daybyter
Legendary
Offline
Activity: 965
Merit: 1000
|
|
July 11, 2013, 12:12:37 PM |
|
what means (NaN)? 2013-07-11 12:33:39 (INFO): ADVICE is to HOLD @ 86.840 (NaN) 2013-07-11 13:03:39 (INFO): ADVICE is to HOLD @ 86.400 (NaN) 2013-07-11 13:33:40 (INFO): ADVICE is to HOLD @ 86.200 (NaN)
NaN = Not a Number Could be a bug, or so...
|
|
|
|
whydifficult (OP)
|
|
July 11, 2013, 12:27:43 PM |
|
what means (NaN)? 2013-07-11 12:33:39 (INFO): ADVICE is to HOLD @ 86.840 (NaN) 2013-07-11 13:03:39 (INFO): ADVICE is to HOLD @ 86.400 (NaN) 2013-07-11 13:33:40 (INFO): ADVICE is to HOLD @ 86.200 (NaN)
That's a bug in Gekko, if you could let me know some details (like are you running the latest version, what exchange and interval) I will look into it! Turning on debug mode will give you much more information. In the settings file their is a line to enable it by changing false to true. If you do this it might be a good idea to run gekko like this. node gekko |& tee GekkoMyLog.txt This will give split the output of the gekko to the terminal screen but also to a text file so you have everything as a backup in a nice text file. Also handy if you have a problem you can post the file to help determine the problem There are a couple of ways to run Gekko silently and log to a file instead of into the terminal, you can use tee if you are using a UNIX platform (AFAIK) like OS X or Linux. You can read some alternatives in Gekko's advanced features documentation. ah the bot gave me a buy advice around $71 finally.
Basically what's happening is that I only get output when there is a change in advice when I was expecting each hour to say something like "No change detected, advising to HOLD"
I had this before but changed it to log only position changes (buys and sells) so that it's easier to read back a couple of days later. As suggested you can turn on debug mode to get a lot more info but you can also turn on verbose in the profitcalculator part of the config. This way you'll get an update every interval (hourly on default) about your current (simulated) profit.
|
Gekko a nodejs bitcoin trading bot! Realtime Bitcoin Globe - visualizing all transactions and blocks Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
|
|
|
|