Post
Topic
Board Trading Discussion
Re: Gekko - a javascript trading bot for nodejs
by
dirtscience
on 10/07/2013, 15:34:46 UTC
Here is the first version of my (open source) trading bot for node called Gekko.

Quote
The point is ladies and gentlemen that greed, for lack of a better word, is good.

http://mikevanrossum.nl/static/gekko.jpg

-Gordon 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 features

Gekko 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 info

Quote
This 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 Gekko

Windows 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 output

On 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.

Code:
(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 output

You 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:

Code:
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 Gekko

You can currently configure the following EMA parameters:

Quote
// 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

Feedback

As 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?