Bitcoin Forum
May 04, 2024, 08:05:30 AM *
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)
gambitv
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
May 27, 2013, 09:05:38 AM
 #41

Hello,
Interesting project. Are you able to add a little obscure exchange to your list. The virwox exchange allows USD>SLL>BTC as well as some other currencies. They have APIs and JSON format as well.

The good thing about this exchange is it makes it easy for 'beginners' to take a look at bitcoins with their credit card or PayPal account immediately.

The bad thing is, its usually more expensive than MtGox prices if you are going for Market Order. If you have patience, the Limit Order can take a while to full.

Cheers
G

The stock market today is a war zone, where algobots fight each other over pennies, millions of times a second.
1714809930
Hero Member
*
Offline Offline

Posts: 1714809930

View Profile Personal Message (Offline)

Ignore
1714809930
Reply with quote  #2

1714809930
Report to moderator
1714809930
Hero Member
*
Offline Offline

Posts: 1714809930

View Profile Personal Message (Offline)

Ignore
1714809930
Reply with quote  #2

1714809930
Report to moderator
Even in the event that an attacker gains more than 50% of the network's computational power, only transactions sent by the attacker could be reversed or double-spent. The network would not be destroyed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714809930
Hero Member
*
Offline Offline

Posts: 1714809930

View Profile Personal Message (Offline)

Ignore
1714809930
Reply with quote  #2

1714809930
Report to moderator
Lucko
Hero Member
*****
Offline Offline

Activity: 826
Merit: 1000



View Profile
May 27, 2013, 10:25:46 AM
Last edit: May 27, 2013, 10:46:46 AM by Lucko
 #42

Hello,
Interesting project. Are you able to add a little obscure exchange to your list. The virwox exchange allows USD>SLL>BTC as well as some other currencies. They have APIs and JSON format as well.

The good thing about this exchange is it makes it easy for 'beginners' to take a look at bitcoins with their credit card or PayPal account immediately.

The bad thing is, its usually more expensive than MtGox prices if you are going for Market Order. If you have patience, the Limit Order can take a while to full.

Cheers
G
It is not a bad idea. They have also NMC, IXC and DVC that I get out of my mining rigs as a by-product...

Made a mistake in name I thought you are talking about Vircurex
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
May 27, 2013, 12:10:24 PM
 #43

Hello,
Interesting project. Are you able to add a little obscure exchange to your list. The virwox exchange allows USD>SLL>BTC as well as some other currencies. They have APIs and JSON format as well.

The good thing about this exchange is it makes it easy for 'beginners' to take a look at bitcoins with their credit card or PayPal account immediately.

The bad thing is, its usually more expensive than MtGox prices if you are going for Market Order. If you have patience, the Limit Order can take a while to full.

Cheers
G

I am currently stabilising Gekko so that it can correctly handle all current exchanges (with decent error handling, and making sure all orders are filled). When this is done it will be easy to add more exchanges to Gekko relatively easy. I will put this exchange on my list and will research it when this moment is there.

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
May 28, 2013, 10:12:09 PM
Last edit: May 28, 2013, 10:23:53 PM by whydifficult
 #44

It is now possible to set a currency for Mt. Gox, for advice as well as real trading (as well as a lot of minor bug fixes)!

Do note that there currently is a bug in a dependency (caused by none other then myself) that will mess up all trades at Mt. Gox. Refer to this issue for the whole story and how to fix it!

Edit: I have also written some documentation explaining how to configure real trading in more detail. This will hopefully demystify a lot around how Gekko handles real trading.

https://github.com/askmike/gekko/blob/master/docs/Configuring_gekko.md

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

Activity: 42
Merit: 0



View Profile
May 29, 2013, 05:02:32 AM
 #45

This would be very cool if it was made.

I can see this becoming very big and popular among Bitcoin users.

Keep up the good work!
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
May 29, 2013, 01:15:40 PM
 #46

This would be very cool if it was made.

I can see this becoming very big and popular among Bitcoin users.

Keep up the good work!

Thanks, that's what I am hoping to achieve with Gekko. Also to raise the bar for existing trade bots. (though it is not quite at a decent level itself right now imo)

Github user lockdoc has added a bunch of information to Gekko that explains how you can run Gekko silently forever:

Running Gekko headless

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

Activity: 196
Merit: 100



