xautodl/notebooks/Q/qlib-data-play.ipynb

121 lines
2.9 KiB
Plaintext
Raw Normal View History

2021-03-01 12:19:44 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[24128:MainThread](2021-03-01 12:58:36,399) INFO - qlib.Initialization - [config.py:276] - default_conf: client.\n",
"[24128:MainThread](2021-03-01 12:58:36,402) WARNING - qlib.Initialization - [config.py:291] - redis connection failed(host=127.0.0.1 port=6379), cache will not be used!\n",
"[24128:MainThread](2021-03-01 12:58:37,535) INFO - qlib.Initialization - [__init__.py:46] - qlib successfully initialized based on client settings.\n",
"[24128:MainThread](2021-03-01 12:58:37,536) INFO - qlib.Initialization - [__init__.py:47] - data_path=/Users/xuanyidong/.qlib/qlib_data/cn_data\n"
]
}
],
"source": [
"import os\n",
"import sys\n",
"import qlib\n",
"qlib.init(provider_uri='~/.qlib/qlib_data/cn_data')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<qlib.utils.Wrapper object at 0x7fd0af4a3700>\n"
]
}
],
"source": [
"from qlib.data import D"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(1897,)\n",
"[Timestamp('2010-01-04 00:00:00') Timestamp('2010-01-05 00:00:00')\n",
" Timestamp('2010-01-06 00:00:00') ... Timestamp('2017-12-27 00:00:00')\n",
" Timestamp('2017-12-28 00:00:00') Timestamp('2017-12-29 00:00:00')]\n"
]
}
],
"source": [
"calendar = D.calendar(start_time='2010-01-01', end_time='2017-12-31', freq='day')\n",
"print(calendar.shape)\n",
"print(calendar)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'qlib.config.QlibConfig'>\n",
"LocalProvider\n",
"<class 'qlib.utils.Wrapper'>\n",
"<class 'qlib.data.data.LocalProvider'>\n"
]
}
],
"source": [
"from qlib.config import C\n",
"from qlib.\n",
"print(type(C))\n",
"# print(C)\n",
"print(C.provider)\n",
"print(type(D))\n",
"print(type(D._provider))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}