first commit
This commit is contained in:
commit
aa7869eb33
386 files changed
+69375
No files matched your search
@@ -0,0 +1,41 @@
|
||||
# Importing
|
||||
|
||||
*Note: this documentation was written for running Gekko via the command line. If you are using the UI you can simply use the importer under the "local data" tab.*
|
||||
|
||||
If you want to use Gekko to [backtest against historical data](./backtesting.md), you most likely need some historical data to test against. Gekko comes with the functionality to automatically import historical data from some exchanges. However, only a few exchanges support this. You can find out with which exchanges Gekko is able to do this [here](https://github.com/askmike/gekko#supported-exchanges).
|
||||
|
||||
## Setup
|
||||
|
||||
For importing you should [enable and configure](./plugins.md) the following plugin:
|
||||
|
||||
- candleWriter (to store the imported data in a database)
|
||||
|
||||
Besides that, make sure to configure `config.watch` properly.
|
||||
|
||||
## Configure
|
||||
|
||||
In your config set the `importer.daterange` properties to the daterange you would like to import.
|
||||
|
||||
## Run
|
||||
|
||||
node gekko --config config.js --import
|
||||
|
||||
The result will be something like this:
|
||||
|
||||
2016-06-26 09:12:16 (INFO): Gekko v0.2.2 started
|
||||
2016-06-26 09:12:16 (INFO): I'm gonna make you rich, Bud Fox.
|
||||
|
||||
2016-06-26 09:12:17 (INFO): Setting up Gekko in importer mode
|
||||
2016-06-26 09:12:17 (INFO):
|
||||
2016-06-26 09:12:17 (INFO): Setting up:
|
||||
2016-06-26 09:12:17 (INFO): Candle writer
|
||||
2016-06-26 09:12:17 (INFO): Store candles in a database
|
||||
2016-06-26 09:12:17 (INFO):
|
||||
|
||||
2016-06-26 09:12:17 (WARN): The plugin Trading Advisor does not support the mode importer. It has been disabled.
|
||||
2016-06-26 09:12:17 (WARN): The plugin Advice logger does not support the mode importer. It has been disabled.
|
||||
2016-06-26 09:12:17 (WARN): The plugin Profit Simulator does not support the mode importer. It has been disabled.
|
||||
2016-06-26 09:12:18 (DEBUG): Processing 798 new trades.
|
||||
2016-06-26 09:12:18 (DEBUG): From 2015-09-09 12:00:04 UTC to 2015-09-09 13:58:55 UTC. (2 hours)
|
||||
2016-06-26 09:12:20 (DEBUG): Processing 211 new trades.
|
||||
(...)
|
||||
@@ -0,0 +1,28 @@
|
||||
# About the commandline
|
||||
|
||||
You don't have to use the UI to control Gekko, you can also use the commandline if you don't have access to a window manager or browser (on a server for example, or anything else you want to SSH into). This is only recommended for advanced users who feel comfortable editing config files and running shell commands.
|
||||
|
||||
Using the commandline you run one Gekko instance per command, eg. if you want to import 3 markets you need to run Gekko 3 times.
|
||||
|
||||
## Configuring Gekko
|
||||
|
||||
If you decide you want to run gekko over the commandline you need to decide two things:
|
||||
|
||||
1. What market / settings are you interested in?
|
||||
2. What should Gekko do? This is either backtest, import or run live.
|
||||
|
||||
For the first one you configure a config file: copy `gekko/sample-config.js` to something else (for example `gekko/config.js`). Configure the plugins to your liking. What plugins you need to enable does depend on the answer of question 2. Check the documentation under commandline for that feature.
|
||||
|
||||
## Running Gekko
|
||||
|
||||
For live mode run:
|
||||
|
||||
node gekko --config config.js
|
||||
|
||||
To backtesting run:
|
||||
|
||||
node gekko --config config.js --backtest
|
||||
|
||||
To import run:
|
||||
|
||||
node gekko --config config.js --import
|
||||
@@ -0,0 +1,71 @@
|
||||
# Backtesting with Gekko
|
||||
|
||||
*Note: this documentation was written for running Gekko via the command line. If you are using the UI you can simply use the importer under the "local data" tab.*
|
||||
|
||||
Gekko is able to backtest strategies against historical data.
|
||||
|
||||
## Setup
|
||||
|
||||
For backtesting you should [enable and configure](./plugins.md) the following plugins:
|
||||
|
||||
- trading advisor (to run your strategy).
|
||||
- paper trader (to execute simulated trades).
|
||||
- performance analyzer (to calculate how succesfull the strategy would have been).
|
||||
|
||||
Besides that, make sure to configure `config.watch`.
|
||||
|
||||
## Historical data
|
||||
|
||||
Gekko requires historical data to backtest strategies against. The easiest way to get this is to let Gekko import historical data, however this is not supported by a lot of exchanges (see [here](https://github.com/askmike/gekko#supported-exchanges)). The second easiest and most universal way is to run Gekko on real markets using the UI (or alternatively via the commandline with the plugin sqliteWriter enabled). Though this takes a while, as you need to run Gekko for a week to have a week of data.
|
||||
|
||||
## Configure
|
||||
|
||||
In your config set the `backtest.daterange` to `scan`. This will force Gekko to scan the local database to figure out what dataranges are available. If you already know exactly what daterange you would like to backtest against, you can set the `backtest.daterange` directly (set `backtest.daterange` as an object with the keys `from` and `to` and the values as a data parsable by [moment](http://momentjs.com/docs/#/parsing/)).
|
||||
|
||||
## Run
|
||||
|
||||
node gekko --config config.js --backtest
|
||||
|
||||
The result will be something like this:
|
||||
|
||||
2016-06-11 08:53:20 (INFO): Gekko v0.2.1 started
|
||||
2016-06-11 08:53:20 (INFO): I'm gonna make you rich, Bud Fox.
|
||||
|
||||
2016-06-11 08:53:20 (INFO): Setting up Gekko in backtest mode
|
||||
2016-06-11 08:53:20 (INFO):
|
||||
2016-06-11 08:53:20 (WARN): The plugin SQLite Datastore does not support the mode backtest. It has been disabled.
|
||||
2016-06-11 08:53:20 (INFO): Setting up:
|
||||
2016-06-11 08:53:20 (INFO): Trading Advisor
|
||||
2016-06-11 08:53:20 (INFO): Calculate trading advice
|
||||
2016-06-11 08:53:20 (INFO): Using the trading method: DEMA
|
||||
2016-06-11 08:53:20 (INFO):
|
||||
|
||||
2016-06-11 08:53:20 (INFO): Setting up:
|
||||
2016-06-11 08:53:20 (INFO): Profit Simulator
|
||||
2016-06-11 08:53:20 (INFO): Paper trader that logs fake profits.
|
||||
2016-06-11 08:53:20 (INFO):
|
||||
|
||||
2016-06-11 08:58:20 (INFO): Profit simulator got advice to long @ 2016-05-30 04:37:00, buying 1.1880062 BTC
|
||||
2016-06-11 08:58:21 (INFO): Profit simulator got advice to short @ 2016-05-31 21:37:00, selling 1.1880062 BTC
|
||||
2016-06-11 08:58:21 (INFO): Profit simulator got advice to long @ 2016-06-01 12:37:00, buying 1.14506098 BTC
|
||||
2016-06-11 08:58:21 (INFO): Profit simulator got advice to short @ 2016-06-02 14:57:00, selling 1.14506098 BTC
|
||||
2016-06-11 08:58:21 (INFO): Profit simulator got advice to long @ 2016-06-02 23:37:00, buying 1.11711818 BTC
|
||||
2016-06-11 08:58:21 (INFO): Profit simulator got advice to short @ 2016-06-05 12:57:00, selling 1.11711818 BTC
|
||||
2016-06-11 08:58:21 (INFO): Profit simulator got advice to long @ 2016-06-06 02:37:00, buying 1.08456953 BTC
|
||||
2016-06-11 08:58:22 (INFO): Profit simulator got advice to short @ 2016-06-07 17:17:00, selling 1.08456953 BTC
|
||||
2016-06-11 08:58:22 (INFO): Profit simulator got advice to long @ 2016-06-08 13:17:00, buying 1.05481755 BTC
|
||||
2016-06-11 08:58:22 (INFO): Profit simulator got advice to short @ 2016-06-09 14:17:00, selling 1.05481755 BTC
|
||||
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) start time: 2016-05-29 23:34:00
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) end time: 2016-06-10 08:56:00
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) timespan: 11 days days
|
||||
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) start price: 516.19
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) end price: 578.97
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) Buy and Hold profit: 12.162189999999995%
|
||||
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) amount of trades: 10
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) original simulated balance: 616.19000 USD
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) current simulated balance: 602.59867 USD
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) simulated profit: -13.59133 USD (-2.20570%)
|
||||
2016-06-11 08:53:22 (INFO): (PROFIT REPORT) simulated yearly profit: -435.53244 USD (-70.68152%)
|
||||
@@ -0,0 +1,214 @@
|
||||
## Enabling plugins
|
||||
|
||||
*Note: this documentation was written for running Gekko via the command line. If you are using the UI you do not have to manually select plugins.*
|
||||
|
||||
Gekko currently has a couple plugins:
|
||||
|
||||
- trading advisor (run a TA strategy against a market)
|
||||
- trader (execute advice from the TA strategy on a real exchange)
|
||||
- advice logger
|
||||
- paper trader
|
||||
- Mailer
|
||||
- IRC bot
|
||||
- Campfire bot
|
||||
- Redis beacon
|
||||
- XMP Bot
|
||||
- and more..
|
||||
|
||||
To configure a plugin, open up your `config.js` file with a text editor and configure the appropiate section.
|
||||
|
||||
## Trading Advisor
|
||||
|
||||
If you want Gekko to provide automated trading advice you need to configure this in Gekko. Note that this is a different plugin than the "trader" which is a responsible for actually creating orders based on this advice. (So if you want automated trading you need both this advice as well as the auto trader).
|
||||
|
||||
Documentation about strategies in Gekko can be found [here](../strategies/introduction.md).
|
||||
|
||||
### Trader
|
||||
|
||||
This plugin automatically creates orders based on the advice from the "Trading Advisor" from the market Gekko is watching. This turns Gekko into an automated trading bot.
|
||||
|
||||
Before Gekko can automatically trade you need to create API keys so that Gekko has the rights to create orders on your behalf, the rights Gekko needs are (naming differs per exchange): get info, get balance/portfolio, get open orders, get fee, buy, sell and cancel order. For all exchanges you need the API key and the API secret, for both Bitstamp and CEX.io you also need your username (which is a number at Bitstamp).
|
||||
|
||||
Configure it like this:
|
||||
|
||||
config.trader = {
|
||||
enabled: true,
|
||||
key: 'your-api-key',
|
||||
secret: 'your-api-secret',
|
||||
username: 'your-username' // your username, only fill in when using bitstamp or cexio
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
- key is your API key.
|
||||
- secret is your API secret.
|
||||
- username is the username (only required for CEX.io and Bitstamp).
|
||||
|
||||
### Advice logger
|
||||
|
||||
The advice logger is a small plugin that logs new advice calculated by Gekko as soon as there is any. Go to the config and configure it like this:
|
||||
|
||||
config.adviceLogger = {
|
||||
enabled: true
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
|
||||
The advice logged advice will look something like this in the terminal:
|
||||
|
||||
2014-01-15 14:31:44 (INFO): We have new trading advice!
|
||||
2014-01-15 14:31:44 (INFO): Position to take: long
|
||||
2014-01-15 14:31:44 (INFO): Market price: 5.96
|
||||
2014-01-15 14:31:44 (INFO): Based on market time: 2014-01-15 14:31:01
|
||||
|
||||
### Paper trader
|
||||
|
||||
The paper trader listens to Gekko's advice and on a sell it will swap all (simulated) currency into (simulated) assets at the current price. On a buy it will be the other way around.
|
||||
|
||||
Go to the config and configure it like this:
|
||||
|
||||
// do you want Gekko to calculate the profit of its own advice?
|
||||
config.paperTrader = {
|
||||
enabled: true,
|
||||
// report the profit in the currency or the asset?
|
||||
reportInCurrency: true,
|
||||
// start balance, on what the current balance is compared with
|
||||
simulationBalance: {
|
||||
// these are in the unit types configured in the watcher.
|
||||
asset: 1,
|
||||
currency: 100
|
||||
},
|
||||
// only want report after a sell? set to `false`.
|
||||
verbose: false,
|
||||
// how much fee in % does each trade cost?
|
||||
feeMaker: 0.5,
|
||||
feeTaker: 0.6,
|
||||
// Using taker or maker fee?
|
||||
feeUsing: 'maker',
|
||||
// how much slippage should Gekko assume per trade?
|
||||
slippage: 0.1
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
- reportInCurrency tells Gekko whether it should report in asset or in the currency.
|
||||
- simulationBalance tells Gekko with what balance it should start.
|
||||
- verbose specifies how often Gekko should log the results (false is after every trade, true is after every candle).
|
||||
- fee is the exchange fee (in %) Gekko should take into consideration when simulating orders.
|
||||
- slippage is the costs in (in %) associated with not being able to buy / sell at market price.*
|
||||
|
||||
*If you are trading a lot and you are buying 100% currency you might not get it all at market price and you have to walk the book in order to take that position. Also note that Gekko uses the candle close price and is unaware of the top asks bids, also take this into account. It is important that you set this number correctly or the resulted calculated profit be very wrong. Read more information [here](http://www.investopedia.com/terms/s/slippage.asp). Take these into consideration when setting a slippage:
|
||||
|
||||
- How much spread is there normally on this market?
|
||||
- How thick is the top of the book normally?
|
||||
- How volatile is this market (the more volatility the bigger the chance you will not get the price you expected)?
|
||||
|
||||
The output will be something like:
|
||||
|
||||
2013-06-02 18:21:15 (INFO): ADVICE is to SHORT @ 117.465 (0.132)
|
||||
2013-06-02 18:21:15 (INFO): (PROFIT REPORT) original balance: 207.465 USD
|
||||
2013-06-02 18:21:15 (INFO): (PROFIT REPORT) current balance: 217.465 USD
|
||||
2013-06-02 18:21:15 (INFO): (PROFIT REPORT) profit: 10.000 USD (4.820%)
|
||||
|
||||
### Mailer
|
||||
|
||||
Mailer will automatically email you whenever Gekko has a new advice.
|
||||
|
||||
// want Gekko to send a mail on buy or sell advice?
|
||||
config.mailer = {
|
||||
enabled: false, // Send Emails if true, false to turn off
|
||||
sendMailOnStart: true, // Send 'Gekko starting' message if true, not if false
|
||||
|
||||
Email: 'me@gmail.com', // Your GMail address
|
||||
|
||||
// You don't have to set your password here, if you leave it blank we will ask it
|
||||
// when Gekko's starts.
|
||||
//
|
||||
// NOTE: Gekko is an open source project < https://github.com/askmike/gekko >,
|
||||
// make sure you looked at the code or trust the maintainer of this bot when you
|
||||
// fill in your email and password.
|
||||
//
|
||||
// WARNING: If you have NOT downloaded Gekko from the github page above we CANNOT
|
||||
// guarantee that your email address & password are safe!
|
||||
|
||||
password: '', // Your GMail Password - if not supplied Gekko will prompt on startup.
|
||||
tag: '[GEKKO] ' // Prefix all EMail subject lines with this
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
- sendMailOnStart will email you right away after Gekko started, you can also use this if you are automatically restarting Gekko to see crash behaviour.
|
||||
- Email is your email address from which Gekko will send emails (to the same address).
|
||||
- password is the email password: Gekko needs to login to your account to send emails to you:
|
||||
|
||||
> You don't have to set your password here, if you leave it blank we will ask it
|
||||
> when Gekko's starts.
|
||||
>
|
||||
> NOTE: Gekko is an open source project < https://github.com/askmike/gekko >,
|
||||
> make sure you looked at the code or trust the maintainer of this bot when you
|
||||
> fill in your email and password.
|
||||
>
|
||||
> WARNING: If you have NOT downloaded Gekko from the github page above we CANNOT
|
||||
> guarantee that your email address & password are safe!
|
||||
|
||||
- tag is some text that Gekko will put in all subject lines so you can easily group all advices together.
|
||||
|
||||
### IRC bot
|
||||
|
||||
IRC bot is a small plugin that connects Gekko to an IRC channel and lets users interact with it using basic commands.
|
||||
|
||||
config.ircbot = {
|
||||
enabled: false,
|
||||
emitUpdates: false,
|
||||
channel: '#your-channel',
|
||||
server: 'irc.freenode.net',
|
||||
botName: 'gekkobot'
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
- emitUpdates tells Gekko that whenever there is a new advice it should broadcast this in the channel.
|
||||
- channel is the IRC channel the bot will connect to.
|
||||
- server is the IRC server.
|
||||
- botName is the username Gekko will use.
|
||||
|
||||
### Campfire bot
|
||||
|
||||
Campfire bot is a small plugin that connects Gekko to a Campfire room and lets users interact with it using basic commands.
|
||||
|
||||
config.campfire = {
|
||||
enabled: false,
|
||||
emitUpdates: false,
|
||||
nickname: 'Gordon',
|
||||
roomId: 673783,
|
||||
apiKey: 'e3b0c44298fc1c149afbf4c8996',
|
||||
account: 'your-subdomain'
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
- emitUpdates tells Gekko that whenever there is a new advice it should broadcast this in the room.
|
||||
- roomId is the ID of the Campfire room the bot will connect to.
|
||||
- apiKey is the API key for the Campfire user Gekko will connect using.
|
||||
- account is the subdomain for the account that the room belongs to.
|
||||
|
||||
### Redis beacon
|
||||
|
||||
This is an advanced plugin only for programmers! If you are interested in this read more [here](https://github.com/askmike/gekko/blob/stable/docs/internals/plugins.md#redis-beacon).
|
||||
|
||||
config.redisBeacon = {
|
||||
enabled: false,
|
||||
port: 6379, // redis default
|
||||
host: '127.0.0.1', // localhost
|
||||
// On default Gekko broadcasts
|
||||
// events in the channel with
|
||||
// the name of the event, set
|
||||
// an optional prefix to the
|
||||
// channel name.
|
||||
channelPrefix: '',
|
||||
broadcast: [
|
||||
'small candle'
|
||||
]
|
||||
}
|
||||
|
||||
- enabled indicates whether this is on or off.
|
||||
- port is the port redis is running on.
|
||||
- host is the redis host.
|
||||
- channelPrefix a string that Gekko will prefix all candles with.
|
||||
- broadcast is a list of all events you want Gekko to publish.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Tradebot
|
||||
|
||||
You can set Gekko up as a tradebot, this will instruct Gekko to:
|
||||
|
||||
- Watch a live market.
|
||||
- Run a strategy (in semi-realtime) over live market data.
|
||||
- Automatically create buy/sell orders based on signals coming from the strategy.
|
||||
|
||||
*As with everything in Gekko, the tradebot will make decisions based on the strategy selected/configured/created **by YOU**. If you end up losing money, you have no one to blame but yourself.*
|
||||
|
||||
## Configuration
|
||||
|
||||
First, set up Gekko for commandline usage (see [this document](./about_the_commandline.md) for details). After that, configure the following plugins:
|
||||
|
||||
- `config.watch` - the market to trade on.
|
||||
- `candleWriter` - (optional) also store market data to disk.
|
||||
- `tradingAdvisor` - configure the strategy and candle properties.
|
||||
- `trader` - configure Gekko access to your exchange account.
|
||||
- `performanceAnalyzer` - enable.
|
||||
|
||||
Turn off the paperTrader (there can only be 1 trade plugin active per instance).
|
||||
|
||||
Once done, run Gekko like so:
|
||||
|
||||
node gekko --config your-config-file.js
|
||||
Reference in new issue
Block a user