Bitcoin Forum
May 03, 2024, 06:12:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 »
  Print  
Author Topic: Gekko - a javascript trading bot and backtesting platform  (Read 147805 times)
steganos
Newbie
*
Offline Offline

Activity: 44
Merit: 0



View Profile
June 15, 2013, 04:23:51 AM
 #101

Thank you. That is a good thing to be aware of.
1714759922
Hero Member
*
Offline Offline

Posts: 1714759922

View Profile Personal Message (Offline)

Ignore
1714759922
Reply with quote  #2

1714759922
Report to moderator
1714759922
Hero Member
*
Offline Offline

Posts: 1714759922

View Profile Personal Message (Offline)

Ignore
1714759922
Reply with quote  #2

1714759922
Report to moderator
1714759922
Hero Member
*
Offline Offline

Posts: 1714759922

View Profile Personal Message (Offline)

Ignore
1714759922
Reply with quote  #2

1714759922
Report to moderator
TalkImg was created especially for hosting images on bitcointalk.org: try it next time you want to post an image
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Timbo925
Sr. Member
****
Offline Offline

Activity: 352
Merit: 250



View Profile
June 15, 2013, 12:33:03 PM
Last edit: June 15, 2013, 01:17:56 PM by Timbo925
 #102

Does indeed seem something weird with the way of calculation. My trade was calculated like this (have to add +2 hours because of gekko runs in GMT and website with data is GMT+2)
Code:
2013-06-15 12:17:04 (INFO):     ADVICE is to HOLD @ 101.940 (-0.302)
2013-06-15 12:17:04 (INFO):     (PROFIT REPORT) original simulated balance:      203.171 USD
2013-06-15 12:17:04 (INFO):     (PROFIT REPORT) current simulated balance:       203.171 USD
2013-06-15 12:17:04 (INFO):     (PROFIT REPORT) simulated profit:                0.000 USD (0.000%)

If you look at the data around this time all trades in the last 5 minutes are above 102. The way the EMA is calculated I think mtgox gives indeed back older information if you ask for the most recent trade like you pointed out.

I'll add the next tick to do give some more data.

Code:
14:19:32 103.10297 1.48000
14:19:32 103.10296 0.14511
14:19:04 103.10295 2.00000
14:18:39 103.34000 0.25152
14:17:37 103.10295 0.17904
14:16:20 102.60000 3.55653
14:16:19 102.60105 1.17900
14:16:19 102.64001 1.57890
14:15:29 102.64000 0.36969
14:15:04 102.64000 0.02010
14:15:00 102.70000 0.61020
14:14:52 103.36535 0.75617
14:14:52 102.97000 0.25382
14:12:56 102.71000 0.02010
14:12:54 102.75000 0.95498
14:12:54 102.78000 1.21879
14:12:53 102.90252 0.00317
14:12:49 103.38000 1.00000
14:12:49 103.36535 0.01000
14:11:39 103.44000 0.25523
14:11:29 103.44000 0.76239
14:11:29 103.43210 2.56137
14:11:19 103.43210 5.43862
14:11:19 103.43200 0.10000
14:11:19 103.40000 0.79500
14:11:19 103.38150 0.01000
14:10:55 102.90252 0.20998

Edit New Tick:
Didn't buy because difference not big enough.

I use http://bitcoinwisdom.com/ for the ticker information and looks like they group their results in some way.
This might explain the difference because if you group all results you get a weighted average compared to a normal average of the latest trades.
 
Code:
2013-06-15 13:12:04 (INFO):     ADVICE is to HOLD @ 103.103 (0.004)
2013-06-15 13:12:04 (INFO):     (PROFIT REPORT) original simulated balance:      203.171 USD
2013-06-15 13:12:04 (INFO):     (PROFIT REPORT) current simulated balance:       203.171 USD
2013-06-15 13:12:04 (INFO):     (PROFIT REPORT) simulated profit:                0.000 USD (0.000%)

Code:
15:14:36 101.66000 0.02500
15:13:43 101.75101 0.84800
15:12:37 102.00000 5.39634
15:06:24 102.15000 24.8300
15:06:24 102.15100 4.98170
15:06:24 102.19991 0.10000
15:06:24 102.30000 0.96505
15:06:24 102.38000 4.00000
15:06:23 102.50000 0.00049
15:06:23 102.50000 46.5663
15:06:21 102.50000 42.2023
15:06:21 102.50190 0.14340
15:06:21 102.52000 0.01950
15:06:21 102.56000 11.1833
15:06:21 102.79990 0.01000
15:05:52 102.56000 0.01000
15:05:51 102.56000 0.01000
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
June 17, 2013, 11:15:38 PM
 #103

I just did a big internal update to Gekko: Gekko now calculates candles under the hood and uses the close as a price indicator. AFAIK this is a way more standard way to calculate indicators based on price. This may stabilise the calculated prices.

This is a big step towards implementing a system that supports over a 100 different indicators (ta-lib) because it needs to get candles fed. It also makes it much easier to get backtesting rolling.

It would be awesome if anyone could let it spin for a testrun (I would advice downloading this in addition to the old version, as it's pretty new and the code really needs to get solid. I would advice against real trading for now). If anyone could glance at the (much more readable) code that would be awesome.

I use http://bitcoinwisdom.com/ for the ticker information and looks like they group their results in some way.
This might explain the difference because if you group all results you get a weighted average compared to a normal average of the latest trades.

I am desperately searching for the common way to calculate price based on trades (in the new version I calculate candles and use the close as a price indicator). You could check the new version out to see wether it better matches other services Smiley

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
steganos
Newbie
*
Offline Offline

Activity: 44
Merit: 0



View Profile
June 17, 2013, 11:24:07 PM
 #104

The latest version quites for me immediately after sending a notification email:

Quote
2013-06-17 17:24:58 (DEBUG):    fetching new trades for new bucket at Mt. Gox
2013-06-17 17:25:01 (DEBUG):    calculated candle: 0
2013-06-17 17:25:01 (DEBUG):    calced EMA properties for new candle:
2013-06-17 17:25:01 (DEBUG):             short ema 101.493
2013-06-17 17:25:01 (DEBUG):             long ema 101.179
2013-06-17 17:25:01 (DEBUG):             diff ema 0.310
2013-06-17 17:25:01 (DEBUG):    we are currently in uptrend (0.310)
2013-06-17 17:25:01 (INFO):     ADVICE is to BUY @ 101.837 (0.310)
~/gekko $

whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
June 17, 2013, 11:48:38 PM
 #105

The latest version quites for me immediately after sending a notification email:

Oops, fixed now Smiley

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
June 30, 2013, 12:39:41 AM
Last edit: June 30, 2013, 10:15:29 AM by whydifficult
 #106

Big update: Gekko now supports backtesting!

Please be warned that this code is in early development stage, I would not advice to act on the computed results just yet.

This does mean that I want all the feedback I can get so that the feature becomes stable. In short you need precalculated candles in csv (which you can get in my other topic) and the latest version of Gekko. You can find more detailed information in the docs.

And the result looks something like this (ran on the hourly USD candles):

Quote
(...)
2013-06-30 02:35:24 (INFO):   ADVICE is to SELL @ 115.750 (-0.252)   at    2013-05-11 11:00:00
2013-06-30 02:35:24 (INFO):   ADVICE is to BUY @ 117.300 (0.287)   at    2013-05-13 12:00:00
2013-06-30 02:35:24 (INFO):   ADVICE is to SELL @ 114.480 (-0.461)   at    2013-05-14 23:00:00
2013-06-30 02:35:24 (INFO):   ADVICE is to BUY @ 115.500 (0.315)   at    2013-05-16 02:00:00
2013-06-30 02:35:24 (INFO):   ADVICE is to SELL @ 120.100 (-0.253)   at    2013-05-19 18:00:00
2013-06-30 02:35:24 (INFO):   ADVICE is to BUY @ 124.440 (0.257)   at    2013-05-23 03:00:00


2013-06-30 02:35:24 (INFO):         WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2013-06-30 02:35:24 (INFO):         WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!


2013-06-30 02:35:24 (INFO):   (PROFIT REPORT) start price:          17.51001
2013-06-30 02:35:24 (INFO):   (PROFIT REPORT) end price:          125.44
2013-06-30 02:35:24 (INFO):   (PROFIT REPORT) original simulated balance:    116.339 USD
2013-06-30 02:35:24 (INFO):   (PROFIT REPORT) current simulated balance:    1695.713 USD
2013-06-30 02:35:24 (INFO):   (PROFIT REPORT) simulated profit:       1579.374 USD (1357.562%)

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
medji
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile
June 30, 2013, 06:26:05 AM
 #107

Profit should be compared vs a simple hold strategy, also it should take fees into account.
And maybe begin with a balanced amount of btc and usd.
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
June 30, 2013, 10:08:35 AM
 #108

Thanks for your feedback!

Profit should be compared vs a simple hold strategy

That's a valid point, currently Gekko logs the start price and the end price, but doesn't calculate the % increase between the two (which you would have when doing a buy and hold). I will add this!

also it should take fees into account.

It does. You can configure the trading fee in the profit calculator part of the configuration. The default is 0.6% because the candles I prepared are from Mt. Gox.

And maybe begin with a balanced amount of btc and usd.

On default Gekko starts out with 100 currency (USD) and 1 asset (BTC), but again this is based on the configuration. You can edit this in the simulation balance.

I will update the docs so this is clear without reading the configuration files.

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
June 30, 2013, 10:52:36 PM
 #109

Is it me, or basically you must call Gekko every single time you want "advice"? I thought that it looped constantly and checking every few seconds what's up and reporting back, but I left it for a few minutes and saw nothing printed besides the initial information even with debug logging enabled.

This on Bitstamp.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
Timbo925
Sr. Member
****
Offline Offline

Activity: 352
Merit: 250



View Profile
July 01, 2013, 06:37:25 AM
 #110

Is it me, or basically you must call Gekko every single time you want "advice"? I thought that it looped constantly and checking every few seconds what's up and reporting back, but I left it for a few minutes and saw nothing printed besides the initial information even with debug logging enabled.

This on Bitstamp.

In the settings their is a time interval. Gekko will check every time, once the time interval is over, and give you advice. So if you want almost instant trading you set the time interval to something like 15 min.
I wouldn't recommend this because you will have much more crossovers and the fees will kill most of you profits.
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
July 02, 2013, 01:47:18 PM
 #111

When real trading is enabled, is there some kind of limit I can impose on it so it uses a small amount of my money for trading instead of my whole balance?
Again, for Bitstamp.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
July 02, 2013, 04:18:49 PM
 #112

When real trading is enabled, is there some kind of limit I can impose on it so it uses a small amount of my money for trading instead of my whole balance?
Again, for Bitstamp.

At this moment not yet, it is on my todo list though!

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
July 03, 2013, 11:10:37 AM
 #113

I think that backtesting is a very important part of Gekko and trading on TA in general so I'm trying to make a really solid backtesting platform. But unfortunately I don't have any experience in backtesting so I could really use help:

  • Are you experienced in trading? I created a topic in the speculation board about backtesting in general, what features does a backtesting platform need and how do I go about making a solid one?
  • Are you a programmer with experience in javascirpt? The code needs to get checked! Because as Linus said "given enough eyeballs, all bugs are shallow".
  • Also if you are using it all feedback is appreciated, and if you are not for a specific reason: what do you want improved / changed?

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
July 03, 2013, 02:20:23 PM
 #114

On Bitstamp, using these settings

Quote
config.EMA = {
  // timeframe per candle
  interval: 60, // in minutes
  // EMA weight (α)
  // the higher the weight, the more smooth (and delayed) the line
  short: 10,
  long: 21,
  // amount of candles to remember and base initial EMAs on
  candles: 200,
  // the difference between the EMAs (to act as triggers)
  sellTreshold: -0.25,
  buyTreshold: 0.25
};

When the price was 87.50 it told me to buy, but obviously I didn't and next thing I know, the price is 84.98 so essentially it should have told me to sell.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
July 04, 2013, 10:12:46 AM
 #115

Hmm that is strange, but there have been some strange things happening in the market in the last couple of days.

I will try to rerun Gekko on on the past few weeks with your settings to see what I get. But remember that Gekko tries to predict trends and it can be wrong sometimes. If you set it up last year the total would have turned up profitable (can't promise anything about the future).

Gekko a nodejs bitcoin trading bot!
Realtime Bitcoin Globe - visualizing all transactions and blocks
Tip jar (BTC): 1KyQdQ9ctjCrGjGRCWSBhPKcj5omy4gv5S
cloudstrife07
Newbie
*
Offline Offline

Activity: 41
Merit: 0



View Profile
July 05, 2013, 10:21:37 AM
Last edit: July 05, 2013, 05:16:02 PM by cloudstrife07
 #116

Can i use this to trade LTC at BTC-e?
jago25_98
Hero Member
*****
Offline Offline

Activity: 900
Merit: 1000


Crypto Geek


View Profile WWW
July 05, 2013, 10:58:39 AM
 #117

How do you know it's still working? I ran it, it gave one trade advice... and nothing else since...

Bitcoiner since the early days. Crypto YouTube Channel: Trading Nomads | Analyst | News Reporter | Bitcoin Hodler | Support Freedom of Speech!
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
July 05, 2013, 12:12:02 PM
 #118

How do you know it's still working? I ran it, it gave one trade advice... and nothing else since...
By default it runs every hour.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
MobGod
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500



View Profile WWW
July 05, 2013, 06:36:48 PM
 #119

can anyone help me this is all i see in terminal, i thought it was suppose to open a web page or something
   I'm gonna make you rich, Bud Fox.
2013-07-05 14:31:23 (INFO):   Let me show you some Exponential Moving Averages.


2013-07-05 14:31:23 (INFO):   Using normal settings to monitor the live market
2013-07-05 14:31:23 (INFO):   NOT trading with real money
2013-07-05 14:31:23 (INFO):   Profit reporter active on simulated balance
2013-07-05 14:31:23 (INFO):   Calculating EMA on historical data...
2013-07-05 14:32:20 (INFO):   ADVICE is to SELL @ 68.332 (-2.952)

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
July 05, 2013, 07:13:36 PM
 #120

Nope, no web page.

Anyway, using Bitstamp all of a sudden, everything is NaN

Quote
2013-07-05 17:22:44 (INFO):     I'm gonna make you rich, Bud Fox.
2013-07-05 17:22:44 (INFO):     Let me show you some Exponential Moving Averages.


2013-07-05 17:22:44 (INFO):     Using normal settings to monitor the live market
2013-07-05 17:22:44 (INFO):     NOT trading with real money
2013-07-05 17:22:44 (INFO):     Profit reporter active on simulated balance
2013-07-05 17:22:44 (INFO):     Calculating EMA on historical data...
2013-07-05 17:22:46 (INFO):     ADVICE is to HOLD @ 70.750 (NaN)
2013-07-05 18:22:45 (INFO):     ADVICE is to HOLD @ 70.290 (NaN)
2013-07-05 19:22:45 (INFO):     ADVICE is to HOLD @ 71.590 (NaN)
2013-07-05 20:22:45 (INFO):     ADVICE is to HOLD @ 69.970 (NaN)
2013-07-05 21:22:45 (INFO):     ADVICE is to HOLD @ 67.990 (NaN) <---price dropping, no advice to SELL

Quote
2013-07-05 22:12:50 (DEBUG):    calced EMA properties for new candle:
2013-07-05 22:12:50 (DEBUG):             short ema NaN
2013-07-05 22:12:50 (DEBUG):             long ema NaN
2013-07-05 22:12:50 (DEBUG):             diff ema NaN
2013-07-05 22:12:50 (DEBUG):    calculated candle: 2
2013-07-05 22:12:50 (DEBUG):    calced EMA properties for new candle:
2013-07-05 22:12:50 (DEBUG):             short ema NaN
2013-07-05 22:12:50 (DEBUG):             long ema NaN
2013-07-05 22:12:50 (DEBUG):             diff ema NaN
2013-07-05 22:12:50 (DEBUG):    calculated candle: 1
2013-07-05 22:12:50 (DEBUG):    calced EMA properties for new candle:
2013-07-05 22:12:50 (DEBUG):             short ema NaN
2013-07-05 22:12:50 (DEBUG):             long ema NaN
2013-07-05 22:12:50 (DEBUG):             diff ema NaN
2013-07-05 22:12:50 (DEBUG):    fetching new trades for new bucket at Bitstamp
2013-07-05 22:12:50 (DEBUG):    calculated candle: 0
2013-07-05 22:12:50 (DEBUG):    calced EMA properties for new candle:
2013-07-05 22:12:50 (DEBUG):             short ema NaN
2013-07-05 22:12:50 (DEBUG):             long ema NaN
2013-07-05 22:12:50 (DEBUG):             diff ema NaN
2013-07-05 22:12:50 (DEBUG):    we are currently not in an up or down trend @ 66.740 (NaN)
2013-07-05 22:12:50 (INFO):     ADVICE is to HOLD @ 66.740 (NaN)

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
Pages: « 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!