View Profile
May 30, 2013, 03:53:47 AM
Last edit: May 30, 2013, 04:10:20 AM by gambitv
 #47

I've pulled it down for a look. I have done a simple comment on the buy/sell in 'live' settings to just drop an 'info' message with what it would do. I turned on debug as well.

But I am stalled at the start. It gets to the 'fetching exchange...' message, then hangs.

I check task manager to take a peek at network traffic, and no change there. I suspect it has to do with the Mt Gox key and secret. Bit confused here. Are both keys the 'unreadable' encrypted output, or is one of them the original plain text you entered to generate the key. I took the same keys I used for the Chrome Addon bot, which work fine in that.

I am on Windows 7 Home Premium.


EDIT/NOTE I see he just put a patch up in git for this very reason!

" askmike commented on 7574901 4 hours ago

Here I am again with a bug fix Smiley The fetchTrades method was silently failing because the callback never got passed... "

The stock market today is a war zone, where algobots fight each other over pennies, millions of times a second.
gambitv
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
May 30, 2013, 05:30:11 AM
 #48

OK, new to Git here. I followed the Installing Gekko on windows guide the first time round.

Now how to I update the dependencies, since one has changed in : gekko-master\node_modules\mtgox-apiv2>.

I took the manual approach and applied his latest patch by doing it myself, but I am a bit worried other changes that happen in this library will be missed.

EDIT:
Since we used : npm install to get dependencies.

I did a npm help.

This revealed npm update command.

Now I am golden. Thanks me for the help.

The stock market today is a war zone, where algobots fight each other over pennies, millions of times a second.
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
May 30, 2013, 09:23:21 AM
 #49

OK, new to Git here. I followed the Installing Gekko on windows guide the first time round.

Now how to I update the dependencies, since one has changed in : gekko-master\node_modules\mtgox-apiv2>.

I took the manual approach and applied his latest patch by doing it myself, but I am a bit worried other changes that happen in this library will be missed.

EDIT:
Since we used : npm install to get dependencies.

I did a npm help.

This revealed npm update command.

Now I am golden. Thanks me for the help.

Awesome that you got it working!

For everyone one else facing problems: there is a new bug in the MtGox dependency yet again. Once my patch is accepted I will let Gekko use that version until I have checked all next updates myself. To get the latest version of Gekko running on Mt. Gox I think you have to apply this fix (in `node_modules/mtgox-apiv2/mtgox.js`) until it has been fixed upstream.

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

Activity: 2955
Merit: 1049


View Profile
May 30, 2013, 10:00:57 AM
 #50

on raspberry
Code:
npm ERR! Error: No compatible version found: bitstamp@'>=0.0.0- <0.1.0-'
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR!     at /usr/share/npm/lib/cache.js:408:5
npm ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230: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/xx/gekko/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.6.11+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/xx/gekko
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bitstamp@'>=0.0.0- <0.1.0-'
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
May 30, 2013, 10:35:15 AM
Last edit: May 31, 2013, 07:14:39 AM by whydifficult
 #51

Your node version is out of date, the Bitstamp module doesn't really require node 0.10 but other dependencies do. Could you try to update to 0.10.x?

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
May 30, 2013, 01:25:25 PM
Last edit: May 30, 2013, 03:51:24 PM by whydifficult
 #52

If your (older) version of Gekko is running smooth you can ignore this.

There are currently two bugs in dependencies of Gekko. I've submitted a fix for both but until these get merged you have to quickfix them yourself.

These bugs only effect your Gekko when you are watching either Mt. Gox or BTC-e.

You can read more in the readme.

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

Activity: 46
Merit: 0



View Profile
May 31, 2013, 04:53:21 PM
 #53

Hello,
I'm trying to write a new strategy method by modifying exponential-moving-averages.js;
it should work this way:
  • user defines three extra parameters: kP, kI, kD
  • each sample interval, calculate ema-difference (same way like before), let's call it diff[now]
  • Proportional section:
    • (if kP*diff[now] > 0) buy kP*diff[now] BTC
    • (if kP*diff[now] < 0) sell -kP*diff[now] BTC
  • Derivative section:
    • (if kD*(diff[now]-diff[now-1]) > 0) buy kD*(diff[now]-diff[now-1]) BTC
    • (if kD*(diff[now]-diff[now-1]) < 0) sell -kD*(diff[now]-diff[now-1]) BTC
  • Integrative section:
    • define integral=sum of the last 10 (or more) diffs (diff[now]+diff[now-1]+...+diff[now-9])
    • (if kI*integral > 0) buy kI*integral BTC
    • (if kI*integral < 0) sell -kI*integral BTC

(For those who know Control Theory, this should act as a PID controller, with diff(t) as input.)
I've done some simulations, and it should be profitable with a ranging market (like the last 30 days)
The question is:
do I have to mess with the advice function only? Or does the strategy file have to be completely rewritten?
Thank you
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
May 31, 2013, 06:50:23 PM
 #54

That's awsome! I don't quite understand the reasoning behind the math yet though.

I've written gekko so that it should be pretty modular: In theory you only have to create a new file and place it into method and enable it in the config. The easiest is to hack the current EMA method, but basically gekko currently expects this from a trading method:

  • Needs to be a file inside the method folder
  • It needs to expose an evenEmitter (see current method) so that Gekko can talk to it.
  • It needs to listen to `init` and the watcher object that follows.
  • It can use the `getTrades` method on the watcher to get data to analyze
  • It should not advice before the `start` event (from Gekko).
  • Gekko expects the method to emit the event advice whenever it advices a BUY, SELL or HOLD (with meta data)

I will write better documentation describing how to add new trading methods, similar to the documentation on how to add exchanges. If you need help just let me know, and in the meantime I am curious about the trading method. Could you maybe point me to some reading explaining the logic of the method?

EDIT:

if your method is similar to EMA in that it will fetch trades each candle / interval, calculate a bunch of numbers based on the latest price and advice based on those numbers it is the easiest to use the whole EMA method (but you can ofcourse rewrite it if you want).

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
May 31, 2013, 11:01:41 PM
 #55

I am slowly getting to a point where I think Gekko runs pretty stable. Here are a couple of features I've added in the last few days:

Gekko now uses a portfolio manager to calculate the orders more precise (auto trading at BTC-e and Bitstamp is much better)

In my testing it is pretty stable at selling and buying at all three exchanges (It did cost me some fee haha). It wil create an order if the balance is bigger than the minimal order size (different per exchange), check if the order gets filled, if not do it again, etc.

You can now pass a command line parameter to tell Gekko which config file to use

I use this so that I can easily watch and trade at all three exchanges at the same time using the same Gekko code (I copied the config multiple times). I also have multiple non-trading Gekkos running at different currencies at Mt. Gox (and Gekkos with different EMA settings at BTC/USD) to calculate the most profitable settings / currency exchange over time (backtesting is on the todo).

Code:
$ ps ax | grep gekko
10475 ?        Sl     0:02 node gekko.js
10486 ?        Sl     0:05 node gekko.js config=config-half
10489 ?        Sl     0:03 node gekko.js config=config-mini
14701 pts/0    Sl     0:01 node gekko.js config=bitstamp
15295 pts/0    Sl     0:02 node gekko.js config=config-btce
15354 pts/0    Sl     0:00 node gekko.js config=config-mtgox-GBP
15358 pts/0    Sl     0:01 node gekko.js config=config-mtgox-AUD
15381 pts/0    Sl     0:00 node gekko.js config=config-mtgox-CHF
15386 pts/0    Sl     0:00 node gekko.js config=config-mtgox-CNY
15392 pts/0    Sl     0:00 node gekko.js config=config-mtgox-RUB
15399 pts/0    D+     0:00 grep gekko

I used nohup to route Gekkos output to different log files. For more information about how to specify other config files or how to use nohup (or an alternative) check out the 'advanced features' documentation.

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

Activity: 46
Merit: 0



View Profile
June 01, 2013, 03:01:31 PM
Last edit: June 01, 2013, 04:09:13 PM by rikigst
 #56

That's awsome! I don't quite understand the reasoning behind the math yet though.
Could you maybe point me to some reading explaining the logic of the method?
Hem... Actually, I came up with this by myself. You see, it's only a step futher Goomboo's method: his and mine share the input signal (ema-diff), but the behaviour is different. Goomboo's one is acting like a Schmitt Trigger (http://en.wikipedia.org/wiki/Schmitt_trigger), as it has only three output states (BUY EVERYTHING, SELL EVERYTHING, HOLD).
After operating the chrome bot for a while, i noticed that useful information was given not only by the ema-diff current value (is it positive? negative? above/under some threshold?), but also its trend, too. For instance, when the price has a peak, the ema-diff derivative changes sign.
Since I'm an engineer in the field of Control Theory, I wondered if smoothening Goomboo's strategy worked. So, instead of brutally buying/selling everything, the strategy I came up with should gradually buy or sell small quantities of btc, depending on the current ema value, its variation, and its past history.

