From 8758218b09152f90286dba5fa0bfafa01441ea29 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 22 Jun 2019 16:18:22 +0200 Subject: [PATCH] Add data-analysis documentation --- docs/backtesting.md | 18 +----------------- docs/data-analysis.md | 44 +++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 3 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 docs/data-analysis.md diff --git a/docs/backtesting.md b/docs/backtesting.md index 5a25bc255..8d8ea8030 100644 --- a/docs/backtesting.md +++ b/docs/backtesting.md @@ -221,24 +221,8 @@ strategies, your configuration, and the crypto-currency you have set up. ### Further backtest-result analysis To further analyze your backtest results, you can [export the trades](#exporting-trades-to-file). -You can then load the trades to perform further analysis. +You can then load the trades to perform further analysis as shown in our [data analysis](data-analysis.md#backtesting) backtesting section. -A good way for this is using Jupyter (notebook or lab) - which provides an interactive environment to analyze the data. - -Freqtrade provides an easy to load the backtest results, which is `load_backtest_data` - and takes a path to the backtest-results file. - -``` python -from freqtrade.data.btanalysis import load_backtest_data -df = load_backtest_data("user_data/backtest-result.json") - -# Show value-counts per pair -df.groupby("pair")["sell_reason"].value_counts() - -``` - -This will allow you to drill deeper into your backtest results, and perform analysis which would make the regular backtest-output unreadable. - -If you have some ideas for interesting / helpful backtest data analysis ideas, please submit a PR so the community can benefit from it. ## Backtesting multiple strategies diff --git a/docs/data-analysis.md b/docs/data-analysis.md new file mode 100644 index 000000000..ef3a02355 --- /dev/null +++ b/docs/data-analysis.md @@ -0,0 +1,44 @@ +# Analyzing bot data + +After performing backtests, or after running the bot for some time, it will be interresting to analyze the results your bot generated. + +A good way for this is using Jupyter (notebook or lab) - which provides an interactive environment to analyze the data. + +The following helpers will help you loading the data into Pandas DataFrames, and may also give you some starting points in analyzing the results. + +## Backtesting + +To analyze your backtest results, you can [export the trades](#exporting-trades-to-file). +You can then load the trades to perform further analysis. + +A good way for this is using Jupyter (notebook or lab) - which provides an interactive environment to analyze the data. + +Freqtrade provides an easy to load the backtest results, which is `load_backtest_data` - and takes a path to the backtest-results file. + +``` python +from freqtrade.data.btanalysis import load_backtest_data +df = load_backtest_data("user_data/backtest-result.json") + +# Show value-counts per pair +df.groupby("pair")["sell_reason"].value_counts() + +``` + +This will allow you to drill deeper into your backtest results, and perform analysis which would make the regular backtest-output unreadable. + +If you have some ideas for interesting / helpful backtest data analysis ideas, please submit a PR so the community can benefit from it. + +## Live data + +To analyze the trades your bot generated, you can load them to a DataFrame as follwos: + +``` python +from freqtrade.data.btanalysis import load_trades_from_db + +df = load_trades_from_db("sqlite:///tradesv3.sqlite") + +df.groupby("pair")["sell_reason"].value_counts() + +``` + +Feel free to submit an issue or Pull Request if you would like to share ideas on how to best analyze the data. diff --git a/mkdocs.yml b/mkdocs.yml index 6b445ee3a..b5e759432 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -17,6 +17,7 @@ nav: - Plotting: plotting.md - Deprecated features: deprecated.md - FAQ: faq.md + - Data Analysis: data-analysis.md - SQL Cheatsheet: sql_cheatsheet.md - Sandbox testing: sandbox-testing.md - Contributors guide: developer.md