RollingRank勉强赚钱

This commit is contained in:
liaozhaorun
2025-04-10 23:17:22 +08:00
parent 8aad47ce33
commit a4515bb27a
9 changed files with 2596 additions and 2706 deletions

View File

@@ -5,8 +5,8 @@
"id": "initial_id",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:01.282302Z",
"start_time": "2025-04-08T13:37:00.318950Z"
"end_time": "2025-04-09T14:57:27.092313Z",
"start_time": "2025-04-09T14:57:26.124592Z"
}
},
"source": [
@@ -27,8 +27,8 @@
"id": "f448da220816bf98",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:02.801052Z",
"start_time": "2025-04-08T13:37:01.292316Z"
"end_time": "2025-04-09T14:57:37.680808Z",
"start_time": "2025-04-09T14:57:27.392846Z"
}
},
"source": [
@@ -63,7 +63,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\liaozhaorun\\AppData\\Local\\Temp\\ipykernel_25240\\3209233630.py:13: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
"C:\\Users\\liaozhaorun\\AppData\\Local\\Temp\\ipykernel_15500\\3209233630.py:13: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
" final_df = pd.concat(all_data, ignore_index=True)\n"
]
}
@@ -75,8 +75,8 @@
"id": "907f732d3c397bf",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:03.042004Z",
"start_time": "2025-04-08T13:37:03.007507Z"
"end_time": "2025-04-09T14:57:37.730922Z",
"start_time": "2025-04-09T14:57:37.695917Z"
}
},
"source": [
@@ -92,32 +92,32 @@
"output_type": "stream",
"text": [
" ts_code trade_date close open high low \\\n",
"0 000905.SH 20250408 5326.9140 5279.7566 5371.1834 5249.2318 \n",
"1 000905.SH 20250407 5287.0333 5523.9636 5587.8502 5212.6773 \n",
"2 000905.SH 20250403 5845.5045 5842.6167 5906.7057 5817.9662 \n",
"3 000905.SH 20250402 5899.0865 5884.8925 5936.6467 5884.1126 \n",
"4 000905.SH 20250401 5892.8502 5870.9424 5931.5038 5867.8480 \n",
"0 000905.SH 20250409 5439.7716 5249.6841 5465.1449 5135.9655 \n",
"1 000905.SH 20250408 5326.9140 5279.7566 5371.1834 5249.2318 \n",
"2 000905.SH 20250407 5287.0333 5523.9636 5587.8502 5212.6773 \n",
"3 000905.SH 20250403 5845.5045 5842.6167 5906.7057 5817.9662 \n",
"4 000905.SH 20250402 5899.0865 5884.8925 5936.6467 5884.1126 \n",
"... ... ... ... ... ... ... \n",
"13441 399006.SZ 20100607 1069.4680 1005.0280 1075.2250 1001.7020 \n",
"13442 399006.SZ 20100604 1027.6810 989.6810 1027.6810 986.5040 \n",
"13443 399006.SZ 20100603 998.3940 1002.3550 1026.7020 997.7750 \n",
"13444 399006.SZ 20100602 997.1190 967.6090 997.1190 952.6110 \n",
"13445 399006.SZ 20100601 973.2330 986.0150 994.7930 948.1180 \n",
"13444 399006.SZ 20100607 1069.4680 1005.0280 1075.2250 1001.7020 \n",
"13445 399006.SZ 20100604 1027.6810 989.6810 1027.6810 986.5040 \n",
"13446 399006.SZ 20100603 998.3940 1002.3550 1026.7020 997.7750 \n",
"13447 399006.SZ 20100602 997.1190 967.6090 997.1190 952.6110 \n",
"13448 399006.SZ 20100601 973.2330 986.0150 994.7930 948.1180 \n",
"\n",
" pre_close change pct_chg vol amount \n",
"0 5287.0333 39.8807 0.7543 2.238407e+08 2.618753e+08 \n",
"1 5845.5045 -558.4712 -9.5539 2.365227e+08 2.673974e+08 \n",
"2 5899.0865 -53.5820 -0.9083 1.349386e+08 1.736621e+08 \n",
"3 5892.8502 6.2363 0.1058 1.121600e+08 1.406421e+08 \n",
"4 5857.7721 35.0781 0.5988 1.364486e+08 1.793280e+08 \n",
"0 5326.9140 112.8576 2.1186 2.451180e+08 2.882574e+08 \n",
"1 5287.0333 39.8807 0.7543 2.238407e+08 2.618753e+08 \n",
"2 5845.5045 -558.4712 -9.5539 2.365227e+08 2.673974e+08 \n",
"3 5899.0865 -53.5820 -0.9083 1.349386e+08 1.736621e+08 \n",
"4 5892.8502 6.2363 0.1058 1.121600e+08 1.406421e+08 \n",
"... ... ... ... ... ... \n",
"13441 1027.6810 41.7870 4.0661 2.655275e+06 9.106095e+06 \n",
"13442 998.3940 29.2870 2.9334 1.500295e+06 5.269441e+06 \n",
"13443 997.1190 1.2750 0.1279 1.616805e+06 6.240835e+06 \n",
"13444 973.2330 23.8860 2.4543 1.074628e+06 4.001206e+06 \n",
"13445 1000.0000 -26.7670 -2.6767 1.356285e+06 4.924177e+06 \n",
"13444 1027.6810 41.7870 4.0661 2.655275e+06 9.106095e+06 \n",
"13445 998.3940 29.2870 2.9334 1.500295e+06 5.269441e+06 \n",
"13446 997.1190 1.2750 0.1279 1.616805e+06 6.240835e+06 \n",
"13447 973.2330 23.8860 2.4543 1.074628e+06 4.001206e+06 \n",
"13448 1000.0000 -26.7670 -2.6767 1.356285e+06 4.924177e+06 \n",
"\n",
"[13446 rows x 11 columns]\n"
"[13449 rows x 11 columns]\n"
]
}
],

