Pages:
Author

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

sr. member
Activity: 369
Merit: 250
What's the current status of your fork? You write that only CEX.IO is supported but in the config file there are options for Bitstamp/etc.? Also you say DEMA is supported but you opened a ticket where it says only MACD is working?

Sorry, I want to clarify that I think there's some confusion, ambiguity, and miscommunication:

The config.js (old code) in gekko is a liar:

In the original gekko code (which I forked) there is a "DEMA.js", and some related configuration options which are all completely mislabeled. It is not clear what "that thing" (method or algorithm) even is. One thing is clear though: THAT (old) CODE IS NOT AN ACTUAL DEMA of any kind whatsoever...

... and until this past 48 hours when I wrote a real DEMA implementation, gekko didn't actually implement DEMA at all. The "actually a DEMA-based calculation" code had to be named "x2 " such as "x2MACD" so it wouldn't be confused with the older, (mislabeled, wrongly named) "DEMA.js" based code.



This is why I've been spending so much time on bugfixes and code audits. There are some things in the code which are outright confusing or inaccurately named, despite the fact that they CAN technically be used generate valid advice or even do trading. It's just a peve, and mislabeling something which isn't DEMA as such is kinda weird. Moving forward, as I audit, document, bufix, and clean up everything, I really might just rebrand the forked codebase "lizardbot" or something.

At that point, one of the first things I'll do is delete DEMA.js and all the references to it since it's not actually DEMA:

http://www.investopedia.com/articles/trading/10/double-exponential-moving-average.asp

^ I really did implement some actual DEMA code in the past 48 hours... I didn't call it that though, since it conflicted with the ... thing (whatever it is)

so yes and no.

DEMA works, but I had to call it something else *facepalm*

whatever  Embarrassed
sr. member
Activity: 369
Merit: 250
>> 1

What's the current status of your fork? You write that only CEX.IO is supported but in the config file there are options for Bitstamp/etc.? Also you say DEMA is supported but you opened a ticket where it says only MACD is working?

>> 2

Maybe it would be best if you opened a new thread for your fork so you can maintain current updates for people to see?

>> 3

Anyway, if I want to give this a testrun all I have to do is disable "Trader" and enable "ProfitSimulator", correct?

1, current status is a code audit, and cleanups for anything which makes sense, and asking questions and discussing the bits which are confused. Example:

WHAT IS that method in the DEMA.js? I do not know what that code even is. It is not using a "double EMA" of any kind, and I can't seem to find any sort of indicator based on that sort of algorithm. This is how it works:

Code:
~pseudocode~

Calculate a fast and slow EMA average

A = subtract one from the other

B = add one to the other, and divide it by 2

C = 100 times A divided B

based on the value of C, assume positive values mean an uptrend, and negative values mean a downtrend

I ... don't even know what that is. It is not called "DEMA" though I don't think, I've never seen any TA indicator which does that particular combination of things to two different EMAs...

I could have updated the ticket with more info after fixing the PPO code, but was tired last night... PPO has been audited and is now consistent with the new codebase, and I added the x2MACD now as well (which worked correctly overnight) -- updated: https://github.com/kuzetsa/gekko/issues/3

(and thanks for reminding me to look at that)



As for the current status, of "support for non-cex.io" mostly I'm just only supporting cex.io exchange because the API works, and I can only test with what I have available.

/// [[ nearly a decade ago --  My ex pulled a "kinda-sorta identity theft" thing on me out of spite during the breakup, and my bank didn't provide any remedy when I was cleaned out due to a spiteful angry situation, which among other things, left me feeling "not safe" for a couple years. ]]///

... and I do not have good enough credit to be allowed a bank account or otherwise do trades with FIAT-type currency (USD, etc. on bitstamp or whatever)

I will probably add support for things like vircurex or cryptsy, or otherwise exchanges which I'm able to fully test all currency pairs, but I will not be personally maintaining or providing code to support exchanges which support bank transfer.



