{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2026-01-30T19:47:50.093496Z", "start_time": "2026-01-30T19:47:49.972697Z" } }, "source": [ "from operator import index\n", "\n", "import tushare as ts\n", "import pandas as pd\n", "import time\n", "\n", "ts.set_token('3a0741c702ee7e5e5f2bf1f0846bafaafe4e320833240b2a7e4a685f')\n", "pro = ts.pro_api()" ], "outputs": [ { "ename": "ModuleNotFoundError", "evalue": "No module named 'tushare'", "output_type": "error", "traceback": [ "\u001B[31m---------------------------------------------------------------------------\u001B[39m", "\u001B[31mModuleNotFoundError\u001B[39m Traceback (most recent call last)", "\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[1]\u001B[39m\u001B[32m, line 3\u001B[39m\n\u001B[32m 1\u001B[39m \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01moperator\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;28;01mimport\u001B[39;00m index\n\u001B[32m----> \u001B[39m\u001B[32m3\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mtushare\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;28;01mas\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mts\u001B[39;00m\n\u001B[32m 4\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mpandas\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;28;01mas\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mpd\u001B[39;00m\n\u001B[32m 5\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mtime\u001B[39;00m\n", "\u001B[31mModuleNotFoundError\u001B[39m: No module named 'tushare'" ] } ], "execution_count": 1 }, { "metadata": { "ExecuteTime": { "end_time": "2026-01-30T19:47:50.172803200Z", "start_time": "2025-10-17T07:15:47.491485Z" } }, "cell_type": "code", "source": [ "pro = ts.pro_api()\n", "\n", "#获取单个股票数据\n", "df = pro.stk_limit(ts_code='603106.SH', start_date='20240924', end_date='20240928')\n", "\n", "print(df)" ], "id": "72dcf1a049d09818", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " trade_date ts_code up_limit down_limit\n", "0 20240927 603106.SH 7.71 6.31\n", "1 20240926 603106.SH 7.01 5.73\n", "2 20240925 603106.SH 6.37 5.21\n", "3 20240924 603106.SH 5.79 4.73\n" ] } ], "execution_count": 6 } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }