Pages:
Author

Topic: Gekko - a javascript trading bot and backtesting platform - page 23. (Read 147876 times)

newbie
Activity: 7
Merit: 0
Something odd happened today: I had Gekko running in the background for like a day or so (trading in MtGox), but suddenly I got a signal to sell, even though the chart on bitcoincharts didn't give any indication to do so. When I closed and reopened it, I got things like this:

Code:
2013-09-11 00:18:56 (INFO):     ADVICE is to HOLD @ 129.043 (NaN)

Ran it again with config.debug set:

...


gox was down for a bit, so it seems to be its trying to calculate EMA's on times where there is just no data. So number * NaN = NaN right... ( just like 234234*0=0). This will happen until the candle gets pushed out of the array i guess.

I think i have a fix which sorts this out, but saying this, i dont know gekko in its entirety at all. And these could have some adverse effects.

in methods/realtime-candle-fetcher.js
line 171: calculateCandle function
Code:
CandleCalculator.prototype.calculateCandle = function() {
  var bucket = this.buckets[this.currentBucket];
  // because buckets (and their contents) are chronologically reversed
  // the _last_ item is the open and the _first_ is the close

if(typeof _.last(bucket) == 'undefined')
        return false;
  if(typeof _.max(bucket) == 'undefined')
        return false;
  if(typeof _.min(bucket) == 'undefined')
       return false;
  if(typeof _.first(bucket) == 'undefined')
        return false;

  this.candles.open.push(_.last(bucket));
  this.candles.high.push(_.max(bucket));
  this.candles.low.push(_.min(bucket));
  this.candles.close.push(_.first(bucket));

  log.debug('calculated candle:', this.currentBucket);

  this.emit('calculated candle');

  if(this.currentBucket === 0)
    this.emit('calculated new candle');
}


I added the sexy if statements to skip over underfined values.
but as i said, these could have some bad effects. I've only been using gekko for about 4 days and am no way in a position to predict what this would do:P

newbie
Activity: 7
Merit: 0
Hi there,
trying to install, when i exeecute "nmp install" I get the following error:

http 404 https://github.com/titaniumlou/emailjs/tarball/patch-1


Thanks



in package.json

change where emailjs is retrieved from

Code:
"emailjs": "git://github.com/eleith/emailjs.git#master",
member
Activity: 66
Merit: 10
Something odd happened today: I had Gekko running in the background for like a day or so (trading in MtGox), but suddenly I got a signal to sell, even though the chart on bitcoincharts didn't give any indication to do so. When I closed and reopened it, I got things like this:

Code:
2013-09-11 00:18:56 (INFO):     ADVICE is to HOLD @ 129.043 (NaN)

Ran it again with config.debug set:

Code:
...
2013-09-11 00:24:24 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:24 (DEBUG):             short ema 133.005
2013-09-11 00:24:24 (DEBUG):             long ema 132.115
2013-09-11 00:24:24 (DEBUG):             diff ema 0.671
2013-09-11 00:24:24 (DEBUG):    calculated candle: 11
2013-09-11 00:24:24 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:24 (DEBUG):             short ema NaN
2013-09-11 00:24:24 (DEBUG):             long ema NaN
2013-09-11 00:24:24 (DEBUG):             diff ema NaN
2013-09-11 00:24:24 (DEBUG):    calculated candle: 10
2013-09-11 00:24:24 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:24 (DEBUG):             short ema NaN
2013-09-11 00:24:24 (DEBUG):             long ema NaN
2013-09-11 00:24:24 (DEBUG):             diff ema NaN
2013-09-11 00:24:24 (DEBUG):    need new trades, refetching Mt. Gox
2013-09-11 00:24:26 (DEBUG):    calculated candle: 9
2013-09-11 00:24:26 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:26 (DEBUG):             short ema NaN
2013-09-11 00:24:26 (DEBUG):             long ema NaN
2013-09-11 00:24:26 (DEBUG):             diff ema NaN
2013-09-11 00:24:26 (DEBUG):    calculated candle: 8
2013-09-11 00:24:26 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:26 (DEBUG):             short ema NaN
2013-09-11 00:24:26 (DEBUG):             long ema NaN
2013-09-11 00:24:26 (DEBUG):             diff ema NaN
2013-09-11 00:24:26 (DEBUG):    calculated candle: 7
2013-09-11 00:24:26 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:26 (DEBUG):             short ema NaN
2013-09-11 00:24:26 (DEBUG):             long ema NaN
2013-09-11 00:24:26 (DEBUG):             diff ema NaN
2013-09-11 00:24:27 (DEBUG):    need new trades, refetching Mt. Gox
2013-09-11 00:24:31 (DEBUG):    calculated candle: 6
2013-09-11 00:24:31 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:31 (DEBUG):             short ema NaN
2013-09-11 00:24:31 (DEBUG):             long ema NaN
2013-09-11 00:24:31 (DEBUG):             diff ema NaN
2013-09-11 00:24:31 (DEBUG):    calculated candle: 5
2013-09-11 00:24:31 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:31 (DEBUG):             short ema NaN
2013-09-11 00:24:31 (DEBUG):             long ema NaN
2013-09-11 00:24:31 (DEBUG):             diff ema NaN
2013-09-11 00:24:31 (DEBUG):    calculated candle: 4
2013-09-11 00:24:31 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:31 (DEBUG):             short ema NaN
2013-09-11 00:24:31 (DEBUG):             long ema NaN
2013-09-11 00:24:31 (DEBUG):             diff ema NaN
2013-09-11 00:24:31 (DEBUG):    calculated candle: 3
2013-09-11 00:24:31 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:31 (DEBUG):             short ema NaN
2013-09-11 00:24:31 (DEBUG):             long ema NaN
2013-09-11 00:24:31 (DEBUG):             diff ema NaN
2013-09-11 00:24:31 (DEBUG):    calculated candle: 2
2013-09-11 00:24:31 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:31 (DEBUG):             short ema NaN
2013-09-11 00:24:31 (DEBUG):             long ema NaN
2013-09-11 00:24:31 (DEBUG):             diff ema NaN
2013-09-11 00:24:31 (DEBUG):    need new trades, refetching Mt. Gox
2013-09-11 00:24:35 (DEBUG):    calculated candle: 1
2013-09-11 00:24:35 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:24:35 (DEBUG):             short ema NaN
2013-09-11 00:24:35 (DEBUG):             long ema NaN
2013-09-11 00:24:35 (DEBUG):             diff ema NaN
2013-09-11 00:24:35 (DEBUG):    fetching new trades for new bucket at Mt. Gox
2013-09-11 00:25:20 (DEBUG):    calculated candle: 0
2013-09-11 00:25:20 (DEBUG):    calced EMA properties for new candle:
2013-09-11 00:25:20 (DEBUG):             short ema NaN
2013-09-11 00:25:20 (DEBUG):             long ema NaN
2013-09-11 00:25:20 (DEBUG):             diff ema NaN
2013-09-11 00:25:20 (DEBUG):    we are currently not in an up or down trend @ 128.933 (NaN)
2013-09-11 00:25:20 (INFO):     ADVICE is to HOLD @ 128.933 (NaN)

Anyone else having issues? I had been running Gekko for almost a month with no problems until today.

P.S.: My timezone is GMT -4:30, in case you're wondering.
member
Activity: 87
Merit: 10
Hi there,
trying to install, when i exeecute "nmp install" I get the following error:

http 404 https://github.com/titaniumlou/emailjs/tarball/patch-1


Thanks

legendary
Activity: 2955
Merit: 1049
I now get the error using any offset on BTCe.
here the same
Code:
gekko_BTC-e/methods/realtime-candle-fetcher.js:98
    throw 'Failed to load historical trades from ' + this.watcher.name;
                                                   ^
Failed to load historical trades from bitcoincharts
newbie
Activity: 41
Merit: 0
I now get the error using any offset on BTCe.

EDIT: Read the other parts of the thread, it is a known issue.
newbie
Activity: 41
Merit: 0
It is indeed the offset. Subtracting 100 days from the date solved the problem, I just missed it on hourly because 4 days is less noticeable than 100. I've come across something else as well. Watching the market with BTCe EMAs 19/45 with an offset of 100 leads to a "Failed to load historical trades from bitcoincharts." Reducing the offset to 70 solves the problem, but causes inaccurate EMAs. It may be due to to the missing candles on bitcoincharts on the 26th of August.
sr. member
Activity: 287
Merit: 250
whydifficult I realize I may be getting a little obnoxious about this, but I think I've found another bug in the backtester. When putting a unix timecode in the "from:" category the program misinterprets it (I think). The timecode is 1367989200 which should translate to 2013-05-08 05:00:00 but instead is read as 2013-08-16 17:00:00. Doing the same on the "to:" time works completely fine. Obviously this isn't a pressing issue, since I can still just edit the CSV files, it's just one I figured you should know about.
I noticed this too and assumed it had to do with UTC/GMT offsets.

Hmm that's very strange, might be the offset but I'll try to verify this. I don't mind at all, please let me know everything you find. I am keeping a list of stuff I need todo for Gekko.

Unfortunatly I have very little spare time right now, as soon as I have some I'll work on some issues with Gekko!