2) I don't know. What to name, and why make such a new thread?. I have some errands to run today, and am open to suggestions but need to go get dressed right this minute. I'm comfortable with the idea of staying on this thread for a while longer though, since I wasn't the only person working on gekko before the project lost momentum several months ago.

3) the "trader" is disabled by default... "Profit simulator" isn't something I've audited, and it doesn't take into account the concept of reinvesting mined income from cex.io GHS. At this time, this particular code in my fork doesn't support the concept of "buy low / sell high" (or selling at all) so I'm not sure what you hope to achieve by enabling the profit simulator.

I'm open to the idea of making the new behavior "optional" and re-adding code which has "selling" logic...

HOWEVER!!! The main reason I removed it (in favor of a simple "buy and hold") was that the logic for how buy/sell would be handled was different for every trading method. There was no consensus from one method to the next how the logic would work for buy / sell / hold / reinvest / etc. and there were a lot of bugs relating to the different methods using different ways of tracking the state.



Edited to add:

I do not have time to proofread, I have to get dressed like 10 minutes ago.

Sorry for a rough draft, hope there wasn't too bad grammatical errors or spelling mistakes in this
full member
Activity: 227
Merit: 100
I have one question about the profit simulator,

I've been using the original fork of Gekko (as of this source) on btc-e USD/BTC market.
I'm in test mode at the moment, but the simulator always gives me a negative profit no matter what I do.

I'm quite new to all this really, and I'm wondering if its just my settings, or if the simulator is broken?

cheers
legendary
Activity: 1237
Merit: 1010
Oh hey, this is interesting. I discovered this project a couple weeks back but thought it was dead.

What's the current status of your fork? You write that only CEX.IO is supported but in the config file there are options for Bitstamp/etc.? Also you say DEMA is supported but you opened a ticket where it says only MACD is working?

Maybe it would be best if you opened a new thread for your fork so you can maintain current updates for people to see?

Anyway, if I want to give this a testrun all I have to do is disable "Trader" and enable "ProfitSimulator", correct?

Thanks for your great work Sarah!
sr. member
Activity: 369
Merit: 250
I see the launch script with the tee command is that the only method?

pipe it into tee and specify the filename to output the log to Smiley

tee is easy, just do the do like what this command do the do:

Code:
$ node gekko | tee gekko.log



Edited to add:

