first commit
This commit is contained in:
commit
aa7869eb33
386 files changed
+69375
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# Backtesting
|
||||
|
||||
Gekko supports backtesting strategies over historical data. A Backtest is a simulation where you simulate running a strategy over a long time (such as the last 30 days) in a matter of seconds. Backtesting requires having market data locally available already. After a backtest Gekko will provide statistics about the market and the strategy's performance.
|
||||
|
||||

|
||||
|
||||
**Important things to remember:**
|
||||
|
||||
- Just because a strategy performed well in the past, does not mean it will perform well in the future.
|
||||
- Be careful of overfitting, in other words: don't simply tweak a strategy until you get high profit and assume that will be as profitable when going live. Read more about overfitting in [this article](https://laplaceinsights.com/backtesting-strategies-and-overfitting/).
|
||||
- The backtest simulation is limited, this is not really a problem on bigger markets (such as BTC/USD) but the differences between backtests and live traders on very low volume markets might be big. Read more about this below in the simplified simulation below.
|
||||
|
||||
## Simplified simulation
|
||||
|
||||
Simulating trades is done through a module called the paper trader. This module will use market candles together with fee, slippage and spread numbers to estimate trade executions costs. While the default settings work great for most big markets (USD/BTC or BTC/ETH), it becomes a lot less acurate on smaller markets with low volume and liquidity.
|
||||
|
||||
In live trading the notion of the "price" is more complicated than a single number. Both `spread` and `slippage` will effect your trade prices: these numbers describe your desired trades in relation to what people are currently offering in the market (this is called the orderbook). Read more about this in [this explanation](https://github.com/askmike/gekko/issues/2380#issuecomment-408744682).
|
||||
|
||||
If you look at the following backtest result:
|
||||
|
||||

|
||||
|
||||
You can see a lot of "spikes" of the price moving up and down. These are not actually price fluctuations but simply trades that happen on both sides of the orderbook (a bid is taken then an ask is taken). How far it jumps up and down is the spread (between the asks and the bids). In these cases the statistics from the simulation won't be very accurate (unless you configured a higher slippage to account for the spread). This is unfortunately a limitation in Gekko's backtesting model.
|
||||
@@ -0,0 +1,11 @@
|
||||
# Importing
|
||||
|
||||
In order to [backtest](./backtesting.md) your strategies you will need to have historical market data to test with. The easiest way of getting this data is importing it directly from the exchange using the Gekko UI (note that this is not supported at all exchanges, check [this list](../introduction/supported_exchanges.md) to see what exchanges Gekko can import from).
|
||||
|
||||
You can start an import by navigating to the tab "Local tab" and scrolling to the bottom and click "Go to the importer". This brings you to the importing page with this at the bottom:
|
||||
|
||||

|
||||
|
||||
Once you configure the market and daterange you want to watch and click import Gekko will automatically download historical market data from the exchange:
|
||||
|
||||

|
||||
@@ -0,0 +1,7 @@
|
||||
# Paper trading
|
||||
|
||||
Gekko can automatically run a strategy over the live markets and simulate in realtime what happen if you would have traded on its signals. Paper trading and [backtesting](./backtesting.md) are the two simulation modes that come with Gekko. It's a great way to experiment with strategies without putting your money on the line.
|
||||
|
||||
You can start a paper trader by going to live gekkos and clicking on "Start a new live Gekko".
|
||||
|
||||
Keep in mind that a paper trader is a simulation, and the accuracy depends on the market you decide to run it on (you'll get pretty accurate results on big markets like USD/BTC). You can read more about the details and limitations of the simulation on [the backtesting page](./backtesting.md#Simplified-simulation).
|
||||
@@ -0,0 +1,22 @@
|
||||
# Trading bot
|
||||
|
||||
Once you have run enough simulations (using [backtesting](./backtesting.md) and [paper trading](./paper_trading.md)) and you are confident in your strategy you can use Gekko as a trading bot.
|
||||
|
||||
Gekko will run your strategy on the live market and automatically trade on your exchange account when trade signals come out of your strategy.
|
||||
|
||||
## Preparation
|
||||
|
||||
1. Make sure you are fully confident in your strategy! If you want to play around use either the [paper trader](./paper_trading.md) or the [backtester](./backtesting.md). Once you are confident continue with this list.
|
||||
2. Gekko will need to have API keys to your exchange account that have permissions to view balances and orders and create new orders. Keep in mind:
|
||||
- Gekko does NOT need withdrawal access, for your safety DO NOT create API keys that can withdraw.
|
||||
- Make sure you only use the API key for Gekko, and for nothing else. If in doubt create a new key (and remove stale ones).
|
||||
- If possible try to restrict the API key to the IP address you will run Gekko from (this makes moest sense in server environments)
|
||||
3. Start your gekko through either the UI or the commandline interface!
|
||||
|
||||
## Notes
|
||||
|
||||
Gekko will trade on the market you configured that consists of two currencies (for example USD/BTC):
|
||||
- Try to not trade either of these currencies on the account you use with Gekko. (in the example above: don't trade any USD nor any BTC).
|
||||
- Try to not withdraw or deposit more of either of these currencies.
|
||||
|
||||
While Gekko will handle the situations above, all the profit calculations will be incorrect since your balances are taken into account while calculating profits.
|
||||
Reference in new issue
Block a user