Update strategy_analysis_example.ipynb

fix #6402
add code to change the current directory to the project folder
This commit is contained in:
rzhb 2022-11-30 21:25:09 +08:00 committed by GitHub
parent 915524a161
commit 5df3054ace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,22 +23,34 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from pathlib import Path\n", "import os\n",
"\n",
"# Jupyter notebooks default startup folder is the file's current location.\n",
"# This should change the current directory to the project folder, so relative paths remain consistent.\n",
"os.chdir(\"../../\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from freqtrade.configuration import Configuration\n", "from freqtrade.configuration import Configuration\n",
"\n", "\n",
"# Customize these according to your needs.\n", "# Customize these according to your needs.\n",
"\n", "\n",
"# Initialize empty configuration object\n", "# Initialize empty configuration object\n",
"config = Configuration.from_files([])\n", "# config = Configuration.from_files([])\n",
"# Optionally (recommended), use existing configuration file\n", "# Optionally (recommended), use existing configuration file\n",
"# config = Configuration.from_files([\"config.json\"])\n", "config = Configuration.from_files([\"user_data/config.json\"])\n",
"\n", "\n",
"# Define some constants\n", "# Define some constants\n",
"config[\"timeframe\"] = \"5m\"\n", "config[\"timeframe\"] = \"5m\"\n",
"# Name of the strategy class\n", "# Name of the strategy class\n",
"config[\"strategy\"] = \"SampleStrategy\"\n", "config[\"strategy\"] = \"SampleStrategy\"\n",
"# Location of the data\n", "# Location of the data\n",
"data_location = config['datadir']\n", "data_location = config[\"datadir\"]\n",
"# Pair to analyze - Only use one pair here\n", "# Pair to analyze - Only use one pair here\n",
"pair = \"BTC/USDT\"" "pair = \"BTC/USDT\""
] ]
@ -328,7 +340,7 @@
"# Show graph inline\n", "# Show graph inline\n",
"# graph.show()\n", "# graph.show()\n",
"\n", "\n",
"# Render graph in a separate window\n", "# Render graph in a seperate window\n",
"graph.show(renderer=\"browser\")\n" "graph.show(renderer=\"browser\")\n"
] ]
}, },
@ -365,7 +377,7 @@
"metadata": { "metadata": {
"file_extension": ".py", "file_extension": ".py",
"kernelspec": { "kernelspec": {
"display_name": "Python 3.9.7 64-bit ('trade_397')", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -379,7 +391,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.7" "version": "3.10.7"
}, },
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
@ -430,7 +442,7 @@
"version": 3, "version": 3,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "675f32a300d6d26767470181ad0b11dd4676bcce7ed1dd2ffe2fbc370c95fc7c" "hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1"
} }
} }
}, },