alternatively, the launcher I personally use ended up in the git repo for my fork

 (and it's not in the /bin/ directory with all those other scripts. oops)

Code:
$ ./launcher | tee gekko.log

you may or may not need to chmod 744 first if the perms are wrong.



Last comment / going to bed now...

At some point I'll likely do some cleanup and actual testing to make sure all the various included scripts and such work. Sorry gekko is in such a bad state at the moment Sad

lizard.sh

^ The "tee" logging wrapper I'm using now, and it's all I have in me for tonight.

This wrapper (which calls the launcher script) just starts with:

Code:
$ ./lizard.sh

Good luck Smiley
sr. member
Activity: 252
Merit: 250
How come it says cex.io trading fee will be: 0.75%? cex.io fee is 0.2% usually.

Actually, that workaround is probably no longer needed...

If anyone wants to test this prerelease version (intentionally NOT flagged as "latest") I'd appreciate it:

https://github.com/kuzetsa/gekko/releases/tag/microtrade

I've had it running for a few minutes, but other people are probably using different settings than mine so it'd be good to have more than one tester.

Testing. Is there any way to log the trades to a file? Currently it's just displaying on the console.


look in the "bin" subfolder at the shell scripts (not sure if you're using linux or not) for inspiration...

note that there is a windows port of the "tee" command available here:

http://gnuwin32.sourceforge.net/packages/coreutils.htm

alternatively, using the 100% microsoft-provided windows powershell "tee-object"
(tee-object even has similar syntax and can be abbreviated "tee" but requires using powershell)

http://technet.microsoft.com/en-us/library/hh849937.aspx

I am using linux, I looked at the 4 scripts in the bin folder but they seem to assume there are log files in the log directory. Mine is empty all I get is console messages and no saved logs at all. I have the adviceLogger enabled. I see the launch script with the tee command is that the only method?


sr. member
Activity: 369
Merit: 250
  • verbose github changelog (showing the actual code changes)

    Quote from: investopedia.com DEMA explanation
    As Mulloy explains in his original article, "the DEMA is not just a double EMA with twice the lag time of a single EMA, but is a composite implementation of single and double EMAs producing another EMA with less lag than either of the original two."

    In other words, the DEMA is not simply two EMAs combined, or a moving average of a moving average, but is a calculation of both single and double EMAs.

    I've been busy today Smiley

    Whee!!!
    (yay calculus & momentum-based calculations)

    Long story short, there's a new method / algorithm I'll be testing for several days. I named it x2MACD since it's a MACD modified to use the DEMA indicator ... Also, there was a filename conflict because for some reason there's code in files named DEMA.js already in the "methods" directory of gekko (old, legacy code) but the algorithm it implements is completely unrelated to Patrick Mulloy's work back in the 90s.
sr. member
Activity: 369
Merit: 250
How come it says cex.io trading fee will be: 0.75%? cex.io fee is 0.2% usually.

Actually, that workaround is probably no longer needed...

If anyone wants to test this prerelease version (intentionally NOT flagged as "latest") I'd appreciate it:

https://github.com/kuzetsa/gekko/releases/tag/microtrade

I've had it running for a few minutes, but other people are probably using different settings than mine so it'd be good to have more than one tester.

Testing. Is there any way to log the trades to a file? Currently it's just displaying on the console.


look in the "bin" subfolder at the shell scripts (not sure if you're using linux or not) for inspiration...

note that there is a windows port of the "tee" command available here:

http://gnuwin32.sourceforge.net/packages/coreutils.htm

alternatively, using the 100% microsoft-provided windows powershell "tee-object"
(tee-object even has similar syntax and can be abbreviated "tee" but requires using powershell)

http://technet.microsoft.com/en-us/library/hh849937.aspx
sr. member
Activity: 252
Merit: 250
How come it says cex.io trading fee will be: 0.75%? cex.io fee is 0.2% usually.

Actually, that workaround is probably no longer needed...

If anyone wants to test this prerelease version (intentionally NOT flagged as "latest") I'd appreciate it:

https://github.com/kuzetsa/gekko/releases/tag/microtrade

I've had it running for a few minutes, but other people are probably using different settings than mine so it'd be good to have more than one tester.

Testing. Is there any way to log the trades to a file? Currently it's just displaying on the console.
legendary
Activity: 1708
Merit: 1000
Reality is stranger than fiction
So can someone suggest me parameter values for use with bitstamp? eg EMA? I am new to trading.

This chart from the "Goomboo's Journal" thread has a nice chart showing examples of how the simulations worked out based on the data they personally backtested against.

The EMA settings themselves are based on TA (technical analysis) theory, so you might be able to figure out how certain settings perform by looking at historical data using a charting tool which supports TA indicators such as the charts provided on:
...

Thank you very much for your answer. I need to study first and try out cex.io
sr. member
Activity: 369
Merit: 250
How come it says cex.io trading fee will be: 0.75%? cex.io fee is 0.2% usually.

Actually, that workaround is probably no longer needed...

If anyone wants to test this prerelease version (intentionally NOT flagged as "latest") I'd appreciate it:

https://github.com/kuzetsa/gekko/releases/tag/microtrade

I've had it running for a few minutes, but other people are probably using different settings than mine so it'd be good to have more than one tester.
full member
Activity: 227
Merit: 100
Well I'm now using your modified Gekko, so far so good.

Though as I've only got 16GHS to play with its slow going, I've pushed another 60GHS from hardware to compensate.

So, I'm impressed by what you've done in such a short space of time.
Keep up the good work, and if there’s a place for some btc contributions feel free to post :-)
As soon as I have some spare btc I'll bung you a donation. Grin

Crypto
sr. member
Activity: 369
Merit: 250
So can someone suggest me parameter values for use with bitstamp? eg EMA? I am new to trading.

This chart from the "Goomboo's Journal" thread has a nice chart showing examples of how the simulations worked out based on the data they personally backtested against.

The EMA settings themselves are based on TA (technical analysis) theory, so you might be able to figure out how certain settings perform by looking at historical data using a charting tool which supports TA indicators such as the charts provided on:

bitcoin wisdom's "bitstamp" charts
(if you look under settings, MACD is a popular choice, but it doesn't have all the same ones as the example ones included in gekko.)

Also, note the following:

  • gekko currently does not support backtesting, and hasn't supported backtesting for several months
  • the fork I maintain only supports cex.io in a strict "reinvest only" mode, and won't work on bitstamp since "sell" is disabled in my fork
  • If you need support for anything other than cex.io, you'll have to use "not my fork" such as the main / original gekko code (open source, and MIT licensed which is why I was able to fork it and make my own version) but it still has some bugs since it hasn't been updated since March 2014



Gekko is free, and "out of the box" the default settings don't always work well...

... and it doesn't even work until you edit your config.js to enable this line at the bottom:

Quote from: gekko's config.js
// set this to true if you understand that Gekko will
// invest according to how you configured the indicators.
// None of the advice in the output is Gekko telling you
// to take a certain position. Instead it is the result
// of running the indicators you configured automatically.
//
// In other words: Gekko automates your trading strategies,
// it doesn't advice on itself, only set to true if you truly
// understand this.
//

config['I understand that Gekko only automates MY OWN trading strategies'] = false;

I'm not going to try to manage your portfolio for you (not for free, and without a suitable contract)
nor would I want to "basically be a liar" by promising the defaults are suitable for your needs  Undecided
sr. member
Activity: 369
Merit: 250


(I was personally trying to use gekko to reinvest using micro-trades much closer to the exchange-enforced minimum 0.000001 GHS, and the granularity was causing my fees to sometimes be much much higher, sometimes 5%, 10%)



TL;DR

* Granularity causes rounding errors on the fees when you're reinvesting tiny amounts with micro trades...

Specifically: The "1 satoshi" granularity causes issues. (The exchange rounds up to the next whole satoshi, and it's a common practice never waive the fee under any circumstances.)

Interesting problem, I wouldn't have even thought about it if you hadn't explained it. Didn't realize it has so much effect.



Yeah, as you can see from some examples I provided from live trades (when I was working on bugfixes and testing over the weekend), when the fee is less than 5 satoshi, the granularity starts to make the rounding errors worse very quickly.
legendary
Activity: 1708
Merit: 1000
Reality is stranger than fiction
So can someone suggest me parameter values for use with bitstamp? eg EMA? I am new to trading.
sr. member
Activity: 252
Merit: 250


(I was personally trying to use gekko to reinvest using micro-trades much closer to the exchange-enforced minimum 0.000001 GHS, and the granularity was causing my fees to sometimes be much much higher, sometimes 5%, 10%)



TL;DR

* Granularity causes rounding errors on the fees when you're reinvesting tiny amounts with micro trades...

Specifically: The "1 satoshi" granularity causes issues. (The exchange rounds up to the next whole satoshi, and it's a common practice never waive the fee under any circumstances.)

Interesting problem, I wouldn't have even thought about it if you hadn't explained it. Didn't realize it has so much effect.

sr. member
Activity: 369
Merit: 250
Fixed a bug with the "enforced" state (old cex.io-only reinvest mode) where the code had some poorly defined behavior which could cause a stuck state with no possible exit condition. Also, spent the last 30-45 minutes auditing code in proximity to the now-fixed bug, and updated the release notes with the specific details in:

https://github.com/kuzetsa/gekko/releases/tag/critical.bugfix, which is now the latest release as of:
2014 June 25th 22:00 (local NY time)



... And https://github.com/kuzetsa/gekko/releases/latest now points to the "critical.bugfix" release.

Thanks for the update.

How come it says cex.io trading fee will be: 0.75%? cex.io fee is 0.2% usually.


It's a safety margin Smiley

I was able to get more consistent behavior with a fee setting of 0.75% (without having to go to a higher fee for an even larger safety margin) only after I changed gekko's default minimum GHS trade to a higher value than the minimum allowed by cex.io policies: Orders are considered valid as small as 6 decimal places (0.000001 GHS)

At the 0.000001 GHS micro-trading level, the actual fee (due to *granularity) will sometimes be absurdly high... It's really not a bug with the exchange's fee system, or anything "wrong" with their policy to let people do micro-trades where the rounding error / granularity issue is quite bad.



Example data:

Code:
2014-06-26 @ 06:14:43, Fee: 0.00000004, Bought 0.00199889 GHS at 0.0075191 BTC
2014-06-26 @ 06:14:43, -0.00001508 BTC (actual fee, 0.26525%)
2014-06-26 @ 00:50:43, Fee: 0.00000003, Bought 0.00198139 GHS at 0.00753505 BTC
2014-06-26 @ 00:50:43, -0.00001496 BTC (actual fee, 0.20053%)
2014-06-26 @ 00:24:47, Fee: 0.00000003, Bought 0.00195676 GHS at 0.00752258 BTC
2014-06-26 @ 00:24:47, -0.00001475 BTC (actual fee, 0.2028%)
2014-06-25 @ 23:51:34, Fee: 0.00000003, Bought 0.00191964 GHS at 0.00753259 BTC
2014-06-25 @ 23:51:34, -0.00001449 BTC (actual fee, 0.207039%)
2014-06-25 @ 23:23:20, Fee: 0.00000003, Bought 0.00172432 GHS at 0.00749274 BTC
2014-06-25 @ 23:23:20, -0.00001295 BTC (actual fee, 0.23166%)

--- yesterday's (unrelated) critical bugfix ---

Code:
*** the price on this trade, and others was "not good"

2014-06-25 @ 20:39:11, Fee: 0.00000003, Bought 0.00174368 GHS at 0.00752997 BTC
2014-06-25 @ 20:39:11, -0.00001316 BTC (actual fee, 0.22796%)
...etc. etc. etc.

--- historical data on smaller trades ---

Code:
2014-06-23 @ 05:55:23, Fee: 0.00000001, Bought 0.00033359 GHS at 0.00746761 BTC
2014-06-23 @ 05:55:23, -0.00000252 BTC (actual fee, 0.396825%)
2014-06-23 @ 08:54:15, Fee: 0.00000001, Bought 0.00029047 GHS at 0.00744862 BTC
2014-06-23 @ 08:54:15, -0.00000219 BTC (actual fee, 0.456621%)
2014-06-23 @ 10:40:36, Fee: 0.00000001, Bought 0.00017371 GHS at 0.00748319 BTC
2014-06-23 @ 10:40:36, -0.00000131 BTC (actual fee, 0.7633%)
2014-06-23 @ 13:29:47, Fee: 0.00000001, Bought 0.00010602 GHS at 0.00745005 BTC
2014-06-23 @ 13:29:47, -0.00000080 BTC (actual fee, 1.25%)
2014-06-23 @ 17:27:56, Fee: 0.00000001, Bought 0.00026981 GHS at 0.00748623 BTC
2014-06-23 @ 17:27:56, -0.00000203 BTC (actual fee, 0.49261%)
2014-06-23 @ 21:19:55, Fee: 0.00000001, Bought 0.00012709 GHS at 0.00747413 BTC
2014-06-23 @ 21:19:55, -0.00000096 BTC (actual fee, 1.04167%)
2014-06-23 @ 21:40:49, Fee: 0.00000001, Bought 0.00030082 GHS at 0.007479 BTC
2014-06-23 @ 21:40:49, -0.00000226 BTC (actual fee, 0.442478%)
2014-06-23 @ 22:27:46, Fee: 0.00000001, Bought 0.00010293 GHS at 0.00748 BTC
2014-06-23 @ 22:27:46, -0.00000078 BTC (actual fee, 1.282051%)
2014-06-23 @ 23:11:45, Fee: 0.00000001, Bought 0.00024405 GHS at 0.007498 BTC
2014-06-23 @ 23:11:45, -0.00000184 BTC (actual fee, 0.543478%)
2014-06-24 @ 01:53:20, Fee: 0.00000001, Bought 0.00028878 GHS at 0.007514 BTC
2014-06-24 @ 01:53:20, -0.00000218 BTC (actual fee, 0.4587%)
2014-06-24 @ 02:32:54, Fee: 0.00000001, Bought 0.00029409 GHS at 0.00751441 BTC
2014-06-24 @ 02:32:54, -0.00000222 BTC (actual fee, 0.450450450450%)

^ note that none of those trades are even anywhere close to the minimum 0.000001 GHS order allowed by cex.io



* Granularity, and the resulting "rounding errors" are sometimes frustrating, but since the fees are paid in whole satoshi amounts there's not much I can do. I set it at 0.75% because I didn't want there to be (as many) errors related to "insufficient funds" during small trades (and later, made some tweaks to gekko's fee calculation and rounding code because it's common for granularity / rounding errors to be done in the favor of the exchange or merchant)

Granularity is the sort of thing some users might not think about or care about, and someone will probably go in and set their minimum trade to the actual, exchange-enforced minimum 0.000001 GHS value, because the user(s) might feel a compelling urge to reinvest so aggressively that the safety margins still might not be enough.

(I was personally trying to use gekko to reinvest using micro-trades much closer to the exchange-enforced minimum 0.000001 GHS, and the granularity was causing my fees to sometimes be much much higher, sometimes 5%, 10%)



TL;DR

* Granularity causes rounding errors on the fees when you're reinvesting tiny amounts with micro trades...

Specifically: The "1 satoshi" granularity causes issues. (The exchange rounds up to the next whole satoshi, and it's a common practice never waive the fee under any circumstances.)
sr. member
Activity: 252
Merit: 250
Fixed a bug with the "enforced" state (old cex.io-only reinvest mode) where the code had some poorly defined behavior which could cause a stuck state with no possible exit condition. Also, spent the last 30-45 minutes auditing code in proximity to the now-fixed bug, and updated the release notes with the specific details in:

https://github.com/kuzetsa/gekko/releases/tag/critical.bugfix, which is now the latest release as of:
2014 June 25th 22:00 (local NY time)



... And https://github.com/kuzetsa/gekko/releases/latest now points to the "critical.bugfix" release.

Thanks for the update.

How come it says cex.io trading fee will be: 0.75%? cex.io fee is 0.2% usually.
sr. member
Activity: 369
Merit: 250
Fixed a bug with the "enforced" state (old cex.io-only reinvest mode) where the code had some poorly defined behavior which could cause a stuck state with no possible exit condition. Also, spent the last 30-45 minutes auditing code in proximity to the now-fixed bug, and updated the release notes with the specific details in:

https://github.com/kuzetsa/gekko/releases/tag/critical.bugfix, which is now the latest release as of:
2014 June 25th 22:00 (local NY time)



... And https://github.com/kuzetsa/gekko/releases/latest now points to the "critical.bugfix" release.
sr. member
Activity: 369
Merit: 250
Point of this? Just a suggestion, if you are going to concentrate on a solely CEX.IO for your own fork of gekko, it might be a nice function to have where you never sell GHS but take advantage of market dumps to get maximum ghs for your generated BTC.

Yep, I already got it working exactly like that, and I'll be pushing a commit with the new version to my repo soon since I seem to have squished all the relevant bugs which I've been able to find (less than 10 bugs, and most of them were related to inconsistent formatting / display / logging of information)



Edited to add:

And here it is: https://github.com/kuzetsa/gekko/releases/tag/initial.fork.2014.june
DO NOT USE!!! (see next post for more info)


Note that the current version of this fork can always be found at:

https://github.com/kuzetsa/gekko/releases/latest

which, as of 2014 June 25th 15:52, the current version is still:

" initial.fork.2014.june "
Pages:
Jump to: