(data leak)RollingRank-7.0,赚钱
This commit is contained in:
@@ -2,55 +2,30 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "f74ce078-f7e8-4733-a14c-14d8815a3626",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-04-06T15:33:48.836794Z",
|
||||
"start_time": "2025-04-06T15:33:48.098706Z"
|
||||
"end_time": "2025-04-08T13:37:05.760051Z",
|
||||
"start_time": "2025-04-08T13:37:04.957429Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import tushare as ts\n",
|
||||
"ts.set_token('3a0741c702ee7e5e5f2bf1f0846bafaafe4e320833240b2a7e4a685f')\n",
|
||||
"pro = ts.pro_api()"
|
||||
]
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": 1
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "44dd8d87-e60b-49e5-aed9-efaa7f92d4fe",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-04-06T15:33:55.800360Z",
|
||||
"start_time": "2025-04-06T15:33:49.011404Z"
|
||||
"end_time": "2025-04-08T13:37:11.825892Z",
|
||||
"start_time": "2025-04-08T13:37:05.764874Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" ts_code trade_date\n",
|
||||
"0 000001.SZ 20250312\n",
|
||||
"1 000002.SZ 20250312\n",
|
||||
"2 000004.SZ 20250312\n",
|
||||
"3 000006.SZ 20250312\n",
|
||||
"4 000007.SZ 20250312\n",
|
||||
"... ... ...\n",
|
||||
"21567 920108.BJ 20250401\n",
|
||||
"21568 920111.BJ 20250401\n",
|
||||
"21569 920116.BJ 20250401\n",
|
||||
"21570 920118.BJ 20250401\n",
|
||||
"21571 920128.BJ 20250401\n",
|
||||
"\n",
|
||||
"[7551938 rows x 2 columns]\n",
|
||||
"20250403\n",
|
||||
"start_date: 20250407\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"import time\n",
|
||||
@@ -69,36 +44,42 @@
|
||||
"trade_dates = trade_cal[trade_cal['cal_date'] > max_date]['cal_date'].tolist()\n",
|
||||
"start_date = min(trade_dates)\n",
|
||||
"print(f'start_date: {start_date}')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "747acc47-0884-4f76-90fb-276f6494e31d",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-04-06T15:33:57.293636Z",
|
||||
"start_time": "2025-04-06T15:33:55.806283Z"
|
||||
}
|
||||
},
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"任务 20250417 完成\n",
|
||||
"任务 20250418 完成\n",
|
||||
"任务 20250416 完成\n",
|
||||
"任务 20250415 完成\n",
|
||||
"任务 20250414 完成\n",
|
||||
"任务 20250411 完成\n",
|
||||
"任务 20250410 完成\n",
|
||||
"任务 20250409 完成\n",
|
||||
"任务 20250408 完成\n",
|
||||
"任务 20250407 完成\n"
|
||||
" ts_code trade_date\n",
|
||||
"0 000001.SZ 20250312\n",
|
||||
"1 000002.SZ 20250312\n",
|
||||
"2 000004.SZ 20250312\n",
|
||||
"3 000006.SZ 20250312\n",
|
||||
"4 000007.SZ 20250312\n",
|
||||
"... ... ...\n",
|
||||
"5386 920108.BJ 20250407\n",
|
||||
"5387 920111.BJ 20250407\n",
|
||||
"5388 920116.BJ 20250407\n",
|
||||
"5389 920118.BJ 20250407\n",
|
||||
"5390 920128.BJ 20250407\n",
|
||||
"\n",
|
||||
"[7557329 rows x 2 columns]\n",
|
||||
"20250407\n",
|
||||
"start_date: 20250408\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 2
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "747acc47-0884-4f76-90fb-276f6494e31d",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-04-08T13:37:13.619472Z",
|
||||
"start_time": "2025-04-08T13:37:12.062668Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
|
||||
"\n",
|
||||
@@ -128,27 +109,35 @@
|
||||
" except Exception as e:\n",
|
||||
" print(f\"获取 {trade_date} 数据时出错: {e}\")\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "c6765638-481f-40d8-a259-2e7b25362618",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-04-06T15:33:57.874278Z",
|
||||
"start_time": "2025-04-06T15:33:57.304371Z"
|
||||
}
|
||||
},
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"所有每日基础数据获取并保存完毕!\n"
|
||||
"任务 20250417 完成\n",
|
||||
"任务 20250418 完成\n",
|
||||
"任务 20250415 完成\n",
|
||||
"任务 20250416 完成\n",
|
||||
"任务 20250411 完成\n",
|
||||
"任务 20250414 完成\n",
|
||||
"任务 20250409 完成\n",
|
||||
"任务 20250410 完成\n",
|
||||
"任务 20250408 完成\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 3
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "c6765638-481f-40d8-a259-2e7b25362618",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-04-08T13:37:15.761420Z",
|
||||
"start_time": "2025-04-08T13:37:13.644113Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"all_daily_data_df = pd.concat(all_daily_data, ignore_index=True)\n",
|
||||
"\n",
|
||||
@@ -158,7 +147,17 @@
|
||||
"all_daily_data_df.to_hdf(h5_filename, key=key, mode='a', format='table', append=True, data_columns=True)\n",
|
||||
"\n",
|
||||
"print(\"所有每日基础数据获取并保存完毕!\")"
|
||||
]
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"所有每日基础数据获取并保存完毕!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 4
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user