stable/docs/plotting.md

102 lines
2.5 KiB
Markdown
Raw Normal View History

2018-01-12 10:49:50 +00:00
# Plotting
2019-05-27 17:42:12 +00:00
This page explains how to plot prices, indicators and profits.
2018-01-12 10:49:50 +00:00
2018-01-28 10:53:52 +00:00
## Installation
Plotting scripts use Plotly library. Install/upgrade it with:
2019-05-27 17:42:12 +00:00
``` bash
pip install -U -r requirements-plot.txt
2018-01-28 10:53:52 +00:00
```
2018-01-12 10:49:50 +00:00
## Plot price and indicators
2019-05-27 17:42:12 +00:00
2018-01-12 10:49:50 +00:00
Usage for the price plotter:
2018-01-28 10:53:52 +00:00
2019-05-27 17:42:12 +00:00
``` bash
2019-08-18 04:59:56 +00:00
python3 script/plot_dataframe.py [-h] [-p pairs]
2018-01-28 10:53:52 +00:00
```
2018-01-12 10:49:50 +00:00
Example
2019-05-27 17:42:12 +00:00
``` bash
python3 scripts/plot_dataframe.py -p BTC/ETH
2018-01-12 10:49:50 +00:00
```
The `-p` pairs argument can be used to specify pairs you would like to plot.
Specify custom indicators.
Use `--indicators1` for the main plot and `--indicators2` for the subplot below (if values are in a different range than prices).
``` bash
python3 scripts/plot_dataframe.py -p BTC/ETH --indicators1 sma,ema --indicators2 macd
```
2018-01-12 10:49:50 +00:00
2019-05-27 17:42:12 +00:00
### Advanced use
To plot multiple pairs, separate them with a comma:
2019-05-27 17:42:12 +00:00
``` bash
python3 scripts/plot_dataframe.py -p BTC/ETH,XRP/ETH
```
To plot a timerange (to zoom in):
2019-05-27 17:42:12 +00:00
``` bash
2019-08-22 11:01:10 +00:00
python3 scripts/plot_dataframe.py -p BTC/ETH --timerange=20180801-20180805
```
2019-05-27 17:42:12 +00:00
To plot trades stored in a database use `--db-url` argument:
2019-05-27 17:42:12 +00:00
``` bash
python3 scripts/plot_dataframe.py --db-url sqlite:///tradesv3.dry_run.sqlite -p BTC/ETH --trade-source DB
```
2019-05-27 17:42:12 +00:00
To plot trades from a backtesting result, use `--export-filename <filename>`
2019-05-27 17:42:12 +00:00
``` bash
python3 scripts/plot_dataframe.py --export-filename user_data/backtest_results/backtest-result.json -p BTC/ETH
```
2018-01-12 09:55:49 +00:00
To plot a custom strategy the strategy should have first be backtested.
The results may then be plotted with the -s argument:
2019-05-27 17:42:12 +00:00
``` bash
python3 scripts/plot_dataframe.py -s Strategy_Name -p BTC/ETH --datadir user_data/data/<exchange_name>/
```
2018-01-12 09:55:49 +00:00
## Plot profit
The profit plotter shows a picture with three plots:
2019-05-27 17:42:12 +00:00
2018-01-12 09:55:49 +00:00
1) Average closing price for all pairs
2) The summarized profit made by backtesting.
Note that this is not the real-world profit, but
more of an estimate.
3) Each pair individually profit
The first graph is good to get a grip of how the overall market
progresses.
2019-05-28 17:20:41 +00:00
The second graph will show how your algorithm works or doesn't.
2018-01-12 09:55:49 +00:00
Perhaps you want an algorithm that steadily makes small profits,
or one that acts less seldom, but makes big swings.
The third graph can be useful to spot outliers, events in pairs
that makes profit spikes.
Usage for the profit plotter:
2018-01-28 10:53:52 +00:00
2019-05-27 17:42:12 +00:00
``` bash
python3 script/plot_profit.py [-h] [-p pair] [--datadir directory] [--ticker_interval num]
2018-01-28 10:53:52 +00:00
```
2018-01-12 09:55:49 +00:00
2018-01-28 10:53:52 +00:00
The `-p` pair argument, can be used to plot a single pair
2018-01-12 09:55:49 +00:00
Example
2019-05-27 17:42:12 +00:00
``` bash
2019-03-23 18:28:06 +00:00
python3 scripts/plot_profit.py --datadir ../freqtrade/freqtrade/tests/testdata-20171221/ -p LTC/BTC
2018-01-12 09:55:49 +00:00
```