So I fetched Gox's historic data, and wrote a small piece of software which simulates this aforementioned PID (http://en.wikipedia.org/wiki/PID_controller) strategy. Since I didn't know which parameters would fit best, I ran multiple instancies with different values.
Behaviours similar to Goomboo's strategy can be achieved with positive kP,kD and kI parameters (with kD >> kP in order to sell at the top and buy at the bottom).
Finally, I discovered that the best outcomes (20-30% profit from 1st to 17th may) came with NEGATIVE kI and kD parameters.
In a few words, this strategy is good for ranging markets. It buys gradually when the price falls, and it sells when it rises. But it will not profit if the price rises (or falls) for too long. I will attach some simulation charts in a minute.

I've been searching for something similar on Google, but couldn't find anything. Perhaps it has been given some other name (other than PID, which is a term from a totally different field), and it uses some other different signal (or set of signals, multiple inputs give more information than one, see MACD).
But this one is very similar to the original one, and can be understood by almost everyone, as it's quite simple.
Any thoughts?
rikigst
Newbie
*
Offline Offline

Activity: 46
Merit: 0



View Profile
June 01, 2013, 05:25:36 PM
 #57

Here's an example. Parameters are kP = -70, kI = -10, kD= -470. Sample time is 120 minutes.

http://i43.tinypic.com/157zm1f.png

It basically sells when price raises, and buys when price falls. GRADUALLY.
Wallet starts with 1000$ (0 btcs) on May, 3rd, 00.00; ends with 1518$ worth of bitcoins today (0 usd).
whydifficult (OP)
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile WWW
June 01, 2013, 08:06:57 PM
 #58

I think I get the picture, thanks for the explanation. So if the bot detects a trend the advantage of this method vs EMA is that if the trend is not real the bot does not have gambled the full balance on it. Is that the advantage? Because when you know there is going to be an uptrend you want to buy asap, right?

When I'm done with the backtesting feature of Gekko it will also be a lot easier to test these methods on historical data.

There is a tiny practical problem if you want to implement this method into Gekko right now. Because it only knows EMA at the moment and thus only has to sell or buy everything at once I would need to adjust the way Gekko handles the advice from the method to the real orders. If I understand it correctly your method would advice at a given moment something like 'sell 10% of balance' (and fire these advices of multiple times during the trend). Is that true? In that case I will update Gekko so that your trading method can be implemented.

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

Activity: 28
Merit: 0


View Profile
June 01, 2013, 10:15:11 PM
 #59

Very interesting project, I'm testing it now, my thoughts about future development:

- please take a look at TA-lib for node: https://npmjs.org/package/talib - using those libraries may speed up development of other useful methods
- before that, it would be good to decide how Gekko will deal with multiple methods and possibly contradictory suggestions. Some kind of voting mechanism with user-defined weights? Neural network? Other? Maybe suggestion should look like: 10% SELL, 70% KEEP, 20% BUY - SO KEEP.
- how about other input data? There's a lot of possible input data sources, other than exchange rate, eg. stock market indexes, google trends data for some keywords (related with bitcoin, world economy etc.) which can be correlated with btc future price trends. Will you propose some unified structure for such data to be shared possibly between different methods, or specific method will have to do it for it's own use?

I'd be very happy to contribute to the project, however I'm not a js programmer (but I'm trying to get a little bit more familliar with it). Currently I could share my debian scripts for running gekko daemon using node's "forever" module. Let me know if you're interested.
Lucko
Hero Member
*****
Offline Offline

Activity: 826
Merit: 1000



View Profile
June 02, 2013, 12:05:53 AM
 #60

Here's an example. Parameters are kP = -70, kI = -10, kD= -470. Sample time is 120 minutes.



It basically sells when price raises, and buys when price falls. GRADUALLY.
Wallet starts with 1000$ (0 btcs) on May, 3rd, 00.00; ends with 1518$ worth of bitcoins today (0 usd).
Fee included in simulation?
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!