新环境3

This commit is contained in:
2025-06-02 22:23:44 +08:00
parent 76ebd72fb3
commit ff2a5f8b18
28 changed files with 9951 additions and 7448 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 5,
"id": "initial_id",
"metadata": {
"ExecuteTime": {
@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 6,
"id": "f448da220816bf98",
"metadata": {
"ExecuteTime": {
@@ -63,14 +63,14 @@
"final_df = pd.concat(all_data, ignore_index=True)\n",
"\n",
"# 存储到H5文件\n",
"final_df.to_hdf('../../data/index_data.h5', key='index_data', mode='w')\n",
"final_df.to_hdf('/mnt/d/PyProject/NewStock/data/index_data.h5', key='index_data', mode='w')\n",
"\n",
"print(\"数据已经成功存储到index_data.h5文件中\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 7,
"id": "907f732d3c397bf",
"metadata": {
"ExecuteTime": {
@@ -84,37 +84,37 @@
"output_type": "stream",
"text": [
" ts_code trade_date close open high low \\\n",
"0 000905.SH 20250523 5653.0436 5697.1362 5738.0829 5653.0436 \n",
"1 000905.SH 20250522 5703.2797 5739.1909 5757.7946 5701.1614 \n",
"2 000905.SH 20250521 5757.9225 5741.6885 5763.0788 5733.8275 \n",
"3 000905.SH 20250520 5747.3670 5723.5055 5759.4582 5707.8101 \n",
"4 000905.SH 20250519 5720.7949 5719.4381 5729.0703 5669.7208 \n",
"0 000905.SH 20250530 5671.0723 5704.7710 5704.7710 5665.5177 \n",
"1 000905.SH 20250529 5719.9101 5637.0633 5724.5185 5637.0633 \n",
"2 000905.SH 20250528 5637.2378 5651.8755 5660.4696 5628.4165 \n",
"3 000905.SH 20250527 5652.1454 5666.3027 5667.8710 5629.1343 \n",
"4 000905.SH 20250526 5669.4609 5653.2063 5693.6250 5644.5794 \n",
"... ... ... ... ... ... ... \n",
"13531 399006.SZ 20100607 1069.4680 1005.0280 1075.2250 1001.7020 \n",
"13532 399006.SZ 20100604 1027.6810 989.6810 1027.6810 986.5040 \n",
"13533 399006.SZ 20100603 998.3940 1002.3550 1026.7020 997.7750 \n",
"13534 399006.SZ 20100602 997.1190 967.6090 997.1190 952.6110 \n",
"13535 399006.SZ 20100601 973.2330 986.0150 994.7930 948.1180 \n",
"13546 399006.SZ 20100607 1069.4680 1005.0280 1075.2250 1001.7020 \n",
"13547 399006.SZ 20100604 1027.6810 989.6810 1027.6810 986.5040 \n",
"13548 399006.SZ 20100603 998.3940 1002.3550 1026.7020 997.7750 \n",
"13549 399006.SZ 20100602 997.1190 967.6090 997.1190 952.6110 \n",
"13550 399006.SZ 20100601 973.2330 986.0150 994.7930 948.1180 \n",
"\n",
" pre_close change pct_chg vol amount \n",
"0 5703.2797 -50.2361 -0.8808 1.143612e+08 1.481236e+08 \n",
"1 5757.9225 -54.6428 -0.9490 1.090577e+08 1.416209e+08 \n",
"2 5747.3670 10.5555 0.1837 1.158045e+08 1.551474e+08 \n",
"3 5720.7949 26.5721 0.4645 1.168966e+08 1.517512e+08 \n",
"4 5715.8491 4.9458 0.0865 1.153849e+08 1.410987e+08 \n",
"0 5719.9101 -48.8378 -0.8538 1.099007e+08 1.376706e+08 \n",
"1 5637.2378 82.6723 1.4665 1.146825e+08 1.480951e+08 \n",
"2 5652.1454 -14.9076 -0.2638 9.490888e+07 1.199598e+08 \n",
"3 5669.4609 -17.3155 -0.3054 9.514936e+07 1.252757e+08 \n",
"4 5653.0436 16.4173 0.2904 9.717099e+07 1.273436e+08 \n",
"... ... ... ... ... ... \n",
"13531 1027.6810 41.7870 4.0661 2.655275e+06 9.106095e+06 \n",
"13532 998.3940 29.2870 2.9334 1.500295e+06 5.269441e+06 \n",
"13533 997.1190 1.2750 0.1279 1.616805e+06 6.240835e+06 \n",
"13534 973.2330 23.8860 2.4543 1.074628e+06 4.001206e+06 \n",
"13535 1000.0000 -26.7670 -2.6767 1.356285e+06 4.924177e+06 \n",
"13546 1027.6810 41.7870 4.0661 2.655275e+06 9.106095e+06 \n",
"13547 998.3940 29.2870 2.9334 1.500295e+06 5.269441e+06 \n",
"13548 997.1190 1.2750 0.1279 1.616805e+06 6.240835e+06 \n",
"13549 973.2330 23.8860 2.4543 1.074628e+06 4.001206e+06 \n",
"13550 1000.0000 -26.7670 -2.6767 1.356285e+06 4.924177e+06 \n",
"\n",
"[13536 rows x 11 columns]\n"
"[13551 rows x 11 columns]\n"
]
}
],
"source": [
"h5_filename = '../../data/index_data.h5'\n",
"h5_filename = '/mnt/d/PyProject/NewStock/data/index_data.h5'\n",
"key = '/index_data'\n",
"with pd.HDFStore(h5_filename, mode='r') as store:\n",
" df = store[key]\n",
@@ -124,7 +124,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "new_trader",
"display_name": "stock",
"language": "python",
"name": "python3"
},
@@ -138,7 +138,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.11"
"version": "3.13.2"
}
},
"nbformat": 4,