{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "a4ee5431-61a4-45ba-8075-c9bc4981c3d1", "metadata": {}, "outputs": [], "source": [ "from pprint import pprint\n", "from pathlib import Path\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "7e6b5b5d-9556-4e32-97db-598170e51e8f", "metadata": {}, "outputs": [], "source": [ "import qlib\n", "from qlib.constant import REG_CN" ] }, { "cell_type": "code", "execution_count": 3, "id": "462a4caa-030b-4c5a-bdaf-6da2e2a7018f", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "[64026:MainThread](2022-06-23 17:30:31,270) INFO - qlib.Initialization - [config.py:413] - default_conf: client.\n", "[64026:MainThread](2022-06-23 17:30:31,395) INFO - qlib.Initialization - [__init__.py:74] - qlib successfully initialized based on client settings.\n", "[64026:MainThread](2022-06-23 17:30:31,395) INFO - qlib.Initialization - [__init__.py:76] - data_path={'__DEFAULT_FREQ': PosixPath('/home/guofu/Workspaces/guofu/TslDataFeed/qlib-data/target/market/k-daily')}\n" ] } ], "source": [ "provider_uri = 'qlib-data/target/market/k-daily/'\n", "qlib.init(provider_uri=provider_uri, region=REG_CN)" ] }, { "cell_type": "code", "execution_count": 4, "id": "d17953b5-f84d-4d07-b348-9f2e3058e09c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([Timestamp('2010-01-04 00:00:00'), Timestamp('2010-01-05 00:00:00')],\n", " dtype=object)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from qlib.data import D\n", "D.calendar(start_time='2010-01-01', end_time='2019-12-31', freq='day')[:2]" ] }, { "cell_type": "code", "execution_count": 5, "id": "3110bbee-95e5-4077-8bf7-bbf130a8e395", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | \n", " | $close | \n", "$factor | \n", "$volume | \n", "
---|---|---|---|---|
instrument | \n", "datetime | \n", "\n", " | \n", " | \n", " |
SH600519 | \n", "2022-05-05 | \n", "1837.000000 | \n", "0.038907 | \n", "3366094.0 | \n", "
2022-05-06 | \n", "1793.000000 | \n", "0.038907 | \n", "2859618.0 | \n", "|
2022-05-09 | \n", "1752.000000 | \n", "0.038907 | \n", "3035182.0 | \n", "|
2022-05-10 | \n", "1766.189941 | \n", "0.038907 | \n", "4011919.0 | \n", "|
2022-05-11 | \n", "1768.000000 | \n", "0.038907 | \n", "3031267.0 | \n", "|
2022-05-12 | \n", "1762.670044 | \n", "0.038907 | \n", "2203823.0 | \n", "|
2022-05-13 | \n", "1778.239990 | \n", "0.038907 | \n", "2073052.0 | \n", "|
2022-05-16 | \n", "1758.000000 | \n", "0.038907 | \n", "2776531.0 | \n", "|
2022-05-17 | \n", "1768.000000 | \n", "0.038907 | \n", "2014474.0 | \n", "|
2022-05-18 | \n", "1761.000000 | \n", "0.038907 | \n", "2485044.0 | \n", "|
2022-05-19 | \n", "1756.000000 | \n", "0.038907 | \n", "1977626.0 | \n", "|
2022-05-20 | \n", "1800.010010 | \n", "0.038907 | \n", "4194960.0 | \n", "|
2022-05-23 | \n", "1781.000000 | \n", "0.038907 | \n", "2215713.0 | \n", "|
2022-05-24 | \n", "1760.000000 | \n", "0.038907 | \n", "2734222.0 | \n", "|
2022-05-25 | \n", "1755.510010 | \n", "0.038907 | \n", "2238869.0 | \n", "|
2022-05-26 | \n", "1742.800049 | \n", "0.038907 | \n", "2805344.0 | \n", "|
2022-05-27 | \n", "1755.160034 | \n", "0.038907 | \n", "2511958.0 | \n", "|
2022-05-30 | \n", "1778.410034 | \n", "0.038907 | \n", "3446569.0 | \n", "|
2022-05-31 | \n", "1804.030029 | \n", "0.038907 | \n", "4075082.0 | \n", "
\n", " | \n", " | P($$roewa_q) | \n", "
---|---|---|
instrument | \n", "datetime | \n", "\n", " |
sh600519 | \n", "2019-01-02 | \n", "0.255220 | \n", "
2019-01-03 | \n", "0.255220 | \n", "|
2019-01-04 | \n", "0.255220 | \n", "|
2019-01-07 | \n", "0.255220 | \n", "|
2019-01-08 | \n", "0.255220 | \n", "|
... | \n", "... | \n", "... | \n", "
sz000725 | \n", "2019-07-15 | \n", "0.012164 | \n", "
2019-07-16 | \n", "0.012164 | \n", "|
2019-07-17 | \n", "0.012164 | \n", "|
2019-07-18 | \n", "0.012164 | \n", "|
2019-07-19 | \n", "0.012164 | \n", "
266 rows × 1 columns
\n", "