Strange, I get the same issue by editing the CSV files to only the dates I want, but only when using daily candles... Hourly candles in the same date range work just fine. Here is the candles file.

noted, will look into this.

Any plans to adding possibility to trade with non btc pairs as well as altcoin exchanges like cryptsy etc?

Yep, I am working on offering all required trade data for this soon.

---

My current situation offers me very little spare time to work on Gekko, as soon as I have some I will.

I have noted all issues and when I have some spare time I'll look into everything. In the meantime Gekko is open to pull requests, and when you find a bug it would be great if you could describe it as clear as possible, thanks!

I am working on a platform that provides market data for a lot of different exchanges, the reason I have some time to work on this and less on Gekko is because Wizbit is going to be part of my graduation project, which means I can do this in university hours so to say (but I don't have a lot of time to work on this either).
sr. member
Activity: 363
Merit: 250
Any plans to adding possibility to trade with non btc pairs as well as altcoin exchanges like cryptsy etc?

PS trade data can be downloaded from http://www.cryptocoincharts.info
newbie
Activity: 41
Merit: 0
Strange, I get the same issue by editing the CSV files to only the dates I want, but only when using daily candles... Hourly candles in the same date range work just fine. Here is the candles file.
hero member
Activity: 560
Merit: 500
I am the one who knocks
whydifficult I realize I may be getting a little obnoxious about this, but I think I've found another bug in the backtester. When putting a unix timecode in the "from:" category the program misinterprets it (I think). The timecode is 1367989200 which should translate to 2013-05-08 05:00:00 but instead is read as 2013-08-16 17:00:00. Doing the same on the "to:" time works completely fine. Obviously this isn't a pressing issue, since I can still just edit the CSV files, it's just one I figured you should know about.
I noticed this too and assumed it had to do with UTC/GMT offsets.
newbie
Activity: 41
Merit: 0
whydifficult I realize I may be getting a little obnoxious about this, but I think I've found another bug in the backtester. When putting a unix timecode in the "from:" category the program misinterprets it (I think). The timecode is 1367989200 which should translate to 2013-05-08 05:00:00 but instead is read as 2013-08-16 17:00:00. Doing the same on the "to:" time works completely fine. Obviously this isn't a pressing issue, since I can still just edit the CSV files, it's just one I figured you should know about.
sr. member
Activity: 287
Merit: 250
Gekko is a good reason to start with nodeJS - I always wanted to learn it. I just started an little bot that also has a web frontend (express & jade) based on / inspired by gekko. Maybe I will be able to contribute something to gekko some day.

For now I don't like (or am not familiar enough with)  some of the coding styles in gekko like these emit("someMethod") calls that are quiet hard to track down with the IDE. There are quiet a lot of frameworks / DSLs to learn in the JS world Smiley But thats what I want to understand. So let's see where it ends.

That sounds awesome. If you're on to something I would love to see it, and it would be awesome if you would one day contribute to Gekko.

About the coding style:

I'm not a programmer with XX years of experience or anything, I am just a student with a focus on web technologies. In my spare time I am discovering the trading world with Gekko. It could be possible that the coding style is strange / unfamiliar and I am very willing to see how this can be improved to something more understandable for other people then me.

--

The Emit methods (events) are an easy way to glue separate pieces of code together (once you get the hang of it), they are extremely handy for a lot of different (async) things you are doing with node (except for doing stuff like serving jade templates). It's hard to track down what happens when an event gets triggered but that is also the advantage: you can just plug functions in and out without altering the original function. So for example the piece of code responsible for doing trades doesn't have anything to do with whether or not an email needs to be send, it just emits a 'doing new trade' event and the email function is listening to it based on the cofiguration, etc.

They are also pretty popular on the frontend, with jQuery for example (the difference is that you are almost always listening to events going through the DOM instead of creating them). You can take a look at a pretty popular frontend framework called Backbone, which does not deal with the DOM but is handy when you are creating more complicated web apps. Backbone also uses events everywhere.

If you need any help with understanding it in Gekko, let me know.
member
Activity: 224
Merit: 12
Gekko is a good reason to start with nodeJS - I always wanted to learn it. I just started an little bot that also has a web frontend (express & jade) based on / inspired by gekko. Maybe I will be able to contribute something to gekko some day.

For now I don't like (or am not familiar enough with)  some of the coding styles in gekko like these emit("someMethod") calls that are quiet hard to track down with the IDE. There are quiet a lot of frameworks / DSLs to learn in the JS world Smiley But thats what I want to understand. So let's see where it ends.
newbie
Activity: 41
Merit: 0
whydifficult, do you have an ETA on the email fix?

It's fixed! The mail dependency I was using broke the authentication with the gmail, luckily someone submitted a fix for it.

How to apply fix:

  • git pull
  • browse to `gekko/node_modules/` and delete the whole folder `emailjs`
  • npm install


Thanks a ton!
sr. member
Activity: 287
Merit: 250
whydifficult, do you have an ETA on the email fix?

It's fixed! The mail dependency I was using broke the authentication with the gmail, luckily someone submitted a fix for it.

How to apply fix:

  • git pull
  • browse to `gekko/node_modules/` and delete the whole folder `emailjs`
  • npm install

whydifficult.. thank you!.. just started playing with your code today. i will of course inform you of anything interesting I find while testing!

keep up the good work guys!

Thanks Smiley If you need any help sifting through the code just let me know. Unfortunately I have very little spare time as of late so I don't have as much time as I had hoped to work on Gekko the last couple of weeks.
sr. member
Activity: 265
Merit: 250
whydifficult.. thank you!.. just started playing with your code today. i will of course inform you of anything interesting I find while testing!

keep up the good work guys!
newbie
Activity: 41
Merit: 0
whydifficult, do you have an ETA on the email fix?
sr. member
Activity: 287
Merit: 250

Hi, thanks for taking the time to reply! Let's see if I'm getting everything right. When you say "a different history" you mean to say that when I change the number of candles to retain for calculation, I'm basically evaluating a different timeframe = different history, correct?

On another note, I was looking through the source code to see if I could write a tester that would automatically find the optimum EMA values for a given timeframe, but I haven't had much time to do so.

the number of candles means two things right now:

- the amount of candles to grab from before `now` to base the EMA history on.
- the amount of candles at any time to keep in memory (this doesn't have to be here at all since you only need the last once you started).

So it influences how pure the EMA calculation will be based on the grabbed history. But because the EMA is recalculated every interval, after running Gekko for a long time this difference will be almost gone. This is also where things are currently broken in Bitstamp & BTC-e: the APIs have changed on how to get older trades.



Thanks a million for your answer.

I am trying with really small ema (1/4) periods and 720 minutes but i only manage to get it a really small number of candles With only one it gives an error. With two it just stays there waiting for 12 hours until it gets the minimum to calculate an ema crossover then gives you an advice. With 3 it just says that it could not download the historical data. I have tried also with the standard values but still it gives the failed to load historical trades from bitstamp error.

Thanks again,

That's a pretty big interval, if you set the amount of candles to 100 Gekko would need to fetch all trades from the last 12 hours * 100. It can't ask for candles so it needs to fetch all those trades and calculate the candles. You could try to turn on debug in the config to get more information on what works and what doesn't. The only other option you have left is Mt. Gox right now.

Note that the new website I am building offers a solution this problem by offering candles (very light weight) instead of all the trades needed to calculate those candles.
sr. member
Activity: 371
Merit: 250
Thanks a lot for your bot. It is awesome !

One question. To minimize risk of exchange shutdown and also to greately reduce slippage but still have different configurations i would like to run different ema and percent values on different exchanges. Can i just copy the gekko folder and run different instances with different configurations?

I have copied the folder to ...\Desktop\gekko-master\gekko-master2\ and run node gekko (i have already one running on ...\Desktop\gekko-master\gekko-master\ . Both gekko bots have different EMA configurations. Why? i have very different trading rates and backtesting that seems to heavily change the benefit i get depending on EMAs and percent thresholds.

The first one with btc-e is running fine but with the second one (gekko-master2) i am just getting a "Failed to load historical trades from Bitstamp". I don't know if there has been a change in their api or it is a problem of my configuration. I have api activated and email verified on bitstamp. It seems to be connecting right because it displays the correct amount of BTC and USD but fails getting historical data. I have tried lowering the number of candles from 300 to even 5 and it does the same.

What do you think might be happening? I have latest gekko version.

Thanks!

The first question about running multiple Gekkos with different settings: You can also copy the config file and run a second Gekko and tell it to use the other config file, you can read more information in the docs. But you can also copy the whole folder.

The problem with Bitstamp is has to do with them changing the API. I am working on distrubiting candles using my own platform, but in the meantime you can try this solution.

Thanks a million for your answer.

I am trying with really small ema (1/4) periods and 720 minutes but i only manage to get it a really small number of candles With only one it gives an error. With two it just stays there waiting for 12 hours until it gets the minimum to calculate an ema crossover then gives you an advice. With 3 it just says that it could not download the historical data. I have tried also with the standard values but still it gives the failed to load historical trades from bitstamp error.

Thanks again,
Pages:
Jump to: