1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-15 00:36:55 +08:00

Fix get_data.py detection

This commit is contained in:
zhupr
2020-11-28 12:57:00 +08:00
parent ac96dde4c9
commit 627fc628e0

View File

@@ -1,11 +1,11 @@
{ {
"cells": [ "cells": [
{ {
"cell_type": "markdown",
"metadata": {},
"source": [ "source": [
"<a href=\"https://colab.research.google.com/github/microsoft/qlib/blob/main/examples/workflow_by_code.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" "<a href=\"https://colab.research.google.com/github/microsoft/qlib/blob/main/examples/workflow_by_code.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
], ]
"cell_type": "markdown",
"metadata": {}
}, },
{ {
"cell_type": "code", "cell_type": "code",
@@ -28,16 +28,17 @@
"import sys, site\n", "import sys, site\n",
"from pathlib import Path\n", "from pathlib import Path\n",
"\n", "\n",
"TEMP_CODE_DIR = str(Path(\"~/tmp/qlib_code\").expanduser().resolve())\n",
"\n", "\n",
"try:\n", "try:\n",
" import qlib\n", " import qlib\n",
" scripts_dir = Path.cwd().parent.joinpath(\"scripts\")\n",
"except ImportError:\n", "except ImportError:\n",
" # install qlib\n", " # install qlib\n",
" ! pip install pyqlib\n", " ! pip install pyqlib\n",
" # reload\n", " # reload\n",
" site.main()\n", " site.main()\n",
"\n",
"scripts_dir = Path.cwd().parent.joinpath(\"scripts\")\n",
"if not scripts_dir.joinpath(\"get_data.py\").exists():\n",
" # download get_data.py script\n", " # download get_data.py script\n",
" scripts_dir = Path(\"~/tmp/qlib_code/scripts\").expanduser().resolve()\n", " scripts_dir = Path(\"~/tmp/qlib_code/scripts\").expanduser().resolve()\n",
" scripts_dir.mkdir(parents=True, exist_ok=True)\n", " scripts_dir.mkdir(parents=True, exist_ok=True)\n",
@@ -376,4 +377,4 @@
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 4 "nbformat_minor": 4
} }