Update jupyter notebook slightly

This commit is contained in:
Matthias 2019-09-21 10:41:58 +02:00
parent 9a3bad291a
commit 5234f8bf28
3 changed files with 11 additions and 55 deletions

View File

@ -154,7 +154,8 @@ If the day shows the same day, then the last candle can be assumed as incomplete
To keep the jupyter notebooks aligned with the documentation, the following should be ran after updating a example notebook. To keep the jupyter notebooks aligned with the documentation, the following should be ran after updating a example notebook.
``` bash ``` bash
jupyter nbconvert --to markdown user_data/notebooks/strategy_analysis_example.ipynb --stdout > docs/strategy_analysis_example.md jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace user_data/notebooks/strategy_analysis_example.ipynb
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to markdown user_data/notebooks/strategy_analysis_example.ipynb --stdout > docs/strategy_analysis_example.md
``` ```
## Creating a release ## Creating a release

View File

@ -1,31 +1,12 @@
## Strategy debugging example # Strategy analysis example
Debugging a strategy can be time-consuming. FreqTrade offers helper functions to visualize raw data. Debugging a strategy can be time-consuming. FreqTrade offers helper functions to visualize raw data.
## Setup ## Setup
```python ```python
# Change directory
# Modify this cell to insure that the output shows the correct path.
import os
from pathlib import Path from pathlib import Path
# Define all paths relative to the project root shown in the cell output
project_root = "somedir/freqtrade"
i=0
try:
os.chdirdir(project_root)
assert Path('LICENSE').is_file()
except:
while i<4 and (not Path('LICENSE').is_file()):
os.chdir(Path(Path.cwd(), '../'))
i+=1
project_root = Path.cwd()
print(Path.cwd())
```
```python
# Customize these according to your needs. # Customize these according to your needs.
# Define some constants # Define some constants
@ -33,9 +14,9 @@ ticker_interval = "5m"
# Name of the strategy class # Name of the strategy class
strategy_name = 'SampleStrategy' strategy_name = 'SampleStrategy'
# Path to user data # Path to user data
user_data_dir = 'user_data' user_data_dir = Path('user_data')
# Location of the strategy # Location of the strategy
strategy_location = Path(user_data_dir, 'strategies') strategy_location = user_data_dir / 'strategies'
# Location of the data # Location of the data
data_location = Path(user_data_dir, 'data', 'binance') data_location = Path(user_data_dir, 'data', 'binance')
# Pair to analyze - Only use one pair here # Pair to analyze - Only use one pair here
@ -45,7 +26,6 @@ pair = "BTC_USDT"
```python ```python
# Load data using values set above # Load data using values set above
from pathlib import Path
from freqtrade.data.history import load_pair_history from freqtrade.data.history import load_pair_history
candles = load_pair_history(datadir=data_location, candles = load_pair_history(datadir=data_location,

View File

@ -4,7 +4,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Strategy debugging example\n", "# Strategy analysis example\n",
"\n", "\n",
"Debugging a strategy can be time-consuming. FreqTrade offers helper functions to visualize raw data." "Debugging a strategy can be time-consuming. FreqTrade offers helper functions to visualize raw data."
] ]
@ -22,31 +22,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Change directory\n",
"# Modify this cell to insure that the output shows the correct path.\n",
"import os\n",
"from pathlib import Path\n", "from pathlib import Path\n",
"\n",
"# Define all paths relative to the project root shown in the cell output\n",
"project_root = \"somedir/freqtrade\"\n",
"i=0\n",
"try:\n",
" os.chdirdir(project_root)\n",
" assert Path('LICENSE').is_file()\n",
"except:\n",
" while i<4 and (not Path('LICENSE').is_file()):\n",
" os.chdir(Path(Path.cwd(), '../'))\n",
" i+=1\n",
" project_root = Path.cwd()\n",
"print(Path.cwd())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Customize these according to your needs.\n", "# Customize these according to your needs.\n",
"\n", "\n",
"# Define some constants\n", "# Define some constants\n",
@ -54,9 +30,9 @@
"# Name of the strategy class\n", "# Name of the strategy class\n",
"strategy_name = 'SampleStrategy'\n", "strategy_name = 'SampleStrategy'\n",
"# Path to user data\n", "# Path to user data\n",
"user_data_dir = 'user_data'\n", "user_data_dir = Path('user_data')\n",
"# Location of the strategy\n", "# Location of the strategy\n",
"strategy_location = Path(user_data_dir, 'strategies')\n", "strategy_location = user_data_dir / 'strategies'\n",
"# Location of the data\n", "# Location of the data\n",
"data_location = Path(user_data_dir, 'data', 'binance')\n", "data_location = Path(user_data_dir, 'data', 'binance')\n",
"# Pair to analyze - Only use one pair here\n", "# Pair to analyze - Only use one pair here\n",
@ -70,7 +46,6 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Load data using values set above\n", "# Load data using values set above\n",
"from pathlib import Path\n",
"from freqtrade.data.history import load_pair_history\n", "from freqtrade.data.history import load_pair_history\n",
"\n", "\n",
"candles = load_pair_history(datadir=data_location,\n", "candles = load_pair_history(datadir=data_location,\n",
@ -161,7 +136,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.3" "version": "3.7.4"
}, },
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
@ -212,5 +187,5 @@
"version": 3 "version": 3
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 4
} }