Add documentation sample for parallel_trade_analysis

This commit is contained in:
Matthias 2019-10-30 14:12:41 +01:00
parent dd408aa5d6
commit 6928c685a8
2 changed files with 42 additions and 3 deletions

View File

@ -107,6 +107,22 @@ trades = load_trades_from_db("sqlite:///tradesv3.sqlite")
trades.groupby("pair")["sell_reason"].value_counts() trades.groupby("pair")["sell_reason"].value_counts()
``` ```
## Analyze the loaded trades for trade parallelism
This can be useful to find the best `max_open_trades` parameter, when used with backtesting in conjunction with `--disable-max-market-positions`.
`parallel_trade_analysis()` returns a timeseries dataframe with an "open_trades" column, specifying the number of open trades for each candle.
```python
from freqtrade.data.btanalysis import parallel_trade_analysis
# Analyze the above
parallel_trades = parallel_trade_analysis(trades, '5m')
parallel_trades.plot()
```
## Plot results ## Plot results
Freqtrade offers interactive plotting capabilities based on plotly. Freqtrade offers interactive plotting capabilities based on plotly.

View File

@ -68,9 +68,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {},
"scrolled": true
},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Load strategy using values set above\n", "# Load strategy using values set above\n",
@ -169,6 +167,31 @@
"trades.groupby(\"pair\")[\"sell_reason\"].value_counts()" "trades.groupby(\"pair\")[\"sell_reason\"].value_counts()"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Analyze the loaded trades for trade parallelism\n",
"This can be useful to find the best `max_open_trades` parameter, when used with backtesting in conjunction with `--disable-max-market-positions`.\n",
"\n",
"`parallel_trade_analysis()` returns a timeseries dataframe with an \"open_trades\" column, specifying the number of open trades for each candle."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from freqtrade.data.btanalysis import parallel_trade_analysis\n",
"\n",
"# Analyze the above\n",
"parallel_trades = parallel_trade_analysis(trades, '5m')\n",
"\n",
"\n",
"parallel_trades.plot()"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},