{ "cells": [ { "cell_type": "markdown", "id": "1fee51d2-8d41-468e-b416-a58bed1ddbb9", "metadata": {}, "source": [ "数据字典地址:http://docs.thinktrader.net/pages/7c0936/" ] }, { "cell_type": "code", "execution_count": 12, "id": "e63c7fc2-2500-4d50-a5af-8af4aaa91c1b", "metadata": {}, "outputs": [], "source": [ "# Token连接(若通过客户端连接则无需运行此单元格)\n", "from vnpy.trader.utility import TEMP_DIR\n", "\n", "from xtquant import xtdatacenter as xtdc\n", "\n", "# 设置迅投研令牌\n", "xtdc.set_token(\"4aff6f3b0dcfc990ec9476213ba784e17c34e757\") # 换成自己的Token\n", "\n", "# 设置临时文件目录\n", "xtdc.set_data_home_dir(str(TEMP_DIR) + \"\\\\xt\")\n", "\n", "# 初始化连接\n", "xtdc.init()" ] }, { "cell_type": "code", "execution_count": 2, "id": "cc8d3d17-28bb-42a9-aea7-95879d9a5994", "metadata": {}, "outputs": [], "source": [ "from xtquant.xtdata import (\n", " download_history_data,\n", " download_financial_data,\n", " get_local_data,\n", " get_stock_list_in_sector,\n", " get_instrument_detail,\n", " get_financial_data,\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "id": "7a04439d-b14f-48a9-9269-420a0c7c2c58", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "{'90000001.SZO': Empty DataFrame\n", " Columns: [time, open, high, low, close, volume, amount, settelementPrice, openInterest, preClose, suspendFlag]\n", " Index: []}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# 期权数据(1d也支持)\n", "download_history_data(\"90000001.SZO\", \"1m\", \"20200101\", \"20200112\")\n", "data1 = get_local_data([], [\"90000001.SZO\"], \"1m\", \"20200101\", \"20200112\")\n", "data1" ] }, { "cell_type": "code", "execution_count": 4, "id": "a9347593-3ed2-42a6-93e2-534ffe5fbc09", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | time | \n", "open | \n", "high | \n", "low | \n", "close | \n", "volume | \n", "amount | \n", "settelementPrice | \n", "openInterest | \n", "preClose | \n", "suspendFlag | \n", "
|---|