View File

@@ -5,8 +5,8 @@
"id": "f74ce078-f7e8-4733-a14c-14d8815a3626",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:05.760051Z",
"start_time": "2025-04-08T13:37:04.957429Z"
"end_time": "2025-04-09T14:57:34.662465Z",
"start_time": "2025-04-09T14:57:33.903794Z"
}
},
"source": [
@@ -22,8 +22,8 @@
"id": "44dd8d87-e60b-49e5-aed9-efaa7f92d4fe",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:11.825892Z",
"start_time": "2025-04-08T13:37:05.764874Z"
"end_time": "2025-04-09T14:57:41.818953Z",
"start_time": "2025-04-09T14:57:34.666469Z"
}
},
"source": [
@@ -57,15 +57,15 @@
"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",
"5387 920108.BJ 20250408\n",
"5388 920111.BJ 20250408\n",
"5389 920116.BJ 20250408\n",
"5390 920118.BJ 20250408\n",
"5391 920128.BJ 20250408\n",
"\n",
"[7557329 rows x 2 columns]\n",
"20250407\n",
"start_date: 20250408\n"
"[7562721 rows x 2 columns]\n",
"20250408\n",
"start_date: 20250409\n"
]
}
],
@@ -76,8 +76,8 @@
"id": "747acc47-0884-4f76-90fb-276f6494e31d",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:13.619472Z",
"start_time": "2025-04-08T13:37:12.062668Z"
"end_time": "2025-04-09T14:57:45.660215Z",
"start_time": "2025-04-09T14:57:42.232250Z"
}
},
"source": [
@@ -115,15 +115,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250417 完成\n",
"任务 20250418 完成\n",
"任务 20250415 完成\n",
"任务 20250417 完成\n",
"任务 20250416 完成\n",
"任务 20250411 完成\n",
"任务 20250414 完成\n",
"任务 20250409 完成\n",
"任务 20250415 完成\n",
"任务 20250411 完成\n",
"任务 20250410 完成\n",
"任务 20250408 完成\n"
"任务 20250409 完成\n"
]
}
],
@@ -134,8 +133,8 @@
"id": "c6765638-481f-40d8-a259-2e7b25362618",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:15.761420Z",
"start_time": "2025-04-08T13:37:13.644113Z"
"end_time": "2025-04-09T14:57:48.970445Z",
"start_time": "2025-04-09T14:57:45.698824Z"
}
},
"source": [

View File

@@ -5,8 +5,8 @@
"id": "f74ce078-f7e8-4733-a14c-14d8815a3626",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:06.782320Z",
"start_time": "2025-04-08T13:37:06.021497Z"
"end_time": "2025-04-09T14:57:35.618124Z",
"start_time": "2025-04-09T14:57:34.837095Z"
}
},
"source": [
@@ -22,8 +22,8 @@
"id": "44dd8d87-e60b-49e5-aed9-efaa7f92d4fe",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:08.283747Z",
"start_time": "2025-04-08T13:37:06.788327Z"
"end_time": "2025-04-09T14:57:38.089531Z",
"start_time": "2025-04-09T14:57:35.854308Z"
}
},
"source": [
@@ -57,15 +57,15 @@
"3 801005.SI 20250221\n",
"4 801010.SI 20250221\n",
".. ... ...\n",
"434 859811.SI 20250407\n",
"435 859821.SI 20250407\n",
"436 859822.SI 20250407\n",
"437 859852.SI 20250407\n",
"438 859951.SI 20250407\n",
"434 859811.SI 20250408\n",
"435 859821.SI 20250408\n",
"436 859822.SI 20250408\n",
"437 859852.SI 20250408\n",
"438 859951.SI 20250408\n",
"\n",
"[1057563 rows x 2 columns]\n",
"20250407\n",
"start_date: 20250408\n"
"[1058002 rows x 2 columns]\n",
"20250408\n",
"start_date: 20250409\n"
]
}
],
@@ -76,8 +76,8 @@
"id": "747acc47-0884-4f76-90fb-276f6494e31d",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:09.658356Z",
"start_time": "2025-04-08T13:37:08.473145Z"
"end_time": "2025-04-09T14:57:40.754159Z",
"start_time": "2025-04-09T14:57:38.104541Z"
}
},
"source": [
@@ -115,15 +115,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250418 完成\n",
"任务 20250417 完成\n",
"任务 20250416 完成\n",
"任务 20250418 完成\n",
"任务 20250415 完成\n",
"任务 20250416 完成\n",
"任务 20250414 完成\n",
"任务 20250411 完成\n",
"任务 20250410 完成\n",
"任务 20250409 完成\n",
"任务 20250408 完成\n"
"任务 20250409 完成\n"
]
}
],
@@ -134,8 +133,8 @@
"id": "c6765638-481f-40d8-a259-2e7b25362618",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:09.826834Z",
"start_time": "2025-04-08T13:37:09.671846Z"
"end_time": "2025-04-09T14:57:40.994975Z",
"start_time": "2025-04-09T14:57:40.773783Z"
}
},
"source": [

View File

@@ -5,8 +5,8 @@
"id": "18d1d622-b083-4cc4-a6f8-7c1ed2d0edd2",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:08.050676Z",
"start_time": "2025-04-08T13:37:07.328483Z"
"end_time": "2025-04-09T14:57:36.913044Z",
"start_time": "2025-04-09T14:57:36.159612Z"
}
},
"source": [
@@ -22,8 +22,8 @@
"id": "14671a7f72de2564",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:10.251715Z",
"start_time": "2025-04-08T13:37:08.055681Z"
"end_time": "2025-04-09T14:57:39.128278Z",
"start_time": "2025-04-09T14:57:36.918051Z"
}
},
"source": [
@@ -82,8 +82,8 @@
"id": "e7f8cce2f80e2f20",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:37.727419Z",
"start_time": "2025-04-08T13:37:10.461897Z"
"end_time": "2025-04-09T14:58:09.296046Z",
"start_time": "2025-04-09T14:57:39.339423Z"
}
},
"source": [
@@ -111,17 +111,17 @@
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 8507519 entries, 0 to 5390\n",
"Index: 8512911 entries, 0 to 5391\n",
"Data columns (total 2 columns):\n",
" # Column Dtype \n",
"--- ------ ----- \n",
" 0 ts_code object\n",
" 1 trade_date object\n",
"dtypes: object(2)\n",
"memory usage: 194.7+ MB\n",
"memory usage: 194.8+ MB\n",
"None\n",
"20250407\n",
"20250408\n"
"20250408\n",
"20250409\n"
]
}
],
@@ -133,8 +133,8 @@
"metadata": {
"scrolled": true,
"ExecuteTime": {
"end_time": "2025-04-08T13:37:39.056144Z",
"start_time": "2025-04-08T13:37:37.770718Z"
"end_time": "2025-04-09T14:58:16.817010Z",
"start_time": "2025-04-09T14:58:09.326485Z"
}
},
"source": [
@@ -192,15 +192,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250417 完成\n",
"任务 20250418 完成\n",
"任务 20250417 完成\n",
"任务 20250416 完成\n",
"任务 20250415 完成\n",
"任务 20250411 完成\n",
"任务 20250414 完成\n",
"任务 20250411 完成\n",
"任务 20250410 完成\n",
"任务 20250409 完成\n",
"任务 20250408 完成\n"
"任务 20250409 完成\n"
]
}
],
@@ -211,8 +210,8 @@
"id": "919023c693d7a47a",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:39.072117Z",
"start_time": "2025-04-08T13:37:39.062189Z"
"end_time": "2025-04-09T14:58:16.864178Z",
"start_time": "2025-04-09T14:58:16.855084Z"
}
},
"source": [
@@ -225,58 +224,58 @@
"output_type": "stream",
"text": [
" ts_code trade_date close turnover_rate turnover_rate_f \\\n",
"0 300504.SZ 20250408 12.65 2.5494 4.8465 \n",
"1 002223.SZ 20250408 34.24 0.9832 1.6194 \n",
"2 002036.SZ 20250408 9.13 7.4710 8.1827 \n",
"3 688207.SH 20250408 12.29 4.6144 4.6144 \n",
"4 002401.SZ 20250408 13.88 4.9037 9.6159 \n",
"0 300285.SZ 20250409 16.61 2.1086 2.2506 \n",
"1 300458.SZ 20250409 44.48 9.9286 11.7046 \n",
"2 605090.SH 20250409 23.81 0.6834 1.1888 \n",
"3 688686.SH 20250409 69.52 1.6005 5.7492 \n",
"4 002057.SZ 20250409 7.18 4.7461 7.1088 \n",
"... ... ... ... ... ... \n",
"5387 600610.SH 20250408 7.56 18.8004 29.6937 \n",
"5388 002215.SZ 20250408 8.84 5.7658 6.7838 \n",
"5389 600694.SH 20250408 25.00 3.3101 5.4481 \n",
"5390 600121.SH 20250408 3.66 3.0305 6.3012 \n",
"5391 873167.BJ 20250408 21.56 7.8805 14.2434 \n",
"5390 301511.SZ 20250409 12.23 3.4040 4.6900 \n",
"5391 688355.SH 20250409 15.84 1.4154 4.4898 \n",
"5392 600019.SH 20250409 6.83 0.4729 1.2898 \n",
"5393 603507.SH 20250409 22.00 30.8936 42.4775 \n",
"5394 600886.SH 20250409 14.58 0.7795 2.4989 \n",
"\n",
" volume_ratio pe pe_ttm pb ps ps_ttm dv_ratio \\\n",
"0 1.56 34.0479 220.6414 1.5349 1.3422 1.7126 1.5892 \n",
"1 1.07 14.3268 19.7636 2.8291 4.3058 4.6786 3.5030 \n",
"2 2.45 NaN NaN 3.6899 0.9822 0.9210 0.0000 \n",
"3 1.61 NaN NaN 1.5605 12.1348 26.4230 NaN \n",
"4 1.44 40.4258 40.4258 3.0931 2.8715 2.8715 1.2977 \n",
"0 1.11 29.0985 27.1266 2.5144 4.2913 4.1010 0.6020 \n",
"1 1.54 168.9309 168.9309 9.3966 12.3119 12.3119 0.3364 \n",
"2 1.00 11.8377 9.0427 1.7135 0.5819 0.6421 3.2226 \n",
"3 1.18 43.8690 61.1222 2.9105 9.0031 9.2377 NaN \n",
"4 1.35 19.8304 29.3370 1.7625 1.9656 2.0487 3.2191 \n",
"... ... ... ... ... ... ... ... \n",
"5387 1.18 NaN NaN 122.1550 7.3648 7.3648 0.0000 \n",
"5388 2.49 37.7118 20.0533 2.2997 2.1570 1.7934 1.7092 \n",
"5389 3.51 15.4938 13.3524 0.9057 1.0676 1.1271 3.6364 \n",
"5390 1.13 15.7764 15.7764 2.3738 1.0605 1.0605 0.0000 \n",
"5391 0.79 33.5290 65.6770 3.2183 7.0572 9.9201 NaN \n",
"5390 1.36 58.1209 NaN 1.9116 1.1803 1.1129 0.3212 \n",
"5391 1.31 133.9017 29.7427 1.8103 3.6805 3.1067 NaN \n",
"5392 1.28 12.5281 15.7915 0.7518 0.4344 0.4503 4.4796 \n",
"5393 2.89 22.7537 22.7537 1.6401 1.0276 1.0276 1.3553 \n",
"5394 1.04 17.4059 16.1402 1.8424 2.0579 1.9930 3.1604 \n",
"\n",
" dv_ttm total_share float_share free_share total_mv \\\n",
"0 1.5892 27102.4580 21826.2631 11481.0786 3.428461e+05 \n",
"1 3.5030 100247.6929 93867.3649 56990.4202 3.432481e+06 \n",
"2 NaN 105938.4915 105290.9483 96132.5171 9.672184e+05 \n",
"3 NaN 25897.3147 18867.6306 18867.6306 3.182780e+05 \n",
"4 1.2977 37166.8440 37136.3940 18937.9540 5.158758e+05 \n",
"0 0.6020 9.970483e+04 8.039498e+04 75323.2612 1.656097e+06 \n",
"1 0.3364 6.332851e+04 5.179696e+04 43937.3622 2.816852e+06 \n",
"2 3.2226 6.492580e+04 6.426965e+04 36946.4646 1.545883e+06 \n",
"3 NaN 1.222355e+04 1.222355e+04 3402.7889 8.497809e+05 \n",
"4 3.2191 7.584828e+04 7.501396e+04 50081.8345 5.445906e+05 \n",
"... ... ... ... ... ... \n",
"5387 NaN 107127.4605 70872.6705 44872.6705 8.098836e+05 \n",
"5388 1.7092 100519.1310 79400.9515 67486.1454 8.885891e+05 \n",
"5389 3.6364 31305.2571 31305.2571 19020.4513 7.826314e+05 \n",
"5390 NaN 121841.2038 121841.2038 58597.2758 4.459388e+05 \n",
"5391 NaN 7086.1250 4178.1867 2311.6822 1.527769e+05 \n",
"5390 0.3212 6.303220e+04 3.736720e+04 27120.6014 7.708838e+05 \n",
"5391 NaN 1.239561e+04 1.239561e+04 3907.6756 1.963464e+05 \n",
"5392 4.4796 2.190864e+06 2.178208e+06 798651.6922 1.496360e+07 \n",
"5393 1.3553 1.843013e+04 1.843013e+04 13404.1045 4.054629e+05 \n",
"5394 3.1604 8.004494e+05 7.454180e+05 232532.2636 1.167055e+07 \n",
"\n",
" circ_mv is_st \n",
"0 2.761022e+05 False \n",
"1 3.214019e+06 False \n",
"2 9.613064e+05 False \n",
"3 2.318832e+05 False \n",
"4 5.154531e+05 False \n",
"0 1.335361e+06 False \n",
"1 2.303929e+06 False \n",
"2 1.530260e+06 False \n",
"3 8.497809e+05 False \n",
"4 5.386002e+05 False \n",
"... ... ... \n",
"5387 5.357974e+05 False \n",
"5388 7.019044e+05 False \n",
"5389 7.826314e+05 False \n",
"5390 4.459388e+05 False \n",
"5391 9.008171e+04 False \n",
"5390 4.570009e+05 False \n",
"5391 1.963464e+05 False \n",
"5392 1.487716e+07 False \n",
"5393 4.054629e+05 False \n",
"5394 1.086819e+07 False \n",
"\n",
"[5392 rows x 19 columns]\n"
"[5395 rows x 19 columns]\n"
]
}
],
@@ -287,8 +286,8 @@
"id": "28cb78d032671b20",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:39.103515Z",
"start_time": "2025-04-08T13:37:39.093908Z"
"end_time": "2025-04-09T14:58:16.881685Z",
"start_time": "2025-04-09T14:58:16.871184Z"
}
},
"source": [
@@ -300,56 +299,56 @@
"output_type": "stream",
"text": [
" ts_code trade_date close turnover_rate turnover_rate_f \\\n",
"20 000488.SZ 20250408 1.74 2.5808 3.5449 \n",
"21 603608.SH 20250408 4.20 0.2313 0.3624 \n",
"88 603363.SH 20250408 3.35 1.2763 1.4156 \n",
"124 000989.SZ 20250408 7.60 2.5216 3.5863 \n",
"136 300965.SZ 20250408 36.20 1.9389 2.6640 \n",
"85 002822.SZ 20250409 3.11 1.8467 1.9219 \n",
"123 603959.SH 20250409 3.27 1.7568 2.2420 \n",
"181 688282.SH 20250409 42.59 2.5546 3.0570 \n",
"259 600777.SH 20250409 2.66 1.9331 2.4597 \n",
"283 002052.SZ 20250409 6.15 1.5326 2.5481 \n",
"... ... ... ... ... ... \n",
"5261 603879.SH 20250408 4.13 4.3647 6.8212 \n",
"5273 002024.SZ 20250408 1.76 0.5005 1.3623 \n",
"5298 603828.SH 20250408 4.43 1.3711 2.7554 \n",
"5337 600234.SH 20250408 5.53 0.5518 1.0422 \n",
"5370 300536.SZ 20250408 7.99 2.2037 2.7214 \n",
"5286 002602.SZ 20250409 5.93 3.0376 3.5162 \n",
"5345 002501.SZ 20250409 1.89 4.3252 5.5834 \n",
"5364 600387.SH 20250409 2.34 0.0904 0.1163 \n",
"5366 002656.SZ 20250409 1.95 2.7047 3.0210 \n",
"5378 300013.SZ 20250409 3.57 2.8370 3.1107 \n",
"\n",
" volume_ratio pe pe_ttm pb ps ps_ttm dv_ratio \\\n",
"20 0.69 NaN NaN 0.5590 0.2252 0.2252 0.0000 \n",
"21 0.35 NaN NaN 1.5767 1.3841 1.5604 0.0000 \n",
"88 2.09 NaN NaN NaN 0.4481 0.7781 0.0000 \n",
"124 1.71 30.0883 30.0883 1.7332 2.7432 2.7432 5.2053 \n",
"136 1.27 NaN NaN 1.7736 NaN NaN 0.0829 \n",
"85 2.59 NaN NaN 1.2023 0.5923 0.7314 0.0 \n",
"123 2.22 NaN NaN 4.3282 0.7749 1.1811 0.0 \n",
"181 1.07 NaN NaN 2.9277 172.3150 21.9335 NaN \n",
"259 0.96 6.9694 7.6204 0.8381 2.0443 2.0567 0.0 \n",
"283 0.74 NaN NaN NaN 19.5551 17.1988 0.0 \n",
"... ... ... ... ... ... ... ... \n",
"5261 1.67 NaN NaN 5.6207 4.0072 4.0072 0.0000 \n",
"5273 1.06 26.7044 26.7044 1.3118 0.2871 0.2871 0.0000 \n",
"5298 0.38 NaN NaN 3.5130 1.0396 1.0348 0.0000 \n",
"5337 2.28 NaN NaN 3.2963 20.7089 9.4391 0.0000 \n",
"5370 0.86 NaN NaN 4.2696 32.8078 24.2873 0.0000 \n",
"5286 3.30 84.3318 49.2129 1.6993 3.3267 2.3228 0.0 \n",
"5345 1.75 NaN NaN 7.0441 14.0701 19.7111 0.0 \n",
"5364 1.33 NaN NaN 0.3818 0.5148 0.8454 0.0 \n",
"5366 1.75 NaN NaN 3.8456 4.7986 5.9354 0.0 \n",
"5378 0.90 NaN NaN 8.2438 4.8281 4.2666 0.0 \n",
"\n",
" dv_ttm total_share float_share free_share total_mv \\\n",
"20 NaN 294145.6200 167582.4530 122004.3211 5.118134e+05 \n",
"21 NaN 41971.5446 41971.5446 26785.1109 1.762805e+05 \n",
"88 NaN 260296.1826 146776.2912 132325.9245 8.719922e+05 \n",
"124 5.2053 85594.2012 69415.3353 48807.3173 6.505159e+05 \n",
"136 0.0829 6000.0000 2060.9250 1500.0000 2.172000e+05 \n",
"85 NaN 73467.1821 56245.3696 54046.3738 2.284829e+05 \n",
"123 NaN 49029.8992 49029.8992 38419.3842 1.603278e+05 \n",
"181 NaN 8800.0000 3652.0000 3051.8414 3.747920e+05 \n",
"259 NaN 680049.5825 636615.2391 500325.8436 1.808932e+06 \n",
"283 NaN 74595.9694 74595.5944 44867.2806 4.587652e+05 \n",
"... ... ... ... ... ... \n",
"5261 NaN 35934.4440 35934.4440 22993.7696 1.484093e+05 \n",
"5273 NaN 926476.7618 925444.1318 340007.5385 1.630599e+06 \n",
"5298 NaN 59596.0158 59593.9625 29654.2988 2.640103e+05 \n",
"5337 NaN 26252.0973 26252.0973 13899.8888 1.451741e+05 \n",
"5370 NaN 29328.8133 29325.3240 23747.3240 2.343372e+05 \n",
"5286 NaN 745255.6968 687870.8273 594244.1179 4.419366e+06 \n",
"5345 NaN 355000.0000 354999.9006 274999.9006 6.709500e+05 \n",
"5364 NaN 46814.4464 40404.8492 31411.4405 1.095458e+05 \n",
"5366 NaN 71251.9844 60945.7555 54564.8212 1.389414e+05 \n",
"5378 NaN 55835.8894 44606.0865 40680.8215 1.993341e+05 \n",
"\n",
" circ_mv is_st \n",
"20 2.915935e+05 True \n",
"21 1.762805e+05 True \n",
"88 4.917006e+05 True \n",
"124 5.275565e+05 True \n",
"136 7.460549e+04 True \n",
"85 1.749231e+05 True \n",
"123 1.603278e+05 True \n",
"181 1.555387e+05 True \n",
"259 1.693397e+06 True \n",
"283 4.587629e+05 True \n",
"... ... ... \n",
"5261 1.484093e+05 True \n",
"5273 1.628782e+06 True \n",
"5298 2.640013e+05 True \n",
"5337 1.451741e+05 True \n",
"5370 2.343093e+05 True \n",
"5286 4.079074e+06 True \n",
"5345 6.709498e+05 True \n",
"5364 9.454735e+04 True \n",
"5366 1.188442e+05 True \n",
"5378 1.592437e+05 True \n",
"\n",
"[106 rows x 19 columns]\n"
]
@@ -362,8 +361,8 @@
"id": "692b58674b7462c9",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:39.921445Z",
"start_time": "2025-04-08T13:37:39.128232Z"
"end_time": "2025-04-09T14:58:17.773453Z",
"start_time": "2025-04-09T14:58:16.903459Z"
}
},
"source": [
@@ -388,8 +387,8 @@
"id": "d7a773fc20293477",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:46.393814Z",
"start_time": "2025-04-08T13:37:39.941474Z"
"end_time": "2025-04-09T14:58:24.305403Z",
"start_time": "2025-04-09T14:58:17.816332Z"
}
},
"source": [
@@ -403,7 +402,7 @@
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 8512911 entries, 0 to 5391\n",
"Index: 8518306 entries, 0 to 5394\n",
"Data columns (total 3 columns):\n",
" # Column Dtype \n",
"--- ------ ----- \n",
@@ -411,7 +410,7 @@
" 1 trade_date object\n",
" 2 is_st bool \n",
"dtypes: bool(1), object(2)\n",
"memory usage: 203.0+ MB\n",
"memory usage: 203.1+ MB\n",
"None\n"
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,8 +5,8 @@
"id": "b94bb1f2-5332-485e-ae1b-eea01f938106",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:11.623192Z",
"start_time": "2025-04-08T13:37:10.611486Z"
"end_time": "2025-04-09T14:57:40.184418Z",
"start_time": "2025-04-09T14:57:39.137312Z"
}
},
"source": [
@@ -23,8 +23,8 @@
"id": "742c29d453b9bb38",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:32.754262Z",
"start_time": "2025-04-08T13:37:11.629198Z"
"end_time": "2025-04-09T14:58:10.515830Z",
"start_time": "2025-04-09T14:57:40.190466Z"
}
},
"source": [
@@ -52,17 +52,17 @@
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 8348584 entries, 0 to 5125\n",
"Index: 8353711 entries, 0 to 5126\n",
"Data columns (total 2 columns):\n",
" # Column Dtype \n",
"--- ------ ----- \n",
" 0 ts_code object\n",
" 1 trade_date object\n",
"dtypes: object(2)\n",
"memory usage: 191.1+ MB\n",
"memory usage: 191.2+ MB\n",
"None\n",
"20250407\n",
"start_date: 20250408\n"
"20250408\n",
"start_date: 20250409\n"
]
}
],
@@ -74,8 +74,8 @@
"metadata": {
"scrolled": true,
"ExecuteTime": {
"end_time": "2025-04-08T13:37:34.659267Z",
"start_time": "2025-04-08T13:37:33.094502Z"
"end_time": "2025-04-09T14:58:17.197319Z",
"start_time": "2025-04-09T14:58:10.724923Z"
}
},
"source": [
@@ -115,13 +115,12 @@
"text": [
"任务 20250417 完成\n",
"任务 20250418 完成\n",
"任务 20250415 完成\n",
"任务 20250416 完成\n",
"任务 20250414 完成\n",
"任务 20250415 完成\n",
"任务 20250411 完成\n",
"任务 20250414 完成\n",
"任务 20250410 完成\n",
"任务 20250409 完成\n",
"任务 20250408 完成\n"
"任务 20250409 完成\n"
]
}
],
@@ -132,8 +131,8 @@
"id": "9af80516849d4e80",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:34.678164Z",
"start_time": "2025-04-08T13:37:34.674804Z"
"end_time": "2025-04-09T14:58:17.214168Z",
"start_time": "2025-04-09T14:58:17.210734Z"
}
},
"source": [
@@ -147,8 +146,8 @@
"id": "a2b05187-437f-4053-bc43-bd80d4cf8b0e",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:37.285649Z",
"start_time": "2025-04-08T13:37:34.694595Z"
"end_time": "2025-04-09T14:58:19.633456Z",
"start_time": "2025-04-09T14:58:17.229837Z"
}
},
"source": [

View File

@@ -5,8 +5,8 @@
"id": "500802dc-7a20-48b7-a470-a4bae3ec534b",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:12.814092Z",
"start_time": "2025-04-08T13:37:11.953133Z"
"end_time": "2025-04-09T14:57:41.532210Z",
"start_time": "2025-04-09T14:57:40.584930Z"
}
},
"source": [
@@ -23,8 +23,8 @@
"id": "5a84bc9da6d54868",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:35.724923Z",
"start_time": "2025-04-08T13:37:12.820096Z"
"end_time": "2025-04-09T14:58:04.911924Z",
"start_time": "2025-04-09T14:57:41.540345Z"
}
},
"source": [
@@ -81,8 +81,8 @@
"metadata": {
"scrolled": true,
"ExecuteTime": {
"end_time": "2025-04-08T13:37:36.896959Z",
"start_time": "2025-04-08T13:37:35.931558Z"
"end_time": "2025-04-09T14:58:09.342522Z",
"start_time": "2025-04-09T14:58:05.259974Z"
}
},
"source": [
@@ -121,14 +121,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250418 完成\n",
"任务 20250417 完成\n",
"任务 20250418 完成\n",
"任务 20250416 完成\n",
"任务 20250415 完成\n",
"任务 20250414 完成\n",
"任务 20250411 完成\n",
"任务 20250410 完成\n",
"任务 20250409 完成\n",
"任务 20250410 完成\n"
"任务 20250411 完成\n"
]
}
],
@@ -139,8 +139,8 @@
"id": "96a81aa5890ea3c3",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:37.699901Z",
"start_time": "2025-04-08T13:37:36.909744Z"
"end_time": "2025-04-09T14:58:09.353560Z",
"start_time": "2025-04-09T14:58:09.346528Z"
}
},
"source": [
@@ -153,21 +153,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[]\n"
]
},
{
"ename": "ValueError",
"evalue": "No objects to concatenate",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mValueError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[1;32mIn[4], line 3\u001B[0m\n\u001B[0;32m 1\u001B[0m \u001B[38;5;28mprint\u001B[39m(all_daily_data)\n\u001B[0;32m 2\u001B[0m \u001B[38;5;66;03m# 将所有数据合并为一个 DataFrame\u001B[39;00m\n\u001B[1;32m----> 3\u001B[0m all_daily_data_df \u001B[38;5;241m=\u001B[39m pd\u001B[38;5;241m.\u001B[39mconcat(all_daily_data, ignore_index\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m)\n",
"File \u001B[1;32mE:\\Python\\anaconda\\envs\\new_trader\\Lib\\site-packages\\pandas\\core\\reshape\\concat.py:382\u001B[0m, in \u001B[0;36mconcat\u001B[1;34m(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)\u001B[0m\n\u001B[0;32m 379\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m copy \u001B[38;5;129;01mand\u001B[39;00m using_copy_on_write():\n\u001B[0;32m 380\u001B[0m copy \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mFalse\u001B[39;00m\n\u001B[1;32m--> 382\u001B[0m op \u001B[38;5;241m=\u001B[39m _Concatenator(\n\u001B[0;32m 383\u001B[0m objs,\n\u001B[0;32m 384\u001B[0m axis\u001B[38;5;241m=\u001B[39maxis,\n\u001B[0;32m 385\u001B[0m ignore_index\u001B[38;5;241m=\u001B[39mignore_index,\n\u001B[0;32m 386\u001B[0m join\u001B[38;5;241m=\u001B[39mjoin,\n\u001B[0;32m 387\u001B[0m keys\u001B[38;5;241m=\u001B[39mkeys,\n\u001B[0;32m 388\u001B[0m levels\u001B[38;5;241m=\u001B[39mlevels,\n\u001B[0;32m 389\u001B[0m names\u001B[38;5;241m=\u001B[39mnames,\n\u001B[0;32m 390\u001B[0m verify_integrity\u001B[38;5;241m=\u001B[39mverify_integrity,\n\u001B[0;32m 391\u001B[0m copy\u001B[38;5;241m=\u001B[39mcopy,\n\u001B[0;32m 392\u001B[0m sort\u001B[38;5;241m=\u001B[39msort,\n\u001B[0;32m 393\u001B[0m )\n\u001B[0;32m 395\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m op\u001B[38;5;241m.\u001B[39mget_result()\n",
"File \u001B[1;32mE:\\Python\\anaconda\\envs\\new_trader\\Lib\\site-packages\\pandas\\core\\reshape\\concat.py:445\u001B[0m, in \u001B[0;36m_Concatenator.__init__\u001B[1;34m(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)\u001B[0m\n\u001B[0;32m 442\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mverify_integrity \u001B[38;5;241m=\u001B[39m verify_integrity\n\u001B[0;32m 443\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcopy \u001B[38;5;241m=\u001B[39m copy\n\u001B[1;32m--> 445\u001B[0m objs, keys \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_clean_keys_and_objs(objs, keys)\n\u001B[0;32m 447\u001B[0m \u001B[38;5;66;03m# figure out what our result ndim is going to be\u001B[39;00m\n\u001B[0;32m 448\u001B[0m ndims \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_get_ndims(objs)\n",
"File \u001B[1;32mE:\\Python\\anaconda\\envs\\new_trader\\Lib\\site-packages\\pandas\\core\\reshape\\concat.py:507\u001B[0m, in \u001B[0;36m_Concatenator._clean_keys_and_objs\u001B[1;34m(self, objs, keys)\u001B[0m\n\u001B[0;32m 504\u001B[0m objs_list \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlist\u001B[39m(objs)\n\u001B[0;32m 506\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(objs_list) \u001B[38;5;241m==\u001B[39m \u001B[38;5;241m0\u001B[39m:\n\u001B[1;32m--> 507\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mNo objects to concatenate\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m 509\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m keys \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[0;32m 510\u001B[0m objs_list \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlist\u001B[39m(com\u001B[38;5;241m.\u001B[39mnot_none(\u001B[38;5;241m*\u001B[39mobjs_list))\n",
"\u001B[1;31mValueError\u001B[0m: No objects to concatenate"
"[ trade_date ts_code up_limit down_limit\n",
"0 20250409 000001.SZ 11.90 9.74\n",
"1 20250409 000002.SZ 7.48 6.12\n",
"2 20250409 000004.SZ 9.53 7.79\n",
"3 20250409 000006.SZ 6.28 5.14\n",
"4 20250409 000007.SZ 5.91 4.83\n",
"... ... ... ... ...\n",
"7077 20250409 920108.BJ 26.55 14.31\n",
"7078 20250409 920111.BJ 30.84 16.62\n",
"7079 20250409 920116.BJ 100.29 54.01\n",
"7080 20250409 920118.BJ 31.62 17.04\n",
"7081 20250409 920128.BJ 35.26 19.00\n",
"\n",
"[7082 rows x 4 columns]]\n"
]
}
],
@@ -175,14 +174,21 @@
},
{
"cell_type": "code",
"execution_count": 5,
"id": "ad9733a1-2f42-43ee-a98c-0bf699304c21",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:37.748574900Z",
"start_time": "2025-04-06T15:34:48.693158Z"
"end_time": "2025-04-09T14:58:09.674078Z",
"start_time": "2025-04-09T14:58:09.366441Z"
}
},
"source": [
"\n",
"\n",
"# 将数据保存为 HDF5 文件table 格式)\n",
"all_daily_data_df.to_hdf(h5_filename, key='stk_limit', mode='a', format='table', append=True, data_columns=True)\n",
"\n",
"print(\"所有每日基础数据获取并保存完毕!\")"
],
"outputs": [
{
"name": "stdout",
@@ -192,27 +198,20 @@
]
}
],
"source": [
"\n",
"\n",
"# 将数据保存为 HDF5 文件table 格式)\n",
"all_daily_data_df.to_hdf(h5_filename, key='stk_limit', mode='a', format='table', append=True, data_columns=True)\n",
"\n",
"print(\"所有每日基础数据获取并保存完毕!\")"
]
"execution_count": 5
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e777f1f-4d54-4a74-b916-691ede6af055",
"metadata": {
"ExecuteTime": {
"end_time": "2025-04-08T13:37:37.762102Z",
"start_time": "2025-04-06T15:34:48.977771Z"
"end_time": "2025-04-09T14:58:09.689422Z",
"start_time": "2025-04-09T14:58:09.686524Z"
}
},
"source": [],
"outputs": [],
"source": []
"execution_count": null
}
],
"metadata": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff