This commit is contained in:
liaozhaorun
2025-02-12 00:21:33 +08:00
commit 71c9496df8
24 changed files with 34783 additions and 0 deletions

12
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,12 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
.ipynb_checkpoints
../data/

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

6
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="E:\Python\anaconda\envs\try_trader" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/NewStock.iml" filepath="$PROJECT_DIR$/.idea/NewStock.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

2259
code/data/daily_basic.ipynb Normal file

File diff suppressed because it is too large Load Diff

5556
code/data/daily_data.ipynb Normal file

File diff suppressed because it is too large Load Diff

10
code/data/daily_data.py Normal file
View File

@@ -0,0 +1,10 @@
import tushare as ts
ts.set_token('3a0741c702ee7e5e5f2bf1f0846bafaafe4e320833240b2a7e4a685f')
pro = ts.pro_api()
import pandas as pd
import time
# 读取本地保存的股票列表 CSV 文件(假设文件名为 stocks_data.csv
df = ts.pro_bar(ts_code='000001.SZ', adj='hfq', start_date='20180101')
print(df)

156
code/data/is_st.ipynb Normal file
View File

@@ -0,0 +1,156 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "17cc645336d4eb18",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:55:19.819017Z",
"start_time": "2025-02-08T16:55:18.958639Z"
}
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import tushare as ts"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "48ae71ed02d61819",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:55:27.578361Z",
"start_time": "2025-02-08T16:55:19.882313Z"
}
},
"outputs": [],
"source": [
"daily_basic = pd.read_hdf('../../data/daily_basic.h5', key='daily_basic')\n",
"name_change_df = pd.read_hdf('../../data/name_change.h5', key='name_change')\n",
"name_change_df = name_change_df.drop_duplicates(keep='first')\n",
"\n",
"# 确保 name_change_df 的日期格式正确\n",
"name_change_df['start_date'] = pd.to_datetime(name_change_df['start_date'], format='%Y%m%d')\n",
"name_change_df['end_date'] = pd.to_datetime(name_change_df['end_date'], format='%Y%m%d', errors='coerce')\n",
"name_change_df = name_change_df[name_change_df.name.str.contains('ST')]\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e6606a96e5728b8",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:55:27.938078Z",
"start_time": "2025-02-08T16:55:27.584226Z"
}
},
"outputs": [],
"source": [
"name_change_dict = {}\n",
"for ts_code, group in name_change_df.groupby('ts_code'):\n",
" # 只保留 'ST' 和 '*ST' 的记录\n",
" st_data = group[(group['change_reason'] == 'ST') | (group['change_reason'] == '*ST')]\n",
" if not st_data.empty:\n",
" name_change_dict[ts_code] = st_data"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "initial_id",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:59:20.537632Z",
"start_time": "2025-02-08T16:55:27.971219Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"is st...\n",
" ts_code trade_date is_st\n",
"0 688283.SH 20250207 False\n",
"1 002635.SZ 20250207 False\n",
"2 002463.SZ 20250207 False\n",
"3 603959.SH 20250207 False\n",
"4 688361.SH 20250207 False\n"
]
}
],
"source": [
"from datetime import datetime\n",
"import pandas as pd\n",
"\n",
"\n",
"# 判断股票是否为 ST 的函数\n",
"#stock_code = 'xxxxxx.SH'\n",
"#target_date = '20200830'\n",
"#若为ST返回True否则返回False\n",
"def is_st(name_change_dict, stock_code, target_date):\n",
" target_date = datetime.strptime(target_date, '%Y%m%d')\n",
" if stock_code not in name_change_dict.keys():\n",
" return False\n",
" df = name_change_dict[stock_code]\n",
" for i in range(len(df)):\n",
" sds = df.iloc[i, 2]\n",
" eds = df.iloc[i, 3]\n",
" # sd = datetime.strptime(sds, '%Y%m%d')\n",
" if eds == None:\n",
" ed = datetime.now()\n",
" # else:\n",
" # ed = datetime.strptime(eds, '%Y%m%d')\n",
" if (target_date - sds).days >= 0 and (target_date - eds).days <= 0:\n",
" return True\n",
" return False\n",
"\n",
"\n",
"print('is st...')\n",
"# 创建一个新的列 is_st判断每只股票是否是 ST\n",
"daily_basic['is_st'] = daily_basic.apply(\n",
" lambda row: is_st(name_change_dict, row['ts_code'], row['trade_date']), axis=1\n",
")\n",
"\n",
"# 保存结果到新的 HDF5 文件\n",
"daily_basic.to_hdf('../../data/daily_basic.h5', key='daily_basic', mode='w', format='table')\n",
"\n",
"# 输出部分结果\n",
"print(daily_basic[['ts_code', 'trade_date', 'is_st']].head())\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "30c882de-3a89-4056-900d-459a3a012af9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

2087
code/data/money_flow.ipynb Normal file

File diff suppressed because it is too large Load Diff

5906
code/data/name_change.ipynb Normal file

File diff suppressed because it is too large Load Diff

2109
code/data/stk_limit.ipynb Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,424 @@
{
"cells": [
{
"cell_type": "code",
"id": "18d1d622-b083-4cc4-a6f8-7c1ed2d0edd2",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:43:54.745322Z",
"start_time": "2025-02-11T15:43:53.837662Z"
}
},
"source": [
"import tushare as ts\n",
"ts.set_token('3a0741c702ee7e5e5f2bf1f0846bafaafe4e320833240b2a7e4a685f')\n",
"pro = ts.pro_api()"
],
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:53:08.235573Z",
"start_time": "2025-02-11T15:53:07.753701Z"
}
},
"cell_type": "code",
"source": [
"from datetime import datetime\n",
"import pandas as pd\n",
"\n",
"def is_st(name_change_dict, stock_code, target_date):\n",
" target_date = datetime.strptime(target_date, '%Y%m%d')\n",
" if stock_code not in name_change_dict.keys():\n",
" return False\n",
" df = name_change_dict[stock_code]\n",
" for i in range(len(df)):\n",
" sds = df.iloc[i, 2]\n",
" eds = df.iloc[i, 3]\n",
" if eds is None or eds is pd.NaT:\n",
" eds = datetime.now()\n",
" if (target_date - sds).days >= 0 and (target_date - eds).days <= 0:\n",
" return True\n",
" return False\n",
"\n",
"name_change_df = pd.read_hdf('../../../data/name_change.h5', key='name_change')\n",
"name_change_df = name_change_df.drop_duplicates(keep='first')\n",
"\n",
"# 确保 name_change_df 的日期格式正确\n",
"name_change_df['start_date'] = pd.to_datetime(name_change_df['start_date'], format='%Y%m%d')\n",
"name_change_df['end_date'] = pd.to_datetime(name_change_df['end_date'], format='%Y%m%d', errors='coerce')\n",
"name_change_df = name_change_df[name_change_df.name.str.contains('ST')]\n",
"name_change_dict = {}\n",
"for ts_code, group in name_change_df.groupby('ts_code'):\n",
" # 只保留 'ST' 和 '*ST' 的记录\n",
" st_data = group[(group['change_reason'] == 'ST') | (group['change_reason'] == '*ST')]\n",
" if not st_data.empty:\n",
" name_change_dict[ts_code] = st_data"
],
"id": "14671a7f72de2564",
"outputs": [],
"execution_count": 31
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:53:19.812860Z",
"start_time": "2025-02-11T15:53:09.614377Z"
}
},
"cell_type": "code",
"source": [
"import time\n",
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
"\n",
"h5_filename = '../../../data/daily_basic.h5'\n",
"key = '/daily_basic'\n",
"max_date = None\n",
"with pd.HDFStore(h5_filename, mode='r') as store:\n",
" df = store[key][['ts_code', 'trade_date']]\n",
" print(df.info())\n",
" max_date = df['trade_date'].max()\n",
"\n",
"print(max_date)\n",
"trade_cal = pro.trade_cal(exchange='', start_date='20170101', end_date='20250220')\n",
"trade_cal = trade_cal[trade_cal['is_open'] == 1] # 只保留交易日\n",
"trade_dates = trade_cal[trade_cal['cal_date'] > max_date]['cal_date'].tolist()\n",
"start_date = min(trade_dates)\n",
"print(start_date)"
],
"id": "e7f8cce2f80e2f20",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 8295494 entries, 0 to 8295493\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: 189.9+ MB\n",
"None\n",
"20250210\n",
"20250211\n"
]
}
],
"execution_count": 32
},
{
"cell_type": "code",
"id": "553cfb36-f560-4cc4-b2bc-68323ccc5072",
"metadata": {
"scrolled": true,
"ExecuteTime": {
"end_time": "2025-02-11T15:53:24.100612Z",
"start_time": "2025-02-11T15:53:22.361257Z"
}
},
"source": [
"\n",
"\n",
"# 使用 HDFStore 存储数据\n",
"all_daily_data = []\n",
"\n",
"# API 调用计数和时间控制变量\n",
"api_call_count = 0\n",
"batch_start_time = time.time()\n",
"\n",
"\n",
"def get_data(trade_date):\n",
" daily_basic_data = pro.daily_basic(ts_code='', trade_date=trade_date)\n",
" if daily_basic_data is not None and not daily_basic_data.empty:\n",
" # 添加交易日期列标识\n",
" daily_basic_data['trade_date'] = trade_date\n",
" daily_basic_data['is_st'] = daily_basic_data.apply(\n",
" lambda row: is_st(name_change_dict, row['ts_code'], row['trade_date']), axis=1\n",
" )\n",
" time.sleep(0.2)\n",
" # print(f\"成功获取并保存 {trade_date} 的每日基础数据\")\n",
" return daily_basic_data\n",
"\n",
"\n",
"# 遍历每个交易日期并获取数据\n",
"with ThreadPoolExecutor(max_workers=2) as executor:\n",
" future_to_date = {executor.submit(get_data, td): td for td in trade_dates}\n",
"\n",
" for future in as_completed(future_to_date):\n",
" trade_date = future_to_date[future] # 获取对应的交易日期\n",
" try:\n",
" result = future.result() # 获取任务执行的结果\n",
" all_daily_data.append(result)\n",
" print(f\"任务 {trade_date} 完成\")\n",
" except Exception as e:\n",
" print(f\"获取 {trade_date} 数据时出错: {e}\")\n",
" # 计数一次 API 调用\n",
" api_call_count += 1\n",
"\n",
" # 每调用 300 次,检查时间是否少于 1 分钟,如果少于则等待剩余时间\n",
" if api_call_count % 150 == 0:\n",
" elapsed = time.time() - batch_start_time\n",
" if elapsed < 60:\n",
" sleep_time = 60 - elapsed\n",
" print(f\"已调用 150 次 API等待 {sleep_time:.2f} 秒以满足速率限制...\")\n",
" time.sleep(sleep_time)\n",
" # 重置批次起始时间\n",
" batch_start_time = time.time()\n",
"\n"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250220 完成\n",
"任务 20250219 完成\n",
"任务 20250218 完成\n",
"任务 20250217 完成\n",
"任务 20250214 完成\n",
"任务 20250213 完成\n",
"任务 20250212 完成\n",
"任务 20250211 完成\n"
]
}
],
"execution_count": 33
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:53:25.913933Z",
"start_time": "2025-02-11T15:53:25.902629Z"
}
},
"cell_type": "code",
"source": [
"all_daily_data_df = pd.concat(all_daily_data, ignore_index=True)\n",
"print(all_daily_data_df)"
],
"id": "919023c693d7a47a",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" ts_code trade_date close turnover_rate turnover_rate_f \\\n",
"0 002512.SZ 20250211 5.03 5.9759 7.8713 \n",
"1 600966.SH 20250211 4.83 0.6904 1.3494 \n",
"2 600358.SH 20250211 3.68 8.5826 11.3780 \n",
"3 002893.SZ 20250211 9.73 1.9217 2.6415 \n",
"4 300648.SZ 20250211 22.90 1.7775 2.3188 \n",
"... ... ... ... ... ... \n",
"5380 300886.SZ 20250211 21.80 8.9341 13.4176 \n",
"5381 600050.SH 20250211 5.48 2.3899 5.6722 \n",
"5382 300149.SZ 20250211 6.73 3.5271 5.3077 \n",
"5383 002197.SZ 20250211 4.42 4.0058 4.6595 \n",
"5384 688270.SH 20250211 37.34 2.9212 2.9212 \n",
"\n",
" volume_ratio pe pe_ttm pb ps ps_ttm dv_ratio \\\n",
"0 0.87 NaN NaN 12.8888 2.9340 3.0625 0.0000 \n",
"1 1.16 35.5101 15.2315 0.9534 0.3454 0.3402 0.5633 \n",
"2 1.38 NaN NaN 15.2661 3.4220 4.2041 0.0000 \n",
"3 0.85 48.9883 41.5405 2.2074 2.3641 2.3637 0.8222 \n",
"4 0.69 NaN NaN 4.1442 3.7325 3.3186 0.0000 \n",
"... ... ... ... ... ... ... ... \n",
"5380 3.00 NaN 111.0678 2.9043 6.0326 4.9204 0.0000 \n",
"5381 1.15 21.3231 19.5079 1.0668 0.4677 0.4574 2.6625 \n",
"5382 1.34 NaN NaN 2.5009 2.9440 3.3158 0.0000 \n",
"5383 1.41 NaN NaN 1.1195 2.0851 2.5837 0.0000 \n",
"5384 0.75 110.2738 170.0477 3.7594 28.4642 27.3030 NaN \n",
"\n",
" dv_ttm total_share float_share free_share total_mv \\\n",
"0 NaN 1.147095e+05 1.048455e+05 7.959795e+04 5.769885e+05 \n",
"1 0.5633 1.336844e+05 1.336844e+05 6.839785e+04 6.456958e+05 \n",
"2 NaN 5.049367e+04 5.049367e+04 3.808829e+04 1.858167e+05 \n",
"3 0.8222 2.636400e+04 2.027786e+04 1.475173e+04 2.565217e+05 \n",
"4 NaN 1.477839e+04 1.061894e+04 8.140048e+03 3.384251e+05 \n",
"... ... ... ... ... ... \n",
"5380 NaN 7.455500e+03 4.346405e+03 2.894040e+03 1.625299e+05 \n",
"5381 2.6625 3.180058e+06 3.128014e+06 1.317969e+06 1.742672e+07 \n",
"5382 NaN 4.979640e+04 4.970844e+04 3.303210e+04 3.351298e+05 \n",
"5383 NaN 6.143629e+04 5.340007e+04 4.590857e+04 2.715484e+05 \n",
"5384 NaN 2.140516e+04 1.442317e+04 1.442317e+04 7.992687e+05 \n",
"\n",
" circ_mv is_st \n",
"0 5.273728e+05 False \n",
"1 6.456958e+05 False \n",
"2 1.858167e+05 True \n",
"3 1.973036e+05 False \n",
"4 2.431738e+05 False \n",
"... ... ... \n",
"5380 9.475163e+04 False \n",
"5381 1.714152e+07 False \n",
"5382 3.345378e+05 False \n",
"5383 2.360283e+05 True \n",
"5384 5.385612e+05 False \n",
"\n",
"[5385 rows x 19 columns]\n"
]
}
],
"execution_count": 34
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:53:42.062142Z",
"start_time": "2025-02-11T15:53:42.044324Z"
}
},
"cell_type": "code",
"source": "print(all_daily_data_df[all_daily_data_df['is_st']])",
"id": "28cb78d032671b20",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" ts_code trade_date close turnover_rate turnover_rate_f \\\n",
"2 600358.SH 20250211 3.68 8.5826 11.3780 \n",
"20 000889.SZ 20250211 2.48 2.0846 2.8167 \n",
"50 603879.SH 20250211 3.58 1.7126 2.7285 \n",
"62 002024.SZ 20250211 1.99 0.2997 0.8575 \n",
"65 600078.SH 20250211 5.77 1.0536 1.8102 \n",
"... ... ... ... ... ... \n",
"5327 688309.SH 20250211 13.80 0.5594 1.0928 \n",
"5328 002800.SZ 20250211 10.57 2.0449 3.9025 \n",
"5342 300368.SZ 20250211 4.50 1.5755 2.2505 \n",
"5375 600515.SH 20250211 3.64 0.4111 0.6804 \n",
"5383 002197.SZ 20250211 4.42 4.0058 4.6595 \n",
"\n",
" volume_ratio pe pe_ttm pb ps ps_ttm dv_ratio \\\n",
"2 1.38 NaN NaN 15.2661 3.4220 4.2041 0.0000 \n",
"20 1.08 NaN NaN 20.6126 1.6250 1.6047 0.0000 \n",
"50 1.08 NaN NaN 3.4116 3.8093 3.5391 0.0000 \n",
"62 1.01 NaN NaN 1.5246 0.2944 0.3546 0.0000 \n",
"65 0.97 NaN NaN 2.1866 1.2329 1.2311 0.5373 \n",
"... ... ... ... ... ... ... ... \n",
"5327 0.73 60.8452 186.0174 1.5353 6.7361 13.4432 NaN \n",
"5328 0.72 NaN NaN 3.0468 1.6938 1.3629 0.0000 \n",
"5342 0.99 NaN NaN 7.1301 6.7544 11.8519 0.0000 \n",
"5375 0.91 43.6494 110.6536 1.7765 6.1506 7.8214 0.0000 \n",
"5383 1.41 NaN NaN 1.1195 2.0851 2.5837 0.0000 \n",
"\n",
" dv_ttm total_share float_share free_share total_mv \\\n",
"2 NaN 5.049367e+04 50493.6660 38088.2934 1.858167e+05 \n",
"20 NaN 9.362911e+04 86984.9676 64375.7658 2.322002e+05 \n",
"50 NaN 3.593444e+04 35934.4440 22555.6496 1.286453e+05 \n",
"62 NaN 9.264768e+05 919834.5068 321453.1001 1.843689e+06 \n",
"65 0.5373 6.625729e+04 66257.2861 38563.8247 3.823045e+05 \n",
"... ... ... ... ... ... \n",
"5327 NaN 8.001073e+03 8001.0733 4095.6641 1.104148e+05 \n",
"5328 NaN 1.522531e+04 14165.4100 7422.5200 1.609315e+05 \n",
"5342 NaN 5.289435e+04 52894.3475 37030.2475 2.380246e+05 \n",
"5375 NaN 1.142531e+06 917601.2508 554411.0843 4.158813e+06 \n",
"5383 NaN 6.143629e+04 53400.0687 45908.5733 2.715484e+05 \n",
"\n",
" circ_mv is_st \n",
"2 1.858167e+05 True \n",
"20 2.157227e+05 True \n",
"50 1.286453e+05 True \n",
"62 1.830471e+06 True \n",
"65 3.823045e+05 True \n",
"... ... ... \n",
"5327 1.104148e+05 True \n",
"5328 1.497284e+05 True \n",
"5342 2.380246e+05 True \n",
"5375 3.340069e+06 True \n",
"5383 2.360283e+05 True \n",
"\n",
"[318 rows x 19 columns]\n"
]
}
],
"execution_count": 37
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:53:33.693894Z",
"start_time": "2025-02-11T15:53:33.609884Z"
}
},
"cell_type": "code",
"source": [
"# 将数据保存为 HDF5 文件table 格式)\n",
"all_daily_data_df.to_hdf(h5_filename, key='daily_basic', mode='a', format='table', append=True, data_columns=True)\n",
"\n",
"print(\"所有每日基础数据获取并保存完毕!\")\n"
],
"id": "692b58674b7462c9",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"所有每日基础数据获取并保存完毕!\n"
]
}
],
"execution_count": 36
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:54:27.868021Z",
"start_time": "2025-02-11T15:54:18.853803Z"
}
},
"cell_type": "code",
"source": [
"with pd.HDFStore(h5_filename, mode='r') as store:\n",
" df = store[key][['ts_code', 'trade_date', 'is_st']]\n",
" print(df.info())"
],
"id": "d7a773fc20293477",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 8300879 entries, 0 to 5384\n",
"Data columns (total 3 columns):\n",
" # Column Dtype \n",
"--- ------ ----- \n",
" 0 ts_code object\n",
" 1 trade_date object\n",
" 2 is_st bool \n",
"dtypes: bool(1), object(2)\n",
"memory usage: 197.9+ MB\n",
"None\n"
]
}
],
"execution_count": 39
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,149 @@
{
"cells": [
{
"cell_type": "code",
"id": "17cc645336d4eb18",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:55:19.819017Z",
"start_time": "2025-02-08T16:55:18.958639Z"
}
},
"source": [
"import pandas as pd\n",
"import tushare as ts"
],
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:55:27.578361Z",
"start_time": "2025-02-08T16:55:19.882313Z"
}
},
"cell_type": "code",
"source": [
"daily_basic = pd.read_hdf('../../data/daily_basic.h5', key='daily_basic', columns=['ts_code', 'trade_date '])\n",
"name_change_df = pd.read_hdf('../../data/name_change.h5', key='name_change')\n",
"name_change_df = name_change_df.drop_duplicates(keep='first')\n",
"\n",
"# 确保 name_change_df 的日期格式正确\n",
"name_change_df['start_date'] = pd.to_datetime(name_change_df['start_date'], format='%Y%m%d')\n",
"name_change_df['end_date'] = pd.to_datetime(name_change_df['end_date'], format='%Y%m%d', errors='coerce')\n",
"name_change_df = name_change_df[name_change_df.name.str.contains('ST')]\n"
],
"id": "48ae71ed02d61819",
"outputs": [],
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-08T16:55:27.938078Z",
"start_time": "2025-02-08T16:55:27.584226Z"
}
},
"cell_type": "code",
"source": [
"name_change_dict = {}\n",
"for ts_code, group in name_change_df.groupby('ts_code'):\n",
" # 只保留 'ST' 和 '*ST' 的记录\n",
" st_data = group[(group['change_reason'] == 'ST') | (group['change_reason'] == '*ST')]\n",
" if not st_data.empty:\n",
" name_change_dict[ts_code] = st_data"
],
"id": "e6606a96e5728b8",
"outputs": [],
"execution_count": 3
},
{
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-02-08T16:59:20.537632Z",
"start_time": "2025-02-08T16:55:27.971219Z"
}
},
"cell_type": "code",
"source": [
"from datetime import datetime\n",
"import pandas as pd\n",
"\n",
"\n",
"# 判断股票是否为 ST 的函数\n",
"#stock_code = 'xxxxxx.SH'\n",
"#target_date = '20200830'\n",
"#若为ST返回True否则返回False\n",
"def is_st(name_change_dict, stock_code, target_date):\n",
" target_date = datetime.strptime(target_date, '%Y%m%d')\n",
" if stock_code not in name_change_dict.keys():\n",
" return False\n",
" df = name_change_dict[stock_code]\n",
" for i in range(len(df)):\n",
" sds = df.iloc[i, 2]\n",
" eds = df.iloc[i, 3]\n",
" # sd = datetime.strptime(sds, '%Y%m%d')\n",
" if eds == None:\n",
" ed = datetime.now()\n",
" # else:\n",
" # ed = datetime.strptime(eds, '%Y%m%d')\n",
" if (target_date - sds).days >= 0 and (target_date - eds).days <= 0:\n",
" return True\n",
" return False\n",
"\n",
"\n",
"print('is st...')\n",
"# 创建一个新的列 is_st判断每只股票是否是 ST\n",
"daily_basic['is_st'] = daily_basic.apply(\n",
" lambda row: is_st(name_change_dict, row['ts_code'], row['trade_date']), axis=1\n",
")\n",
"\n",
"# 保存结果到新的 HDF5 文件\n",
"daily_basic.to_hdf('../../data/daily_basic_with_st.h5', key='daily_basic_with_st', mode='w', format='table')\n",
"\n",
"# 输出部分结果\n",
"print(daily_basic[['ts_code', 'trade_date', 'is_st']].head())\n"
],
"id": "initial_id",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"is st...\n",
" ts_code trade_date is_st\n",
"0 603429.SH 20250127 False\n",
"1 300917.SZ 20250127 False\n",
"2 301266.SZ 20250127 False\n",
"3 688399.SH 20250127 False\n",
"4 603737.SH 20250127 False\n"
]
}
],
"execution_count": 4
}
],
"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
}

View File

@@ -0,0 +1,193 @@
{
"cells": [
{
"cell_type": "code",
"id": "b94bb1f2-5332-485e-ae1b-eea01f938106",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:21:54.821950Z",
"start_time": "2025-02-11T15:21:54.050569Z"
}
},
"source": [
"import tushare as ts\n",
"\n",
"ts.set_token('3a0741c702ee7e5e5f2bf1f0846bafaafe4e320833240b2a7e4a685f')\n",
"pro = ts.pro_api()"
],
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:22:32.726905Z",
"start_time": "2025-02-11T15:22:25.018135Z"
}
},
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import time\n",
"\n",
"h5_filename = '../../../data/money_flow.h5'\n",
"key = '/money_flow'\n",
"max_date = None\n",
"with pd.HDFStore(h5_filename, mode='r') as store:\n",
" df = store[key][['ts_code', 'trade_date']]\n",
" print(df.info())\n",
" max_date = df['trade_date'].max()\n",
"\n",
"print(max_date)\n",
"trade_cal = pro.trade_cal(exchange='', start_date='20170101', end_date='20250220')\n",
"trade_cal = trade_cal[trade_cal['is_open'] == 1] # 只保留交易日\n",
"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}')"
],
"id": "742c29d453b9bb38",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 8153941 entries, 0 to 5120\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: 186.6+ MB\n",
"None\n",
"20250211\n",
"start_date: 20250212\n"
]
}
],
"execution_count": 6
},
{
"cell_type": "code",
"id": "679ce40e-8d62-4887-970c-e1d8cbdeee6b",
"metadata": {
"scrolled": true,
"ExecuteTime": {
"end_time": "2025-02-11T15:22:14.513527Z",
"start_time": "2025-02-11T15:22:12.973331Z"
}
},
"source": [
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
"\n",
"all_daily_data = []\n",
"\n",
"# API 调用计数和时间控制变量\n",
"api_call_count = 0\n",
"batch_start_time = time.time()\n",
"\n",
"\n",
"def get_data(trade_date):\n",
" time.sleep(0.1)\n",
" money_flow_data = pro.moneyflow(trade_date=trade_date)\n",
" if money_flow_data is not None and not money_flow_data.empty:\n",
" return money_flow_data\n",
"\n",
"\n",
"with ThreadPoolExecutor(max_workers=2) as executor:\n",
" future_to_date = {executor.submit(get_data, td): td for td in trade_dates}\n",
"\n",
" for future in as_completed(future_to_date):\n",
" trade_date = future_to_date[future] # 获取对应的交易日期\n",
" try:\n",
" result = future.result() # 获取任务执行的结果\n",
" all_daily_data.append(result)\n",
" print(f\"任务 {trade_date} 完成\")\n",
" except Exception as e:\n",
" print(f\"获取 {trade_date} 数据时出错: {e}\")\n",
"\n"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250219 完成\n",
"任务 20250220 完成\n",
"任务 20250218 完成\n",
"任务 20250217 完成\n",
"任务 20250214 完成\n",
"任务 20250213 完成\n",
"任务 20250212 完成\n",
"任务 20250211 完成\n"
]
}
],
"execution_count": 3
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:22:16.656650Z",
"start_time": "2025-02-11T15:22:16.639271Z"
}
},
"cell_type": "code",
"source": "all_daily_data_df = pd.concat(all_daily_data, ignore_index=True)\n",
"id": "9af80516849d4e80",
"outputs": [],
"execution_count": 4
},
{
"cell_type": "code",
"id": "a2b05187-437f-4053-bc43-bd80d4cf8b0e",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:22:20.447350Z",
"start_time": "2025-02-11T15:22:19.145561Z"
}
},
"source": [
"\n",
"# 将所有数据合并为一个 DataFrame\n",
"\n",
"# 将数据保存为 HDF5 文件table 格式)\n",
"all_daily_data_df.to_hdf(h5_filename, key='money_flow', mode='a', format='table', append=True, data_columns=True)\n",
"\n",
"print(\"所有每日基础数据获取并保存完毕!\")"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"所有每日基础数据获取并保存完毕!\n"
]
}
],
"execution_count": 5
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,238 @@
{
"cells": [
{
"cell_type": "code",
"id": "500802dc-7a20-48b7-a470-a4bae3ec534b",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:18:36.892437Z",
"start_time": "2025-02-11T15:18:36.020822Z"
}
},
"source": [
"import tushare as ts\n",
"\n",
"ts.set_token('3a0741c702ee7e5e5f2bf1f0846bafaafe4e320833240b2a7e4a685f')\n",
"pro = ts.pro_api()"
],
"outputs": [],
"execution_count": 1
},
{
"cell_type": "code",
"id": "5a84bc9da6d54868",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:20:12.573607Z",
"start_time": "2025-02-11T15:20:00.110127Z"
}
},
"source": [
"import pandas as pd\n",
"import time\n",
"\n",
"h5_filename = '../../../data/stk_limit.h5'\n",
"key = '/stk_limit'\n",
"max_date = None\n",
"with pd.HDFStore(h5_filename, mode='r') as store:\n",
" df = store[key][['ts_code', 'trade_date']]\n",
" print(df.sort_values(by='trade_date', ascending=True).tail())\n",
" print(df.info())\n",
" max_date = df['trade_date'].max()\n",
"\n",
"print(max_date)\n",
"trade_cal = pro.trade_cal(exchange='', start_date='20170101', end_date='20250220')\n",
"trade_cal = trade_cal[trade_cal['is_open'] == 1] # 只保留交易日\n",
"trade_dates = trade_cal[trade_cal['cal_date'] > max_date]['cal_date'].tolist()\n",
"start_date = min(trade_dates)\n",
"print(start_date)"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" ts_code trade_date\n",
"4682 600310.SH 20250211\n",
"4683 600312.SH 20250211\n",
"4684 600313.SH 20250211\n",
"4673 600299.SH 20250211\n",
"0 000001.SZ 20250211\n",
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 10040878 entries, 0 to 10040877\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: 229.8+ MB\n",
"None\n",
"20250211\n",
"20250212\n"
]
}
],
"execution_count": 5
},
{
"cell_type": "code",
"id": "bb3191de-27a2-4c89-a3b5-32a0d7b9496f",
"metadata": {
"scrolled": true,
"ExecuteTime": {
"end_time": "2025-02-11T15:21:27.831699Z",
"start_time": "2025-02-11T15:21:26.665039Z"
}
},
"source": [
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
"\n",
"all_daily_data = []\n",
"\n",
"# API 调用计数和时间控制变量\n",
"api_call_count = 0\n",
"batch_start_time = time.time()\n",
"\n",
"\n",
"def get_data(trade_date):\n",
" time.sleep(0.1)\n",
" stk_limit_data = pro.stk_limit(trade_date=trade_date)\n",
" if stk_limit_data is not None and not stk_limit_data.empty:\n",
" return stk_limit_data\n",
"\n",
"\n",
"with ThreadPoolExecutor(max_workers=2) as executor:\n",
" future_to_date = {executor.submit(get_data, td): td for td in trade_dates}\n",
"\n",
" for future in as_completed(future_to_date):\n",
" trade_date = future_to_date[future] # 获取对应的交易日期\n",
" try:\n",
" result = future.result() # 获取任务执行的结果\n",
" if result is not None:\n",
" all_daily_data.append(result)\n",
" print(f\"任务 {trade_date} 完成\")\n",
" except Exception as e:\n",
" print(f\"获取 {trade_date} 数据时出错: {e}\")\n",
"\n"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"任务 20250220 完成\n",
"任务 20250219 完成\n",
"任务 20250217 完成\n",
"任务 20250218 完成\n",
"任务 20250214 完成\n",
"任务 20250213 完成\n",
"任务 20250212 完成\n"
]
}
],
"execution_count": 10
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:21:29.294283Z",
"start_time": "2025-02-11T15:21:29.247112Z"
}
},
"cell_type": "code",
"source": [
"print(all_daily_data)\n",
"# 将所有数据合并为一个 DataFrame\n",
"all_daily_data_df = pd.concat(all_daily_data, ignore_index=True)"
],
"id": "96a81aa5890ea3c3",
"outputs": [
{
"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[11], 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 \u001B[43mpd\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mconcat\u001B[49m\u001B[43m(\u001B[49m\u001B[43mall_daily_data\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mignore_index\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m)\u001B[49m\n",
"File \u001B[1;32mE:\\Python\\anaconda\\envs\\try_trader\\lib\\site-packages\\pandas\\core\\reshape\\concat.py:372\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 369\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 370\u001B[0m copy \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mFalse\u001B[39;00m\n\u001B[1;32m--> 372\u001B[0m op \u001B[38;5;241m=\u001B[39m \u001B[43m_Concatenator\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m 373\u001B[0m \u001B[43m \u001B[49m\u001B[43mobjs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 374\u001B[0m \u001B[43m \u001B[49m\u001B[43maxis\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43maxis\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 375\u001B[0m \u001B[43m \u001B[49m\u001B[43mignore_index\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mignore_index\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 376\u001B[0m \u001B[43m \u001B[49m\u001B[43mjoin\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mjoin\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 377\u001B[0m \u001B[43m \u001B[49m\u001B[43mkeys\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mkeys\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 378\u001B[0m \u001B[43m \u001B[49m\u001B[43mlevels\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mlevels\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 379\u001B[0m \u001B[43m \u001B[49m\u001B[43mnames\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mnames\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 380\u001B[0m \u001B[43m \u001B[49m\u001B[43mverify_integrity\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mverify_integrity\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 381\u001B[0m \u001B[43m \u001B[49m\u001B[43mcopy\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcopy\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 382\u001B[0m \u001B[43m \u001B[49m\u001B[43msort\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msort\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 383\u001B[0m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 385\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\\try_trader\\lib\\site-packages\\pandas\\core\\reshape\\concat.py:429\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 426\u001B[0m objs \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlist\u001B[39m(objs)\n\u001B[0;32m 428\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(objs) \u001B[38;5;241m==\u001B[39m \u001B[38;5;241m0\u001B[39m:\n\u001B[1;32m--> 429\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 431\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 432\u001B[0m objs \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))\n",
"\u001B[1;31mValueError\u001B[0m: No objects to concatenate"
]
}
],
"execution_count": 11
},
{
"cell_type": "code",
"id": "ad9733a1-2f42-43ee-a98c-0bf699304c21",
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-11T15:20:37.999493Z",
"start_time": "2025-02-11T15:20:37.375220Z"
}
},
"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": [
{
"ename": "ValueError",
"evalue": "All objects passed were None",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mValueError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[1;32mIn[7], line 2\u001B[0m\n\u001B[0;32m 1\u001B[0m \u001B[38;5;66;03m# 将所有数据合并为一个 DataFrame\u001B[39;00m\n\u001B[1;32m----> 2\u001B[0m all_daily_data_df \u001B[38;5;241m=\u001B[39m \u001B[43mpd\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mconcat\u001B[49m\u001B[43m(\u001B[49m\u001B[43mall_daily_data\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mignore_index\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m)\u001B[49m\n\u001B[0;32m 4\u001B[0m \u001B[38;5;66;03m# 将数据保存为 HDF5 文件table 格式)\u001B[39;00m\n\u001B[0;32m 5\u001B[0m all_daily_data_df\u001B[38;5;241m.\u001B[39mto_hdf(h5_filename, key\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mstk_limit\u001B[39m\u001B[38;5;124m'\u001B[39m, mode\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124ma\u001B[39m\u001B[38;5;124m'\u001B[39m, \u001B[38;5;28mformat\u001B[39m\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mtable\u001B[39m\u001B[38;5;124m'\u001B[39m, append\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m, data_columns\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m)\n",
"File \u001B[1;32mE:\\Python\\anaconda\\envs\\try_trader\\lib\\site-packages\\pandas\\core\\reshape\\concat.py:372\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 369\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 370\u001B[0m copy \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mFalse\u001B[39;00m\n\u001B[1;32m--> 372\u001B[0m op \u001B[38;5;241m=\u001B[39m \u001B[43m_Concatenator\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m 373\u001B[0m \u001B[43m \u001B[49m\u001B[43mobjs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 374\u001B[0m \u001B[43m \u001B[49m\u001B[43maxis\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43maxis\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 375\u001B[0m \u001B[43m \u001B[49m\u001B[43mignore_index\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mignore_index\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 376\u001B[0m \u001B[43m \u001B[49m\u001B[43mjoin\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mjoin\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 377\u001B[0m \u001B[43m \u001B[49m\u001B[43mkeys\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mkeys\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 378\u001B[0m \u001B[43m \u001B[49m\u001B[43mlevels\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mlevels\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 379\u001B[0m \u001B[43m \u001B[49m\u001B[43mnames\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mnames\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 380\u001B[0m \u001B[43m \u001B[49m\u001B[43mverify_integrity\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mverify_integrity\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 381\u001B[0m \u001B[43m \u001B[49m\u001B[43mcopy\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcopy\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 382\u001B[0m \u001B[43m \u001B[49m\u001B[43msort\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msort\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 383\u001B[0m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 385\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\\try_trader\\lib\\site-packages\\pandas\\core\\reshape\\concat.py:452\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 449\u001B[0m keys \u001B[38;5;241m=\u001B[39m Index(clean_keys, name\u001B[38;5;241m=\u001B[39mname, dtype\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mgetattr\u001B[39m(keys, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mdtype\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;28;01mNone\u001B[39;00m))\n\u001B[0;32m 451\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(objs) \u001B[38;5;241m==\u001B[39m \u001B[38;5;241m0\u001B[39m:\n\u001B[1;32m--> 452\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;124mAll objects passed were None\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m 454\u001B[0m \u001B[38;5;66;03m# figure out what our result ndim is going to be\u001B[39;00m\n\u001B[0;32m 455\u001B[0m ndims \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mset\u001B[39m()\n",
"\u001B[1;31mValueError\u001B[0m: All objects passed were None"
]
}
],
"execution_count": 7
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e777f1f-4d54-4a74-b916-691ede6af055",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

1065
code/train/V1.1.ipynb Normal file

File diff suppressed because it is too large Load Diff

1065
code/train/V1.2.ipynb Normal file

File diff suppressed because it is too large Load Diff

896
code/train/V1.ipynb Normal file
View File

@@ -0,0 +1,896 @@
{
"cells": [
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:52:54.170824Z",
"start_time": "2025-02-09T14:52:53.544850Z"
}
},
"cell_type": "code",
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"from utils.utils import read_and_merge_h5_data"
],
"id": "79a7758178bafdd3",
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:53:36.873700Z",
"start_time": "2025-02-09T14:52:54.170824Z"
}
},
"cell_type": "code",
"source": [
"print('daily data')\n",
"df = read_and_merge_h5_data('../../data/daily_data.h5', key='daily_data',\n",
" columns=['ts_code', 'trade_date', 'open', 'close', 'high', 'low', 'vol'],\n",
" df=None)\n",
"\n",
"print('daily basic')\n",
"df = read_and_merge_h5_data('../../data/daily_basic.h5', key='daily_basic_with_st',\n",
" columns=['ts_code', 'trade_date', 'turnover_rate', 'pe_ttm', 'circ_mv', 'volume_ratio',\n",
" 'is_st'], df=df)\n",
"\n",
"print('stk limit')\n",
"df = read_and_merge_h5_data('../../data/stk_limit.h5', key='stk_limit',\n",
" columns=['ts_code', 'trade_date', 'pre_close', 'up_limit', 'down_limit'],\n",
" df=df)\n",
"print('money flow')\n",
"df = read_and_merge_h5_data('../../data/money_flow.h5', key='money_flow',\n",
" columns=['ts_code', 'trade_date', 'buy_sm_vol', 'sell_sm_vol', 'buy_lg_vol', 'sell_lg_vol',\n",
" 'buy_elg_vol', 'sell_elg_vol', 'net_mf_vol'],\n",
" df=df)"
],
"id": "a79cafb06a7e0e43",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"daily data\n",
"daily basic\n",
"stk limit\n",
"money flow\n"
]
}
],
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:53:37.426404Z",
"start_time": "2025-02-09T14:53:36.955552Z"
}
},
"cell_type": "code",
"source": "origin_columns = df.columns.tolist()",
"id": "c4e9e1d31da6dba6",
"outputs": [],
"execution_count": 3
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:53:38.164112Z",
"start_time": "2025-02-09T14:53:38.070007Z"
}
},
"cell_type": "code",
"source": [
"import numpy as np\n",
"import talib\n",
"\n",
"\n",
"def get_technical_factor(df):\n",
" df['up'] = (df['high'] - df[['close', 'open']].max(axis=1)) / df['close']\n",
" df['down'] = (df[['close', 'open']].min(axis=1) - df['low']) / df['close']\n",
"\n",
" df['atr_14'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=14)\n",
" df['atr_6'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=6)\n",
"\n",
" df['obv'] = talib.OBV(df['close'], df['vol'])\n",
" df['maobv_6'] = talib.SMA(df['obv'], timeperiod=6)\n",
" df['obv-maobv_6'] = df['obv'] - df['maobv_6']\n",
"\n",
" df['rsi_3'] = talib.RSI(df['close'], timeperiod=3)\n",
" df['rsi_6'] = talib.RSI(df['close'], timeperiod=6)\n",
" df['rsi_9'] = talib.RSI(df['close'], timeperiod=9)\n",
"\n",
" df['return_10'] = df['close'] / df['close'].shift(10) - 1\n",
" df['return_20'] = df['close'] / df['close'].shift(20) - 1\n",
"\n",
" # # 计算 _rank_return_10 和 _rank_return_20\n",
" # df['_rank_return_10'] = df['return_10'].rank(pct=True)\n",
" # df['_rank_return_20'] = df['return_20'].rank(pct=True)\n",
"\n",
" # 计算 avg_close_5\n",
" df['avg_close_5'] = df['close'].rolling(window=5).mean() / df['close']\n",
"\n",
" # 计算 std_return_5, std_return_15, std_return_25, std_return_252, std_return_2522\n",
" df['std_return_5'] = df['close'].pct_change().shift(-1).rolling(window=5).std()\n",
" df['std_return_15'] = df['close'].pct_change().shift(-1).rolling(window=15).std()\n",
" df['std_return_25'] = df['close'].pct_change().shift(-1).rolling(window=25).std()\n",
" df['std_return_90'] = df['close'].pct_change().shift(-1).rolling(window=90).std()\n",
" df['std_return_90_2'] = df['close'].shift(10).pct_change().shift(-1).rolling(window=90).std()\n",
"\n",
" # 计算 std_return_5 / std_return_252 和 std_return_5 / std_return_25\n",
" df['std_return_5 / std_return_90'] = df['std_return_5'] / df['std_return_90']\n",
" df['std_return_5 / std_return_25'] = df['std_return_5'] / df['std_return_25']\n",
"\n",
" # 计算 std_return_252 - std_return_2522\n",
" df['std_return_90 - std_return_90_2'] = df['std_return_90'] - df['std_return_90_2']\n",
" return df\n",
"\n",
"\n",
"def get_act_factor(df):\n",
" # 计算 m_ta_ema(close, 5), m_ta_ema(close, 13), m_ta_ema(close, 20), m_ta_ema(close, 60)\n",
" df['ema_5'] = talib.EMA(df['close'], timeperiod=5)\n",
" df['ema_13'] = talib.EMA(df['close'], timeperiod=13)\n",
" df['ema_20'] = talib.EMA(df['close'], timeperiod=20)\n",
" df['ema_60'] = talib.EMA(df['close'], timeperiod=60)\n",
"\n",
" # 计算 act_factor1, act_factor2, act_factor3, act_factor4\n",
" df['act_factor1'] = np.arctan((df['ema_5'] / df['ema_5'].shift(1) - 1) * 100) * 57.3 / 50\n",
" df['act_factor2'] = np.arctan((df['ema_13'] / df['ema_13'].shift(1) - 1) * 100) * 57.3 / 40\n",
" df['act_factor3'] = np.arctan((df['ema_20'] / df['ema_20'].shift(1) - 1) * 100) * 57.3 / 21\n",
" df['act_factor4'] = np.arctan((df['ema_60'] / df['ema_60'].shift(1) - 1) * 100) * 57.3 / 10\n",
"\n",
" # 计算 act_factor5 和 act_factor6\n",
" df['act_factor5'] = df['act_factor1'] + df['act_factor2'] + df['act_factor3'] + df['act_factor4']\n",
" df['act_factor6'] = (df['act_factor1'] - df['act_factor2']) / np.sqrt(\n",
" df['act_factor1'] ** 2 + df['act_factor2'] ** 2)\n",
"\n",
" # 根据 'trade_date' 进行分组,在每个组内分别计算 'act_factor1', 'act_factor2', 'act_factor3' 的排名\n",
" df['rank_act_factor1'] = df.groupby('trade_date')['act_factor1'].rank(ascending=False, pct=True)\n",
" df['rank_act_factor2'] = df.groupby('trade_date')['act_factor2'].rank(ascending=False, pct=True)\n",
" df['rank_act_factor3'] = df.groupby('trade_date')['act_factor3'].rank(ascending=False, pct=True)\n",
"\n",
" return df\n",
"\n",
"\n",
"def get_money_flow_factor(df):\n",
" df['active_buy_volume_large'] = df['buy_lg_vol'] / df['net_mf_vol']\n",
" df['active_buy_volume_big'] = df['buy_elg_vol'] / df['net_mf_vol']\n",
" df['active_buy_volume_small'] = df['buy_sm_vol'] / df['net_mf_vol']\n",
"\n",
" df['buy_lg_vol - sell_lg_vol'] = (df['buy_lg_vol'] - df['sell_lg_vol']) / df['net_mf_vol']\n",
" df['buy_elg_vol - sell_elg_vol'] = (df['buy_elg_vol'] - df['sell_elg_vol']) / df['net_mf_vol']\n",
"\n",
" # # 你还提到了一些其他字段:\n",
" # df['net_active_buy_volume_main'] = df['net_mf_vol'] / df['buy_sm_vol']\n",
" # df['netflow_amount_main'] = df['net_mf_vol'] / df['buy_sm_vol'] # 这里假设 'net_mf_vol' 是主流资金流\n",
"\n",
" # df['active_sell_volume_large'] = df['sell_lg_vol'] / df['sell_sm_vol']\n",
" # df['active_sell_volume_big'] = df['sell_elg_vol'] / df['sell_sm_vol']\n",
" # df['active_sell_volume_small'] = df['sell_sm_vol'] / df['sell_sm_vol']\n",
"\n",
" return df\n",
"\n",
"\n",
"def get_alpha_factor(df):\n",
" df['alpha_022'] = df['close'] - df['close'].shift(5)\n",
"\n",
" # alpha_003: (close - open) / (high - low)\n",
" df['alpha_003'] = (df['close'] - df['open']) / (df['high'] - df['low'])\n",
"\n",
" # alpha_007: rank(correlation(close, volume, 5))\n",
" df['alpha_007'] = df['close'].rolling(5).corr(df['vol']).rank(axis=1)\n",
"\n",
" # alpha_013: rank(sum(close, 5) - sum(close, 20))\n",
" df['alpha_013'] = (df['close'].rolling(5).sum() - df['close'].rolling(20).sum()).rank(axis=1)\n",
" return df\n",
"\n",
"\n",
"def get_future_data(df):\n",
" df['future_return1'] = (df['close'].shift(-1) - df['close']) / df['close']\n",
" df['future_return2'] = (df['open'].shift(-2) - df['open'].shift(-1)) / df['open'].shift(-1)\n",
" df['future_return3'] = (df['close'].shift(-2) - df['close'].shift(-1)) / df['close'].shift(-1)\n",
" df['future_return4'] = (df['close'].shift(-2) - df['open'].shift(-1)) / df['open'].shift(-1)\n",
" df['future_return5'] = (df['close'].shift(-5) - df['open'].shift(-1)) / df['open'].shift(-1)\n",
" df['future_return6'] = (df['close'].shift(-10) - df['open'].shift(-1)) / df['open'].shift(-1)\n",
" df['future_return7'] = (df['close'].shift(-20) - df['open'].shift(-1)) / df['open'].shift(-1)\n",
" df['future_close1'] = (df['close'].shift(-1) - df['close']) / df['close']\n",
" df['future_close2'] = (df['close'].shift(-2) - df['close']) / df['close']\n",
" df['future_close3'] = (df['close'].shift(-3) - df['close']) / df['close']\n",
" df['future_close4'] = (df['close'].shift(-4) - df['close']) / df['close']\n",
" df['future_close5'] = (df['close'].shift(-5) - df['close']) / df['close']\n",
" df['future_af11'] = df['act_factor1'].shift(-1)\n",
" df['future_af12'] = df['act_factor1'].shift(-2)\n",
" df['future_af13'] = df['act_factor1'].shift(-3)\n",
" df['future_af14'] = df['act_factor1'].shift(-4)\n",
" df['future_af15'] = df['act_factor1'].shift(-5)\n",
" df['future_af21'] = df['act_factor2'].shift(-1)\n",
" df['future_af22'] = df['act_factor2'].shift(-2)\n",
" df['future_af23'] = df['act_factor2'].shift(-3)\n",
" df['future_af24'] = df['act_factor2'].shift(-4)\n",
" df['future_af25'] = df['act_factor2'].shift(-5)\n",
" df['future_af31'] = df['act_factor3'].shift(-1)\n",
" df['future_af32'] = df['act_factor3'].shift(-2)\n",
" df['future_af33'] = df['act_factor3'].shift(-3)\n",
" df['future_af34'] = df['act_factor3'].shift(-4)\n",
" df['future_af35'] = df['act_factor3'].shift(-5)\n",
"\n",
" return df\n"
],
"id": "a735bc02ceb4d872",
"outputs": [],
"execution_count": 4
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:53:49.153376Z",
"start_time": "2025-02-09T14:53:38.164112Z"
}
},
"cell_type": "code",
"source": [
"df = get_technical_factor(df)\n",
"df = get_act_factor(df)\n",
"df = get_money_flow_factor(df)\n",
"df = get_future_data(df)\n",
"# df = df.drop(columns=origin_columns)\n",
"\n",
"print(df.info())"
],
"id": "53f86ddc0677a6d7",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 8364308 entries, 0 to 8364307\n",
"Data columns (total 83 columns):\n",
" # Column Dtype \n",
"--- ------ ----- \n",
" 0 ts_code object \n",
" 1 trade_date datetime64[ns]\n",
" 2 open float64 \n",
" 3 close float64 \n",
" 4 high float64 \n",
" 5 low float64 \n",
" 6 vol float64 \n",
" 7 is_st object \n",
" 8 up_limit float64 \n",
" 9 down_limit float64 \n",
" 10 buy_sm_vol float64 \n",
" 11 sell_sm_vol float64 \n",
" 12 buy_lg_vol float64 \n",
" 13 sell_lg_vol float64 \n",
" 14 buy_elg_vol float64 \n",
" 15 sell_elg_vol float64 \n",
" 16 net_mf_vol float64 \n",
" 17 up float64 \n",
" 18 down float64 \n",
" 19 atr_14 float64 \n",
" 20 atr_6 float64 \n",
" 21 obv float64 \n",
" 22 maobv_6 float64 \n",
" 23 obv-maobv_6 float64 \n",
" 24 rsi_3 float64 \n",
" 25 rsi_6 float64 \n",
" 26 rsi_9 float64 \n",
" 27 return_10 float64 \n",
" 28 return_20 float64 \n",
" 29 avg_close_5 float64 \n",
" 30 std_return_5 float64 \n",
" 31 std_return_15 float64 \n",
" 32 std_return_25 float64 \n",
" 33 std_return_90 float64 \n",
" 34 std_return_90_2 float64 \n",
" 35 std_return_5 / std_return_90 float64 \n",
" 36 std_return_5 / std_return_25 float64 \n",
" 37 std_return_90 - std_return_90_2 float64 \n",
" 38 ema_5 float64 \n",
" 39 ema_13 float64 \n",
" 40 ema_20 float64 \n",
" 41 ema_60 float64 \n",
" 42 act_factor1 float64 \n",
" 43 act_factor2 float64 \n",
" 44 act_factor3 float64 \n",
" 45 act_factor4 float64 \n",
" 46 act_factor5 float64 \n",
" 47 act_factor6 float64 \n",
" 48 rank_act_factor1 float64 \n",
" 49 rank_act_factor2 float64 \n",
" 50 rank_act_factor3 float64 \n",
" 51 active_buy_volume_large float64 \n",
" 52 active_buy_volume_big float64 \n",
" 53 active_buy_volume_small float64 \n",
" 54 buy_lg_vol - sell_lg_vol float64 \n",
" 55 buy_elg_vol - sell_elg_vol float64 \n",
" 56 future_return1 float64 \n",
" 57 future_return2 float64 \n",
" 58 future_return3 float64 \n",
" 59 future_return4 float64 \n",
" 60 future_return5 float64 \n",
" 61 future_return6 float64 \n",
" 62 future_return7 float64 \n",
" 63 future_close1 float64 \n",
" 64 future_close2 float64 \n",
" 65 future_close3 float64 \n",
" 66 future_close4 float64 \n",
" 67 future_close5 float64 \n",
" 68 future_af11 float64 \n",
" 69 future_af12 float64 \n",
" 70 future_af13 float64 \n",
" 71 future_af14 float64 \n",
" 72 future_af15 float64 \n",
" 73 future_af21 float64 \n",
" 74 future_af22 float64 \n",
" 75 future_af23 float64 \n",
" 76 future_af24 float64 \n",
" 77 future_af25 float64 \n",
" 78 future_af31 float64 \n",
" 79 future_af32 float64 \n",
" 80 future_af33 float64 \n",
" 81 future_af34 float64 \n",
" 82 future_af35 float64 \n",
"dtypes: datetime64[ns](1), float64(80), object(2)\n",
"memory usage: 5.2+ GB\n",
"None\n"
]
}
],
"execution_count": 5
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:55:28.712343Z",
"start_time": "2025-02-09T14:53:49.279168Z"
}
},
"cell_type": "code",
"source": [
"def filter_data(df):\n",
" df = df.groupby('trade_date').apply(lambda x: x.nlargest(1000, 'act_factor3'))\n",
" df = df[df['is_st'] == False]\n",
" df = df[df['is_st'] == False]\n",
" df = df[~df['ts_code'].str.startswith('30')]\n",
" df = df[~df['ts_code'].str.startswith('68')]\n",
" df = df[~df['ts_code'].str.startswith('8')]\n",
" df = df.reset_index(drop=True)\n",
" return df\n",
"\n",
"\n",
"df = filter_data(df)\n",
"print(df.info())"
],
"id": "dbe2fd8021b9417f",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 1136157 entries, 0 to 1136156\n",
"Data columns (total 83 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 ts_code 1136157 non-null object \n",
" 1 trade_date 1136157 non-null datetime64[ns]\n",
" 2 open 1136157 non-null float64 \n",
" 3 close 1136157 non-null float64 \n",
" 4 high 1136157 non-null float64 \n",
" 5 low 1136157 non-null float64 \n",
" 6 vol 1136157 non-null float64 \n",
" 7 is_st 1136157 non-null object \n",
" 8 up_limit 1135878 non-null float64 \n",
" 9 down_limit 1135878 non-null float64 \n",
" 10 buy_sm_vol 1135663 non-null float64 \n",
" 11 sell_sm_vol 1135663 non-null float64 \n",
" 12 buy_lg_vol 1135663 non-null float64 \n",
" 13 sell_lg_vol 1135663 non-null float64 \n",
" 14 buy_elg_vol 1135663 non-null float64 \n",
" 15 sell_elg_vol 1135663 non-null float64 \n",
" 16 net_mf_vol 1135663 non-null float64 \n",
" 17 up 1136157 non-null float64 \n",
" 18 down 1136157 non-null float64 \n",
" 19 atr_14 1136157 non-null float64 \n",
" 20 atr_6 1136157 non-null float64 \n",
" 21 obv 1136157 non-null float64 \n",
" 22 maobv_6 1136157 non-null float64 \n",
" 23 obv-maobv_6 1136157 non-null float64 \n",
" 24 rsi_3 1136157 non-null float64 \n",
" 25 rsi_6 1136157 non-null float64 \n",
" 26 rsi_9 1136157 non-null float64 \n",
" 27 return_10 1136157 non-null float64 \n",
" 28 return_20 1136157 non-null float64 \n",
" 29 avg_close_5 1136157 non-null float64 \n",
" 30 std_return_5 1136157 non-null float64 \n",
" 31 std_return_15 1136157 non-null float64 \n",
" 32 std_return_25 1136157 non-null float64 \n",
" 33 std_return_90 1136131 non-null float64 \n",
" 34 std_return_90_2 1136129 non-null float64 \n",
" 35 std_return_5 / std_return_90 1136131 non-null float64 \n",
" 36 std_return_5 / std_return_25 1136157 non-null float64 \n",
" 37 std_return_90 - std_return_90_2 1136129 non-null float64 \n",
" 38 ema_5 1136157 non-null float64 \n",
" 39 ema_13 1136157 non-null float64 \n",
" 40 ema_20 1136157 non-null float64 \n",
" 41 ema_60 1136153 non-null float64 \n",
" 42 act_factor1 1136157 non-null float64 \n",
" 43 act_factor2 1136157 non-null float64 \n",
" 44 act_factor3 1136157 non-null float64 \n",
" 45 act_factor4 1136152 non-null float64 \n",
" 46 act_factor5 1136152 non-null float64 \n",
" 47 act_factor6 1136157 non-null float64 \n",
" 48 rank_act_factor1 1136157 non-null float64 \n",
" 49 rank_act_factor2 1136157 non-null float64 \n",
" 50 rank_act_factor3 1136157 non-null float64 \n",
" 51 active_buy_volume_large 1135659 non-null float64 \n",
" 52 active_buy_volume_big 1135636 non-null float64 \n",
" 53 active_buy_volume_small 1135663 non-null float64 \n",
" 54 buy_lg_vol - sell_lg_vol 1135660 non-null float64 \n",
" 55 buy_elg_vol - sell_elg_vol 1135640 non-null float64 \n",
" 56 future_return1 1136157 non-null float64 \n",
" 57 future_return2 1136157 non-null float64 \n",
" 58 future_return3 1136157 non-null float64 \n",
" 59 future_return4 1136157 non-null float64 \n",
" 60 future_return5 1136157 non-null float64 \n",
" 61 future_return6 1136157 non-null float64 \n",
" 62 future_return7 1136157 non-null float64 \n",
" 63 future_close1 1136157 non-null float64 \n",
" 64 future_close2 1136157 non-null float64 \n",
" 65 future_close3 1136157 non-null float64 \n",
" 66 future_close4 1136157 non-null float64 \n",
" 67 future_close5 1136157 non-null float64 \n",
" 68 future_af11 1136157 non-null float64 \n",
" 69 future_af12 1136157 non-null float64 \n",
" 70 future_af13 1136157 non-null float64 \n",
" 71 future_af14 1136157 non-null float64 \n",
" 72 future_af15 1136157 non-null float64 \n",
" 73 future_af21 1136157 non-null float64 \n",
" 74 future_af22 1136157 non-null float64 \n",
" 75 future_af23 1136157 non-null float64 \n",
" 76 future_af24 1136157 non-null float64 \n",
" 77 future_af25 1136157 non-null float64 \n",
" 78 future_af31 1136157 non-null float64 \n",
" 79 future_af32 1136157 non-null float64 \n",
" 80 future_af33 1136157 non-null float64 \n",
" 81 future_af34 1136157 non-null float64 \n",
" 82 future_af35 1136157 non-null float64 \n",
"dtypes: datetime64[ns](1), float64(80), object(2)\n",
"memory usage: 719.5+ MB\n",
"None\n"
]
}
],
"execution_count": 6
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T15:00:45.828404Z",
"start_time": "2025-02-09T15:00:45.294830Z"
}
},
"cell_type": "code",
"source": [
"def remove_outliers_iqr(series, lower_quantile=0.05, upper_quantile=0.95, threshold=1.5):\n",
" Q1 = series.quantile(lower_quantile)\n",
" Q3 = series.quantile(upper_quantile)\n",
" IQR = Q3 - Q1\n",
" lower_bound = Q1 - threshold * IQR\n",
" upper_bound = Q3 + threshold * IQR\n",
" # 过滤掉低于下边界或高于上边界的极值\n",
" return (series >= lower_bound) & (series <= upper_bound)\n",
"\n",
"\n",
"def neutralize_labels(labels, features, feature_columns, z_threshold=3, method='regression'):\n",
" labels_no_outliers = remove_outliers_iqr(labels)\n",
" return labels_no_outliers\n",
"\n",
"\n",
"train_data = df[df['trade_date'] <= '2023-01-01']\n",
"test_data = df[df['trade_date'] >= '2023-01-01']\n",
"\n",
"feature_columns = [col for col in df.columns if col not in ['trade_date',\n",
" 'ts_code',\n",
" 'label']]\n",
"feature_columns = [col for col in feature_columns if 'future' not in col]\n",
"feature_columns = [col for col in feature_columns if 'score' not in col]\n",
"feature_columns = [col for col in feature_columns if col not in origin_columns]\n",
"\n",
"# for column in [column for column in train_data.columns if 'future' in column]:\n",
"# label_index = neutralize_labels(train_data[column], train_data, feature_columns, z_threshold=3, method='regression')\n",
"# train_data = train_data[label_index]\n",
"# label_index = neutralize_labels(test_data[column], test_data, feature_columns, z_threshold=3, method='regression')\n",
"# test_data = test_data[label_index]\n",
"\n",
"print(len(train_data))\n",
"print(len(test_data))"
],
"id": "5f3d9aece75318cd",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['up', 'down', 'atr_14', 'atr_6', 'obv', 'maobv_6', 'obv-maobv_6', 'rsi_3', 'rsi_6', 'rsi_9', 'return_10', 'return_20', 'avg_close_5', 'std_return_5', 'std_return_15', 'std_return_25', 'std_return_90', 'std_return_90_2', 'std_return_5 / std_return_90', 'std_return_5 / std_return_25', 'std_return_90 - std_return_90_2', 'ema_5', 'ema_13', 'ema_20', 'ema_60', 'act_factor1', 'act_factor2', 'act_factor3', 'act_factor4', 'act_factor5', 'act_factor6', 'rank_act_factor1', 'rank_act_factor2', 'rank_act_factor3', 'active_buy_volume_large', 'active_buy_volume_big', 'active_buy_volume_small', 'buy_lg_vol - sell_lg_vol', 'buy_elg_vol - sell_elg_vol']\n"
]
}
],
"execution_count": 19
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:56:05.319915Z",
"start_time": "2025-02-09T14:56:03.355725Z"
}
},
"cell_type": "code",
"source": [
"def get_qcuts(series, quantiles):\n",
" q = pd.qcut(series, q=quantiles, labels=False, duplicates='drop')\n",
" return q[-1] # 返回窗口最后一个元素的分位数标签\n",
"\n",
"\n",
"window = 5\n",
"quantiles = 20\n",
"\n",
"\n",
"def get_label(df):\n",
" labels = df['future_af13'] - df['act_factor1']\n",
" # labels = df['future_close3']\n",
" return labels\n",
"\n",
"\n",
"train_data['label'], test_data['label'] = get_label(train_data), get_label(test_data)\n",
"\n",
"train_data, test_data = train_data.dropna(subset=['label']), test_data.dropna(subset=['label'])\n",
"train_data, test_data = train_data.replace([np.inf, -np.inf], np.nan).dropna(), test_data.replace([np.inf, -np.inf],\n",
" np.nan).dropna()\n",
"train_data, test_data = train_data.reset_index(drop=True), test_data.reset_index(drop=True)\n",
"\n",
"print(len(train_data))\n",
"print(len(test_data))"
],
"id": "f4f16d63ad18d1bc",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"875004\n",
"最小日期: 2017-01-03\n",
"最大日期: 2022-12-30\n",
"260581\n",
"最小日期: 2023-01-03\n",
"最大日期: 2025-01-27\n"
]
}
],
"execution_count": 13
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:56:05.480695Z",
"start_time": "2025-02-09T14:56:05.367238Z"
}
},
"cell_type": "code",
"source": [
"import lightgbm as lgb\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import optuna\n",
"from sklearn.model_selection import KFold\n",
"from sklearn.metrics import mean_absolute_error\n",
"import os\n",
"import json\n",
"import pickle\n",
"import hashlib\n",
"\n",
"\n",
"def objective(trial, X, y, num_boost_round, params):\n",
" # 参数网格\n",
" X, y = X.reset_index(drop=True), y.reset_index(drop=True)\n",
" param_grid = {\n",
" \"n_estimators\": trial.suggest_categorical(\"n_estimators\", [10000]),\n",
" \"learning_rate\": trial.suggest_float(\"learning_rate\", 0.01, 0.3),\n",
" \"num_leaves\": trial.suggest_int(\"num_leaves\", 20, 3000, step=25),\n",
" \"max_depth\": trial.suggest_int(\"max_depth\", 3, 16),\n",
" \"min_data_in_leaf\": trial.suggest_int(\"min_data_in_leaf\", 200, 10000, step=100),\n",
" \"lambda_l1\": trial.suggest_int(\"lambda_l1\", 0, 100, step=5),\n",
" \"lambda_l2\": trial.suggest_int(\"lambda_l2\", 0, 100, step=5),\n",
" \"min_gain_to_split\": trial.suggest_float(\"min_gain_to_split\", 0, 15),\n",
" \"bagging_fraction\": trial.suggest_float(\"bagging_fraction\", 0.2, 0.95, step=0.1),\n",
" \"bagging_freq\": trial.suggest_categorical(\"bagging_freq\", [1]),\n",
" \"feature_fraction\": trial.suggest_float(\"feature_fraction\", 0.2, 0.95, step=0.1),\n",
" \"random_state\": 1,\n",
" \"objective\": 'regression',\n",
" 'verbosity': -1\n",
" }\n",
" # 5折交叉验证\n",
" cv = KFold(n_splits=5, shuffle=False)\n",
"\n",
" cv_scores = np.empty(5)\n",
" for idx, (train_idx, test_idx) in enumerate(cv.split(X, y)):\n",
" X_train, X_test = X.iloc[train_idx], X.iloc[test_idx]\n",
" y_train, y_test = y[train_idx], y[test_idx]\n",
"\n",
" # LGBM建模\n",
" model = lgb.LGBMRegressor(**param_grid, num_boost_round=num_boost_round)\n",
" model.fit(\n",
" X_train,\n",
" y_train,\n",
" eval_set=[(X_test, y_test)],\n",
" eval_metric=\"l2\",\n",
" callbacks=[\n",
" # LightGBMPruningCallback(trial, \"l2\"),\n",
" lgb.early_stopping(50, first_metric_only=True),\n",
" lgb.log_evaluation(period=-1)\n",
" ],\n",
" )\n",
" # 模型预测\n",
" preds = model.predict(X_test)\n",
" # 优化指标logloss最小\n",
" cv_scores[idx] = mean_absolute_error(y_test, preds)\n",
"\n",
" return np.mean(cv_scores)\n",
"\n",
"def generate_key(params, feature_columns, num_boost_round):\n",
" key_data = {\n",
" \"params\": params,\n",
" \"feature_columns\": feature_columns,\n",
" \"num_boost_round\": num_boost_round\n",
" }\n",
" # 转换成排序后的 JSON 字符串,再生成 md5 hash\n",
" key_str = json.dumps(key_data, sort_keys=True)\n",
" return hashlib.md5(key_str.encode('utf-8')).hexdigest()\n",
"\n",
"def train_light_model(df, params, feature_columns, callbacks, evals,\n",
" print_feature_importance=True, num_boost_round=100,\n",
" use_optuna=False):\n",
" cache_file = 'light_model.pkl'\n",
" cache_key = generate_key(params, feature_columns, num_boost_round)\n",
"\n",
" # 检查缓存文件是否存在\n",
" if os.path.exists(cache_file):\n",
" try:\n",
" with open(cache_file, 'rb') as f:\n",
" cache_data = pickle.load(f)\n",
" if cache_data.get('key') == cache_key:\n",
" print(\"加载缓存模型...\")\n",
" return cache_data.get('model')\n",
" else:\n",
" print(\"缓存模型的参数与当前参数不匹配,重新训练模型。\")\n",
" except Exception as e:\n",
" print(f\"加载缓存失败: {e},重新训练模型。\")\n",
" else:\n",
" print(\"未发现缓存模型,开始训练新模型。\")\n",
" # 确保数据按照 date 和 label 排序\n",
" df_sorted = df.sort_values(by=['trade_date', 'label'], ascending=[True, False]) # 按日期升序、标签降序排序\n",
" df_sorted = df_sorted.sort_values(by='trade_date')\n",
" unique_dates = df_sorted['trade_date'].unique()\n",
" val_date_count = int(len(unique_dates) * 0.1)\n",
" val_dates = unique_dates[-val_date_count:]\n",
" val_indices = df_sorted[df_sorted['trade_date'].isin(val_dates)].index\n",
" train_indices = df_sorted[~df_sorted['trade_date'].isin(val_dates)].index\n",
"\n",
" # 获取训练集和验证集的样本\n",
" train_df = df_sorted.iloc[train_indices]\n",
" val_df = df_sorted.iloc[val_indices]\n",
"\n",
" X_train = train_df[feature_columns]\n",
" y_train = train_df['label']\n",
"\n",
" X_val = val_df[feature_columns]\n",
" y_val = val_df['label']\n",
"\n",
" train_data = lgb.Dataset(X_train, label=y_train)\n",
" val_data = lgb.Dataset(X_val, label=y_val)\n",
" if use_optuna:\n",
" # study = optuna.create_study(direction='minimize' if classify else 'maximize')\n",
" study = optuna.create_study(direction='minimize')\n",
" study.optimize(lambda trial: objective(trial, X_train, y_train, num_boost_round, params), n_trials=20)\n",
"\n",
" print(f\"Best parameters: {study.best_trial.params}\")\n",
" print(f\"Best score: {study.best_trial.value}\")\n",
"\n",
" params.update(study.best_trial.params)\n",
" model = lgb.train(\n",
" params, train_data, num_boost_round=num_boost_round,\n",
" valid_sets=[train_data, val_data], valid_names=['train', 'valid'],\n",
" callbacks=callbacks\n",
" )\n",
"\n",
" # 打印特征重要性(如果需要)\n",
" if print_feature_importance:\n",
" lgb.plot_metric(evals)\n",
" lgb.plot_tree(model, figsize=(20, 8))\n",
" lgb.plot_importance(model, importance_type='split', max_num_features=20)\n",
" plt.show()\n",
" # with open(cache_file, 'wb') as f:\n",
" # pickle.dump({'key': cache_key,\n",
" # 'model': model,\n",
" # 'feature_columns': feature_columns}, f)\n",
" # print(\"模型训练完成并已保存缓存。\")\n",
" return model\n",
"\n",
"\n",
"from catboost import CatBoostRegressor\n",
"import pandas as pd\n",
"\n",
"\n",
"def train_catboost(df, num_boost_round, params=None):\n",
" \"\"\"\n",
" 训练 CatBoost 排序模型\n",
" - df: 包含因子、date、instrument 和 label 的 DataFrame\n",
" - num_boost_round: 训练的轮数\n",
" - print_feature_importance: 是否打印特征重要性\n",
" - plot: 是否绘制特征重要性图\n",
" - split_date: 用于划分训练集和验证集的日期(比如 '2020-01-01'\n",
"\n",
" 返回训练好的模型\n",
" \"\"\"\n",
" df_sorted = df.sort_values(by=['date', 'label'], ascending=[True, False])\n",
"\n",
" # 提取特征和标签\n",
" feature_columns = [col for col in df.columns if col not in ['date',\n",
" 'instrument',\n",
" 'label']]\n",
" feature_columns = [col for col in feature_columns if 'future' not in col]\n",
" feature_columns = [col for col in feature_columns if 'score' not in col]\n",
"\n",
" df_sorted = df_sorted.sort_values(by='date')\n",
" unique_dates = df_sorted['date'].unique()\n",
" val_date_count = int(len(unique_dates) * 0.1)\n",
" val_dates = unique_dates[-val_date_count:]\n",
" val_indices = df_sorted[df_sorted['date'].isin(val_dates)].index\n",
" train_indices = df_sorted[~df_sorted['date'].isin(val_dates)].index\n",
"\n",
" # 获取训练集和验证集的样本\n",
" train_df = df_sorted.iloc[train_indices].sort_values(by=['date', 'label'], ascending=[True, False])\n",
" val_df = df_sorted.iloc[val_indices].sort_values(by=['date', 'label'], ascending=[True, False])\n",
"\n",
" X_train = train_df[feature_columns]\n",
" y_train = train_df['label']\n",
"\n",
" X_val = val_df[feature_columns]\n",
" y_val = val_df['label']\n",
"\n",
" model = CatBoostRegressor(**params, iterations=num_boost_round)\n",
" model.fit(X_train,\n",
" y_train,\n",
" eval_set=(X_val, y_val))\n",
"\n",
" return model"
],
"id": "8f134d435f71e9e2",
"outputs": [],
"execution_count": 14
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:56:05.576927Z",
"start_time": "2025-02-09T14:56:05.480695Z"
}
},
"cell_type": "code",
"source": [
"light_params = {\n",
" 'objective': 'regression',\n",
" 'metric': 'l2',\n",
" 'learning_rate': 0.05,\n",
" 'is_unbalance': True,\n",
" 'num_leaves': 2048,\n",
" 'min_data_in_leaf': 16,\n",
" 'max_depth': 32,\n",
" 'max_bin': 1024,\n",
" 'nthread': 2,\n",
" 'feature_fraction': 0.7,\n",
" 'bagging_fraction': 0.7,\n",
" 'bagging_freq': 5,\n",
" 'lambda_l1': 80,\n",
" 'lambda_l2': 65,\n",
" 'verbosity': -1\n",
"}"
],
"id": "4a4542e1ed6afe7d",
"outputs": [],
"execution_count": 15
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:57:25.341222Z",
"start_time": "2025-02-09T14:56:05.640256Z"
}
},
"cell_type": "code",
"source": [
"print('train data size: ', len(train_data))\n",
"df = train_data\n",
"\n",
"evals = {}\n",
"light_model = train_light_model(train_data, light_params, feature_columns,\n",
" [lgb.log_evaluation(period=500),\n",
" lgb.callback.record_evaluation(evals),\n",
" lgb.early_stopping(50, first_metric_only=True)\n",
" ], evals,\n",
" num_boost_round=1000, use_optuna=False,\n",
" print_feature_importance=False)"
],
"id": "beeb098799ecfa6a",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"train data size: 875004\n",
"未发现缓存模型,开始训练新模型。\n",
"Training until validation scores don't improve for 50 rounds\n",
"Early stopping, best iteration is:\n",
"[378]\ttrain's l2: 0.435049\tvalid's l2: 0.589178\n",
"Evaluated only: l2\n"
]
}
],
"execution_count": 16
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:57:27.394697Z",
"start_time": "2025-02-09T14:57:25.373274Z"
}
},
"cell_type": "code",
"source": [
"test_data['score'] = light_model.predict(test_data[feature_columns])\n",
"predictions = test_data.loc[test_data.groupby('trade_date')['score'].idxmax()]"
],
"id": "5bb96ca8492e74d",
"outputs": [],
"execution_count": 17
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-09T14:57:27.489570Z",
"start_time": "2025-02-09T14:57:27.397368Z"
}
},
"cell_type": "code",
"source": "predictions[['trade_date', 'score', 'ts_code']].to_csv('predictions.csv', index=False)",
"id": "5d1522a7538db91b",
"outputs": [],
"execution_count": 18
}
],
"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
}

486
code/train/predictions.csv Normal file
View File

@@ -0,0 +1,486 @@
trade_date,score,ts_code
2023-01-03,0.6847274162535452,600965.SH
2023-01-04,0.7414192412896188,000615.SZ
2023-01-05,0.5542654290126795,000430.SZ
2023-01-06,0.6959513776962396,002640.SZ
2023-01-09,0.7412055912703203,600785.SH
2023-01-10,0.6855907318251123,002762.SZ
2023-01-11,0.7292345443148791,002719.SZ
2023-01-12,0.7309633018913224,600996.SH
2023-01-13,0.8190324397886146,002279.SZ
2023-01-16,0.784606092607123,000850.SZ
2023-01-17,0.7241262895910806,002441.SZ
2023-01-18,0.7040191348893544,002467.SZ
2023-01-19,1.4428906481799044,002195.SZ
2023-01-20,0.8043769403690574,000561.SZ
2023-01-30,0.8713260866140435,000913.SZ
2023-01-31,0.7091214216170246,002560.SZ
2023-02-01,0.8674507984004312,002576.SZ
2023-02-02,0.8435316672358789,002576.SZ
2023-02-03,0.3637794960484866,603698.SH
2023-02-06,0.8498784343039595,002401.SZ
2023-02-07,0.5210597972482388,002767.SZ
2023-02-08,0.9567872514253289,002368.SZ
2023-02-09,0.5267235816880836,002155.SZ
2023-02-10,0.8402723790587989,002348.SZ
2023-02-13,0.4846072502710197,002348.SZ
2023-02-14,0.7626025684565886,002877.SZ
2023-02-15,0.697045569808066,600225.SH
2023-02-16,0.8282986278708487,002748.SZ
2023-02-17,1.8315250204409614,601020.SH
2023-02-20,0.9746443150927466,003021.SZ
2023-02-21,1.33028636760986,002339.SZ
2023-02-22,0.7778102046341324,002167.SZ
2023-02-23,1.1313865958453686,600100.SH
2023-02-24,0.5636940136703907,000716.SZ
2023-02-27,1.1864163478203489,600557.SH
2023-02-28,1.0001756905854564,603129.SH
2023-03-01,0.859829916936714,603025.SH
2023-03-02,0.7059826582301507,603186.SH
2023-03-03,0.6713484518505006,002942.SZ
2023-03-06,0.7514650334919161,002362.SZ
2023-03-07,0.9199279895136431,002350.SZ
2023-03-08,0.7172896853160168,601872.SH
2023-03-09,1.2558830649002728,002808.SZ
2023-03-10,1.2172505980712502,003020.SZ
2023-03-13,0.5215320654292881,600363.SH
2023-03-14,1.0463998807907229,601872.SH
2023-03-15,0.583641209552904,603966.SH
2023-03-16,0.9789347178467226,603803.SH
2023-03-17,0.6572400306835567,600780.SH
2023-03-20,0.9514948440683256,601003.SH
2023-03-21,0.842214622933076,002439.SZ
2023-03-22,1.1462525936633026,601698.SH
2023-03-23,0.48812639918095935,601199.SH
2023-03-24,0.4727906220196696,601698.SH
2023-03-27,0.7956407883949915,000810.SZ
2023-03-28,0.9780023176799034,601698.SH
2023-03-29,0.7581739222176508,002558.SZ
2023-03-30,1.2088597249444364,002425.SZ
2023-03-31,1.0383208709472522,000938.SZ
2023-04-03,0.7742369597473725,001872.SZ
2023-04-04,0.8024470755073208,002858.SZ
2023-04-06,0.7607284837753079,002261.SZ
2023-04-07,0.9927088245634893,002261.SZ
2023-04-10,0.8693657271995023,603019.SH
2023-04-11,1.3756495540495381,600228.SH
2023-04-12,0.6041603413288005,002222.SZ
2023-04-13,0.7744980911161148,002777.SZ
2023-04-14,0.8672190988257731,600633.SH
2023-04-17,1.4449313652608706,603083.SH
2023-04-18,0.6773096694945689,002517.SZ
2023-04-19,2.078581022345213,002908.SZ
2023-04-20,0.9806780152085147,600203.SH
2023-04-21,0.8344159521107176,000686.SZ
2023-04-24,1.210049105329498,600749.SH
2023-04-25,1.4048193576090038,603699.SH
2023-04-26,1.4845584717530398,600750.SH
2023-04-27,1.7290167418990006,002351.SZ
2023-04-28,0.6169128309035838,002343.SZ
2023-05-04,0.406077908055111,603019.SH
2023-05-05,0.9080152593104391,603258.SH
2023-05-08,0.796876165601434,603083.SH
2023-05-09,0.9700970682165659,002291.SZ
2023-05-10,1.3258832446428042,002291.SZ
2023-05-11,0.8900850443360986,600750.SH
2023-05-12,1.0650432251092237,601318.SH
2023-05-15,0.6787099027648815,002760.SZ
2023-05-16,0.722076527194143,603357.SH
2023-05-17,1.053645140729648,603357.SH
2023-05-18,0.6034913204660662,601518.SH
2023-05-19,0.5868824391890941,000600.SZ
2023-05-22,0.7653788907870708,002315.SZ
2023-05-23,0.8498831870683509,003021.SZ
2023-05-24,0.8222394685174235,600337.SH
2023-05-25,0.9415393784400905,600587.SH
2023-05-26,0.520220425480583,000600.SZ
2023-05-29,0.6595697603731597,002334.SZ
2023-05-30,0.606477318736669,603790.SH
2023-05-31,0.694237121673502,603662.SH
2023-06-01,0.5921959927449983,603196.SH
2023-06-02,0.6895081721399422,603019.SH
2023-06-05,0.5566382152721012,001309.SZ
2023-06-06,1.892873809852157,002587.SZ
2023-06-07,0.7678242983656595,605011.SH
2023-06-08,1.0539866095101476,000938.SZ
2023-06-09,0.8147649527362582,002292.SZ
2023-06-12,0.7188933998461803,002173.SZ
2023-06-13,0.681977313547429,603097.SH
2023-06-14,0.8733642333159071,002865.SZ
2023-06-15,0.8968643954524321,603108.SH
2023-06-16,0.7840028396319321,002897.SZ
2023-06-19,0.8775653925608153,603319.SH
2023-06-20,1.0844187891842454,002902.SZ
2023-06-21,1.2927896026027148,603629.SH
2023-06-26,1.2292848291237288,002261.SZ
2023-06-27,1.3781866321602365,000938.SZ
2023-06-28,0.8540277846763247,601138.SH
2023-06-29,0.8523211757782663,603779.SH
2023-06-30,1.1754329601349267,601127.SH
2023-07-03,1.2249906293712542,603015.SH
2023-07-04,1.1084820336750372,000936.SZ
2023-07-05,1.2710980206868936,000936.SZ
2023-07-06,0.747949676257483,603728.SH
2023-07-07,0.9061602512086774,002835.SZ
2023-07-10,0.9551342600022579,002126.SZ
2023-07-11,0.966971776030953,603767.SH
2023-07-12,0.9443518376543841,601886.SH
2023-07-13,0.6769606633633086,603085.SH
2023-07-14,0.918333951173531,002036.SZ
2023-07-17,0.6569232106980998,603045.SH
2023-07-18,0.7121594789903711,002409.SZ
2023-07-19,0.7294037039105077,002548.SZ
2023-07-20,0.7381883846308512,002703.SZ
2023-07-21,0.7652204062690017,002997.SZ
2023-07-24,0.9003480376547147,000550.SZ
2023-07-25,0.6357345607310146,605020.SH
2023-07-26,0.5810885924302148,605020.SH
2023-07-27,0.8761890730266239,002316.SZ
2023-07-28,0.9028509127260252,000716.SZ
2023-07-31,0.4708956316796065,601777.SH
2023-08-01,0.5561891737811866,600763.SH
2023-08-02,0.8760196470112966,002719.SZ
2023-08-03,0.7648464404493108,002400.SZ
2023-08-04,0.7791782042380738,601799.SH
2023-08-07,0.8061135186567487,000797.SZ
2023-08-08,1.1666879365515435,600322.SH
2023-08-09,1.4355955291322207,000006.SZ
2023-08-10,1.2886157376213954,000656.SZ
2023-08-11,1.3479230675318692,002941.SZ
2023-08-14,1.0490220109983646,601377.SH
2023-08-15,1.0632174359473308,600376.SH
2023-08-16,1.050421116938835,002126.SZ
2023-08-17,0.6717173215978612,000948.SZ
2023-08-18,0.9668301556287141,002907.SZ
2023-08-21,1.1746853792925736,003005.SZ
2023-08-22,0.9584954141170795,600838.SH
2023-08-23,1.2457408517312187,001234.SZ
2023-08-24,1.0823923917882998,002999.SZ
2023-08-25,0.9378153059525566,603918.SH
2023-08-28,1.2421433405918902,603767.SH
2023-08-29,0.616127073238452,002696.SZ
2023-08-30,0.9031479500764501,000010.SZ
2023-08-31,0.8845829289455852,000010.SZ
2023-09-01,0.6016754849643945,600272.SH
2023-09-04,0.7558571185023197,600272.SH
2023-09-05,0.4028980705656072,000678.SZ
2023-09-06,0.659374499556469,603080.SH
2023-09-07,0.6245495405404559,000609.SZ
2023-09-08,0.6710722697700532,603919.SH
2023-09-11,0.6278048802992457,600546.SH
2023-09-12,0.8256329238016435,600546.SH
2023-09-13,0.9974851537103986,601127.SH
2023-09-14,1.2529240943908486,603005.SH
2023-09-15,0.6551278623697204,603306.SH
2023-09-18,0.62491397271537,000851.SZ
2023-09-19,0.9590430560641906,600293.SH
2023-09-20,0.9192992329949209,600895.SH
2023-09-21,1.303323539412371,603667.SH
2023-09-22,0.6392556165728372,002406.SZ
2023-09-25,0.550363061204975,603933.SH
2023-09-26,0.8885810012289143,000766.SZ
2023-09-27,1.3119504188158804,605588.SH
2023-09-28,0.6383963467007131,002885.SZ
2023-10-09,0.5559833174181884,603277.SH
2023-10-10,0.6746335129218759,002855.SZ
2023-10-11,0.48076279797688554,001319.SZ
2023-10-12,0.4648032423789084,002953.SZ
2023-10-13,0.7973569102606312,605588.SH
2023-10-16,0.6753500013003589,603929.SH
2023-10-17,0.939032197442827,002786.SZ
2023-10-18,1.3316765134484991,603005.SH
2023-10-19,1.5107094655109568,002728.SZ
2023-10-20,1.8033472200834302,603890.SH
2023-10-23,2.0156758075487904,000526.SZ
2023-10-24,1.733095955568728,600186.SH
2023-10-25,1.0763644734039597,002456.SZ
2023-10-26,0.6254989123134431,600155.SH
2023-10-27,0.9189894086467906,000712.SZ
2023-10-30,0.82608918468284,600839.SH
2023-10-31,0.7212314254570089,001319.SZ
2023-11-01,0.7217175319235539,002657.SZ
2023-11-02,0.7778599932153227,002456.SZ
2023-11-03,1.3422820103526423,603985.SH
2023-11-06,0.5239681122691597,600595.SH
2023-11-07,0.5067988914432168,000520.SZ
2023-11-08,0.8068628626883659,603009.SH
2023-11-09,0.795444145270753,601127.SH
2023-11-10,0.7853290033363176,600630.SH
2023-11-13,0.6675304106579922,601595.SH
2023-11-14,0.2361369659661822,000828.SZ
2023-11-15,1.3945937102768664,603598.SH
2023-11-16,0.9576360953800751,000628.SZ
2023-11-17,0.6890730621251102,603108.SH
2023-11-20,0.7909511281469108,000628.SZ
2023-11-21,0.8142228770378246,000925.SZ
2023-11-22,0.797507102177366,000550.SZ
2023-11-23,0.7063630358338048,000676.SZ
2023-11-24,1.036008941153352,002181.SZ
2023-11-27,1.0291531391754778,000503.SZ
2023-11-28,0.9076486100273481,600775.SH
2023-11-29,0.7882491062137358,000669.SZ
2023-11-30,1.0967518981113826,000669.SZ
2023-12-01,0.7311870736612255,000625.SZ
2023-12-04,1.0691371238894785,603286.SH
2023-12-05,1.3131270390024472,605188.SH
2023-12-06,0.7752257820655966,000628.SZ
2023-12-07,0.8197027217611897,600107.SH
2023-12-08,1.3967047074635028,603488.SH
2023-12-11,0.687045285463665,002277.SZ
2023-12-12,0.665884682887716,600593.SH
2023-12-13,0.654047737248992,600476.SH
2023-12-14,1.0532572750390772,603106.SH
2023-12-15,1.0658083351666034,603358.SH
2023-12-18,0.962400311858336,000766.SZ
2023-12-19,0.7287547482546808,603103.SH
2023-12-20,1.2148728495986132,002647.SZ
2023-12-21,0.7541763251442525,002858.SZ
2023-12-22,0.8726322448001688,600178.SH
2023-12-25,0.8241484608574933,605011.SH
2023-12-26,0.9109440061301425,603992.SH
2023-12-27,0.8418823218408088,002660.SZ
2023-12-28,0.6918104133614209,002238.SZ
2023-12-29,0.587505902687491,002495.SZ
2024-01-02,0.9211111544777676,002587.SZ
2024-01-03,0.7226235020970133,000691.SZ
2024-01-04,0.9569550769001772,002962.SZ
2024-01-05,1.1926365483735857,605117.SH
2024-01-08,1.2688927804343633,603032.SH
2024-01-09,0.658120719671456,002862.SZ
2024-01-10,1.0753659753822198,000698.SZ
2024-01-11,0.8894494773121738,603097.SH
2024-01-12,0.9087175987157813,600593.SH
2024-01-15,0.5892323752732013,603212.SH
2024-01-16,0.7839193778147607,000698.SZ
2024-01-17,1.0625258983405035,603172.SH
2024-01-18,1.2631347573071583,002033.SZ
2024-01-19,1.178331671274573,603579.SH
2024-01-22,1.6352965224693876,605268.SH
2024-01-23,1.4266068895392103,605117.SH
2024-01-24,0.8002314972730927,600138.SH
2024-01-25,0.6269522471780932,603099.SH
2024-01-26,1.1309900405971738,605111.SH
2024-01-29,1.125066361142788,002253.SZ
2024-01-30,1.351423375727843,003007.SZ
2024-01-31,1.5739771441257069,601138.SH
2024-02-01,1.499054147286471,002033.SZ
2024-02-02,1.5167645269468597,601038.SH
2024-02-05,1.903436398968963,000998.SZ
2024-02-06,0.8212170920332696,600705.SH
2024-02-07,0.8351364611756162,603199.SH
2024-02-08,0.6822013314565247,601998.SH
2024-02-19,0.5444839345994206,000999.SZ
2024-02-20,0.5734873097155654,603369.SH
2024-02-21,0.43260992475178217,600023.SH
2024-02-22,0.4837658423417254,000526.SZ
2024-02-23,0.25932845682914313,000157.SZ
2024-02-26,0.37391625217883473,000983.SZ
2024-02-27,0.06249364085384111,002039.SZ
2024-02-28,1.038623993098607,000680.SZ
2024-02-29,0.11792404338777529,603871.SH
2024-03-01,0.30810066963043975,603605.SH
2024-03-04,0.17622933681947947,600375.SH
2024-03-05,1.0199617166369774,002009.SZ
2024-03-06,0.7025950679251926,002209.SZ
2024-03-07,0.8130361341508562,002317.SZ
2024-03-08,0.6714948117029352,603960.SH
2024-03-11,0.7527103580484402,603960.SH
2024-03-12,0.773794092704635,603960.SH
2024-03-13,0.6395980350337678,603499.SH
2024-03-14,0.6983134888804106,603660.SH
2024-03-15,0.990357376475744,601138.SH
2024-03-18,0.4182273803259301,002075.SZ
2024-03-19,0.8116021296004745,603050.SH
2024-03-20,0.6916582321872963,605580.SH
2024-03-21,0.7126108686308776,002698.SZ
2024-03-22,0.795964501966808,603190.SH
2024-03-25,1.0652068531193497,603286.SH
2024-03-26,1.2060727717193194,002331.SZ
2024-03-27,1.8308956146424886,001696.SZ
2024-03-28,1.5762953683649072,002645.SZ
2024-03-29,0.8133804882766478,002055.SZ
2024-04-01,0.6881987381521469,002735.SZ
2024-04-02,0.9728619403924941,002085.SZ
2024-04-03,0.9735850429701983,002625.SZ
2024-04-08,0.9464502611855133,002805.SZ
2024-04-09,1.10422053943107,002085.SZ
2024-04-10,0.699553803327553,603822.SH
2024-04-11,1.2813227488155954,002544.SZ
2024-04-12,0.9677010248477915,605198.SH
2024-04-15,1.2722648770139777,002290.SZ
2024-04-16,2.1135975645782725,002521.SZ
2024-04-17,1.0448007042761251,000737.SZ
2024-04-18,1.3682438721410928,603619.SH
2024-04-19,0.6510347025537216,000933.SZ
2024-04-22,1.1007294592332375,600529.SH
2024-04-23,1.0096847778899667,002078.SZ
2024-04-24,0.5132039397179469,000949.SZ
2024-04-25,1.7289140437217827,600066.SH
2024-04-26,1.048178737250126,603556.SH
2024-04-29,0.28151131629200876,000949.SZ
2024-04-30,0.5902959535550075,605098.SH
2024-05-06,0.8659440618533316,001696.SZ
2024-05-07,0.4125483888931327,002225.SZ
2024-05-08,0.49991019731911135,002597.SZ
2024-05-09,0.8523675809088074,002590.SZ
2024-05-10,0.6072304373378594,001696.SZ
2024-05-13,0.9449133844307348,600326.SH
2024-05-14,0.756524501371889,002025.SZ
2024-05-15,0.7974348512463216,600682.SH
2024-05-16,0.9752446361705888,600644.SH
2024-05-17,1.1846986232709233,000702.SZ
2024-05-20,0.7167728676668204,002851.SZ
2024-05-21,1.071890852713521,603683.SH
2024-05-22,0.7124540930368298,600463.SH
2024-05-23,1.5016154741945653,002225.SZ
2024-05-24,1.2198831133459211,002968.SZ
2024-05-27,0.9536299254414154,000656.SZ
2024-05-28,0.8425457543469408,002761.SZ
2024-05-29,0.652762060180136,600979.SH
2024-05-30,0.9000889953940735,002455.SZ
2024-05-31,0.9330771253458983,601825.SH
2024-06-03,1.2914669574335471,001267.SZ
2024-06-04,0.829699499403838,600530.SH
2024-06-05,1.0758350766018299,002922.SZ
2024-06-06,0.8595311066455215,603360.SH
2024-06-07,1.0888503051113,002889.SZ
2024-06-11,1.0628038633716435,002475.SZ
2024-06-12,1.1159013979424315,603009.SH
2024-06-13,1.1812561799680747,600996.SH
2024-06-14,0.8256170648299659,600039.SH
2024-06-17,0.8645410455127762,000528.SZ
2024-06-18,0.6063406599939511,600996.SH
2024-06-19,0.7166446473651414,600192.SH
2024-06-20,0.932110291603618,605598.SH
2024-06-21,0.9558209107020993,603936.SH
2024-06-24,1.119014534304907,600992.SH
2024-06-25,1.3527294398026957,600584.SH
2024-06-26,0.7188166389093542,000504.SZ
2024-06-27,1.9515093336713365,002452.SZ
2024-06-28,0.8843544096493936,600889.SH
2024-07-01,0.6545882280229176,003004.SZ
2024-07-02,0.6762487770835988,600584.SH
2024-07-03,0.9128444390874889,601179.SH
2024-07-04,1.1423863246899275,603225.SH
2024-07-05,0.9324658736527716,603936.SH
2024-07-08,1.780537827812583,603328.SH
2024-07-09,0.7579237257512456,000679.SZ
2024-07-10,0.6704021737995826,605117.SH
2024-07-11,0.6117132499929072,000622.SZ
2024-07-12,1.0566477568456074,002452.SZ
2024-07-15,0.6602660923500289,605081.SH
2024-07-16,0.5502090318853736,002420.SZ
2024-07-17,0.6837622842594867,002355.SZ
2024-07-18,0.8242173773899442,002384.SZ
2024-07-19,0.9979238076969816,002384.SZ
2024-07-22,0.4982073979858695,000421.SZ
2024-07-23,1.1543952284060066,002428.SZ
2024-07-24,1.2334918071766405,605111.SH
2024-07-25,0.8987252044027945,002496.SZ
2024-07-26,0.8562640506752258,600171.SH
2024-07-29,0.5774106541432314,002750.SZ
2024-07-30,0.5406184547635255,600563.SH
2024-07-31,0.5575394015591096,002700.SZ
2024-08-01,0.3836358457058139,600099.SH
2024-08-02,0.670543769867587,605081.SH
2024-08-05,1.2561423052432321,605117.SH
2024-08-06,0.9373802633817199,000584.SZ
2024-08-07,0.8074459777954732,603032.SH
2024-08-08,0.8017404350976902,600611.SH
2024-08-09,0.9444750578832374,000659.SZ
2024-08-12,0.8308531709022774,000880.SZ
2024-08-13,0.6345130236563948,600266.SH
2024-08-14,0.7618996741024034,000159.SZ
2024-08-15,0.7957196976564392,000880.SZ
2024-08-16,0.8007104277247147,603050.SH
2024-08-19,0.8488617680848443,603444.SH
2024-08-20,1.049247341754445,002488.SZ
2024-08-21,1.2543709456137933,002488.SZ
2024-08-22,1.0702026523317902,002208.SZ
2024-08-23,1.0790725273037058,002369.SZ
2024-08-26,0.8933596937509765,000532.SZ
2024-08-27,0.9555026539273229,605318.SH
2024-08-28,0.8517730333686951,002547.SZ
2024-08-29,0.8787028549560587,003001.SZ
2024-08-30,0.5949301031458588,601898.SH
2024-09-02,1.0927036539101782,603826.SH
2024-09-03,0.5011518255679451,000810.SZ
2024-09-04,0.913670019713004,001298.SZ
2024-09-05,0.5722903163709645,600375.SH
2024-09-06,1.054280211341685,002622.SZ
2024-09-09,1.1145869455283224,600375.SH
2024-09-10,0.6071645644461853,600804.SH
2024-09-11,0.8120257237744295,002808.SZ
2024-09-12,0.7226510652354332,600148.SH
2024-09-13,1.4358476935516946,603615.SH
2024-09-18,0.8351081061832145,002946.SZ
2024-09-19,0.605865384829211,600898.SH
2024-09-20,0.9533885243905273,603398.SH
2024-09-23,1.046054385469168,601162.SH
2024-09-24,0.3758184358111333,603559.SH
2024-09-25,0.8156363720747627,600756.SH
2024-09-26,0.5051488053045387,600550.SH
2024-09-27,0.16901120016969293,002016.SZ
2024-09-30,0.03361915273177237,603106.SH
2024-10-08,0.02829952163781644,603106.SH
2024-10-09,0.15132702693149014,601336.SH
2024-10-10,0.5264407322666304,000402.SZ
2024-10-11,1.0343311919140215,600657.SH
2024-10-14,0.47180187869811324,603383.SH
2024-10-15,0.8703255693900985,603106.SH
2024-10-16,0.8602575981884926,002987.SZ
2024-10-17,0.8415090474760394,000567.SZ
2024-10-18,0.15292428350076237,002542.SZ
2024-10-21,0.4922089945140812,002457.SZ
2024-10-22,0.4176771447393169,002423.SZ
2024-10-23,0.8519606263347589,000158.SZ
2024-10-24,0.5430046541942165,000935.SZ
2024-10-25,0.18041199007445233,603016.SH
2024-10-28,0.5571845419116188,000503.SZ
2024-10-29,0.4049481417593221,002851.SZ
2024-10-30,0.7134818524722009,600463.SH
2024-10-31,0.5829203522209173,603117.SH
2024-11-01,1.2246655429458404,002851.SZ
2024-11-04,0.8176452500049061,600843.SH
2024-11-05,0.896531400955133,002514.SZ
2024-11-06,0.8080466337179094,600292.SH
2024-11-07,0.8536978345761432,600481.SH
2024-11-08,0.735404763610977,002047.SZ
2024-11-11,0.7749352489908305,002428.SZ
2024-11-12,0.8967548353595826,002428.SZ
2024-11-13,1.0199850479686239,603859.SH
2024-11-14,0.9361081815051415,603559.SH
2024-11-15,1.5997213068383358,002086.SZ
2024-11-18,1.5789594007558525,002709.SZ
2024-11-19,1.5249787983366927,603825.SH
2024-11-20,0.736292965730012,002808.SZ
2024-11-21,0.7544341372210354,603859.SH
2024-11-22,1.2744170240551567,600593.SH
2024-11-25,0.8324187454861728,600787.SH
2024-11-26,1.0752006153991913,600736.SH
2024-11-27,0.6500606694243171,002245.SZ
2024-11-28,0.8456761058883665,000833.SZ
2024-11-29,0.8489157795122361,002354.SZ
2024-12-02,0.6832024025795977,002611.SZ
2024-12-03,0.8939114413301544,603366.SH
2024-12-04,1.0277665925094743,002822.SZ
2024-12-05,0.9103466279163851,002175.SZ
2024-12-06,0.7686238693084577,002467.SZ
2024-12-09,1.0846053237578963,601933.SH
2024-12-10,1.0700371757624498,600193.SH
2024-12-11,0.7673727634361369,002520.SZ
2024-12-12,0.8497906144901559,002362.SZ
2024-12-13,1.254346634364545,603429.SH
2024-12-16,1.0386293779387827,000727.SZ
2024-12-17,1.2458109349303497,600157.SH
2024-12-18,1.3409657396440136,003002.SZ
2024-12-19,1.1408332938187322,600593.SH
2024-12-20,0.8248161307709121,002512.SZ
2024-12-23,1.1576027817247634,002336.SZ
2024-12-24,0.8652560164174093,603610.SH
2024-12-25,0.8928903216570524,002045.SZ
2024-12-26,0.7436802683703838,603214.SH
2024-12-27,0.8278524197563604,002945.SZ
2024-12-30,0.6846259683364331,600223.SH
2024-12-31,1.0514482797503029,001309.SZ
2025-01-02,1.4104671874229635,603668.SH
1 trade_date score ts_code
2 2023-01-03 0.6847274162535452 600965.SH
3 2023-01-04 0.7414192412896188 000615.SZ
4 2023-01-05 0.5542654290126795 000430.SZ
5 2023-01-06 0.6959513776962396 002640.SZ
6 2023-01-09 0.7412055912703203 600785.SH
7 2023-01-10 0.6855907318251123 002762.SZ
8 2023-01-11 0.7292345443148791 002719.SZ
9 2023-01-12 0.7309633018913224 600996.SH
10 2023-01-13 0.8190324397886146 002279.SZ
11 2023-01-16 0.784606092607123 000850.SZ
12 2023-01-17 0.7241262895910806 002441.SZ
13 2023-01-18 0.7040191348893544 002467.SZ
14 2023-01-19 1.4428906481799044 002195.SZ
15 2023-01-20 0.8043769403690574 000561.SZ
16 2023-01-30 0.8713260866140435 000913.SZ
17 2023-01-31 0.7091214216170246 002560.SZ
18 2023-02-01 0.8674507984004312 002576.SZ
19 2023-02-02 0.8435316672358789 002576.SZ
20 2023-02-03 0.3637794960484866 603698.SH
21 2023-02-06 0.8498784343039595 002401.SZ
22 2023-02-07 0.5210597972482388 002767.SZ
23 2023-02-08 0.9567872514253289 002368.SZ
24 2023-02-09 0.5267235816880836 002155.SZ
25 2023-02-10 0.8402723790587989 002348.SZ
26 2023-02-13 0.4846072502710197 002348.SZ
27 2023-02-14 0.7626025684565886 002877.SZ
28 2023-02-15 0.697045569808066 600225.SH
29 2023-02-16 0.8282986278708487 002748.SZ
30 2023-02-17 1.8315250204409614 601020.SH
31 2023-02-20 0.9746443150927466 003021.SZ
32 2023-02-21 1.33028636760986 002339.SZ
33 2023-02-22 0.7778102046341324 002167.SZ
34 2023-02-23 1.1313865958453686 600100.SH
35 2023-02-24 0.5636940136703907 000716.SZ
36 2023-02-27 1.1864163478203489 600557.SH
37 2023-02-28 1.0001756905854564 603129.SH
38 2023-03-01 0.859829916936714 603025.SH
39 2023-03-02 0.7059826582301507 603186.SH
40 2023-03-03 0.6713484518505006 002942.SZ
41 2023-03-06 0.7514650334919161 002362.SZ
42 2023-03-07 0.9199279895136431 002350.SZ
43 2023-03-08 0.7172896853160168 601872.SH
44 2023-03-09 1.2558830649002728 002808.SZ
45 2023-03-10 1.2172505980712502 003020.SZ
46 2023-03-13 0.5215320654292881 600363.SH
47 2023-03-14 1.0463998807907229 601872.SH
48 2023-03-15 0.583641209552904 603966.SH
49 2023-03-16 0.9789347178467226 603803.SH
50 2023-03-17 0.6572400306835567 600780.SH
51 2023-03-20 0.9514948440683256 601003.SH
52 2023-03-21 0.842214622933076 002439.SZ
53 2023-03-22 1.1462525936633026 601698.SH
54 2023-03-23 0.48812639918095935 601199.SH
55 2023-03-24 0.4727906220196696 601698.SH
56 2023-03-27 0.7956407883949915 000810.SZ
57 2023-03-28 0.9780023176799034 601698.SH
58 2023-03-29 0.7581739222176508 002558.SZ
59 2023-03-30 1.2088597249444364 002425.SZ
60 2023-03-31 1.0383208709472522 000938.SZ
61 2023-04-03 0.7742369597473725 001872.SZ
62 2023-04-04 0.8024470755073208 002858.SZ
63 2023-04-06 0.7607284837753079 002261.SZ
64 2023-04-07 0.9927088245634893 002261.SZ
65 2023-04-10 0.8693657271995023 603019.SH
66 2023-04-11 1.3756495540495381 600228.SH
67 2023-04-12 0.6041603413288005 002222.SZ
68 2023-04-13 0.7744980911161148 002777.SZ
69 2023-04-14 0.8672190988257731 600633.SH
70 2023-04-17 1.4449313652608706 603083.SH
71 2023-04-18 0.6773096694945689 002517.SZ
72 2023-04-19 2.078581022345213 002908.SZ
73 2023-04-20 0.9806780152085147 600203.SH
74 2023-04-21 0.8344159521107176 000686.SZ
75 2023-04-24 1.210049105329498 600749.SH
76 2023-04-25 1.4048193576090038 603699.SH
77 2023-04-26 1.4845584717530398 600750.SH
78 2023-04-27 1.7290167418990006 002351.SZ
79 2023-04-28 0.6169128309035838 002343.SZ
80 2023-05-04 0.406077908055111 603019.SH
81 2023-05-05 0.9080152593104391 603258.SH
82 2023-05-08 0.796876165601434 603083.SH
83 2023-05-09 0.9700970682165659 002291.SZ
84 2023-05-10 1.3258832446428042 002291.SZ
85 2023-05-11 0.8900850443360986 600750.SH
86 2023-05-12 1.0650432251092237 601318.SH
87 2023-05-15 0.6787099027648815 002760.SZ
88 2023-05-16 0.722076527194143 603357.SH
89 2023-05-17 1.053645140729648 603357.SH
90 2023-05-18 0.6034913204660662 601518.SH
91 2023-05-19 0.5868824391890941 000600.SZ
92 2023-05-22 0.7653788907870708 002315.SZ
93 2023-05-23 0.8498831870683509 003021.SZ
94 2023-05-24 0.8222394685174235 600337.SH
95 2023-05-25 0.9415393784400905 600587.SH
96 2023-05-26 0.520220425480583 000600.SZ
97 2023-05-29 0.6595697603731597 002334.SZ
98 2023-05-30 0.606477318736669 603790.SH
99 2023-05-31 0.694237121673502 603662.SH
100 2023-06-01 0.5921959927449983 603196.SH
101 2023-06-02 0.6895081721399422 603019.SH
102 2023-06-05 0.5566382152721012 001309.SZ
103 2023-06-06 1.892873809852157 002587.SZ
104 2023-06-07 0.7678242983656595 605011.SH
105 2023-06-08 1.0539866095101476 000938.SZ
106 2023-06-09 0.8147649527362582 002292.SZ
107 2023-06-12 0.7188933998461803 002173.SZ
108 2023-06-13 0.681977313547429 603097.SH
109 2023-06-14 0.8733642333159071 002865.SZ
110 2023-06-15 0.8968643954524321 603108.SH
111 2023-06-16 0.7840028396319321 002897.SZ
112 2023-06-19 0.8775653925608153 603319.SH
113 2023-06-20 1.0844187891842454 002902.SZ
114 2023-06-21 1.2927896026027148 603629.SH
115 2023-06-26 1.2292848291237288 002261.SZ
116 2023-06-27 1.3781866321602365 000938.SZ
117 2023-06-28 0.8540277846763247 601138.SH
118 2023-06-29 0.8523211757782663 603779.SH
119 2023-06-30 1.1754329601349267 601127.SH
120 2023-07-03 1.2249906293712542 603015.SH
121 2023-07-04 1.1084820336750372 000936.SZ
122 2023-07-05 1.2710980206868936 000936.SZ
123 2023-07-06 0.747949676257483 603728.SH
124 2023-07-07 0.9061602512086774 002835.SZ
125 2023-07-10 0.9551342600022579 002126.SZ
126 2023-07-11 0.966971776030953 603767.SH
127 2023-07-12 0.9443518376543841 601886.SH
128 2023-07-13 0.6769606633633086 603085.SH
129 2023-07-14 0.918333951173531 002036.SZ
130 2023-07-17 0.6569232106980998 603045.SH
131 2023-07-18 0.7121594789903711 002409.SZ
132 2023-07-19 0.7294037039105077 002548.SZ
133 2023-07-20 0.7381883846308512 002703.SZ
134 2023-07-21 0.7652204062690017 002997.SZ
135 2023-07-24 0.9003480376547147 000550.SZ
136 2023-07-25 0.6357345607310146 605020.SH
137 2023-07-26 0.5810885924302148 605020.SH
138 2023-07-27 0.8761890730266239 002316.SZ
139 2023-07-28 0.9028509127260252 000716.SZ
140 2023-07-31 0.4708956316796065 601777.SH
141 2023-08-01 0.5561891737811866 600763.SH
142 2023-08-02 0.8760196470112966 002719.SZ
143 2023-08-03 0.7648464404493108 002400.SZ
144 2023-08-04 0.7791782042380738 601799.SH
145 2023-08-07 0.8061135186567487 000797.SZ
146 2023-08-08 1.1666879365515435 600322.SH
147 2023-08-09 1.4355955291322207 000006.SZ
148 2023-08-10 1.2886157376213954 000656.SZ
149 2023-08-11 1.3479230675318692 002941.SZ
150 2023-08-14 1.0490220109983646 601377.SH
151 2023-08-15 1.0632174359473308 600376.SH
152 2023-08-16 1.050421116938835 002126.SZ
153 2023-08-17 0.6717173215978612 000948.SZ
154 2023-08-18 0.9668301556287141 002907.SZ
155 2023-08-21 1.1746853792925736 003005.SZ
156 2023-08-22 0.9584954141170795 600838.SH
157 2023-08-23 1.2457408517312187 001234.SZ
158 2023-08-24 1.0823923917882998 002999.SZ
159 2023-08-25 0.9378153059525566 603918.SH
160 2023-08-28 1.2421433405918902 603767.SH
161 2023-08-29 0.616127073238452 002696.SZ
162 2023-08-30 0.9031479500764501 000010.SZ
163 2023-08-31 0.8845829289455852 000010.SZ
164 2023-09-01 0.6016754849643945 600272.SH
165 2023-09-04 0.7558571185023197 600272.SH
166 2023-09-05 0.4028980705656072 000678.SZ
167 2023-09-06 0.659374499556469 603080.SH
168 2023-09-07 0.6245495405404559 000609.SZ
169 2023-09-08 0.6710722697700532 603919.SH
170 2023-09-11 0.6278048802992457 600546.SH
171 2023-09-12 0.8256329238016435 600546.SH
172 2023-09-13 0.9974851537103986 601127.SH
173 2023-09-14 1.2529240943908486 603005.SH
174 2023-09-15 0.6551278623697204 603306.SH
175 2023-09-18 0.62491397271537 000851.SZ
176 2023-09-19 0.9590430560641906 600293.SH
177 2023-09-20 0.9192992329949209 600895.SH
178 2023-09-21 1.303323539412371 603667.SH
179 2023-09-22 0.6392556165728372 002406.SZ
180 2023-09-25 0.550363061204975 603933.SH
181 2023-09-26 0.8885810012289143 000766.SZ
182 2023-09-27 1.3119504188158804 605588.SH
183 2023-09-28 0.6383963467007131 002885.SZ
184 2023-10-09 0.5559833174181884 603277.SH
185 2023-10-10 0.6746335129218759 002855.SZ
186 2023-10-11 0.48076279797688554 001319.SZ
187 2023-10-12 0.4648032423789084 002953.SZ
188 2023-10-13 0.7973569102606312 605588.SH
189 2023-10-16 0.6753500013003589 603929.SH
190 2023-10-17 0.939032197442827 002786.SZ
191 2023-10-18 1.3316765134484991 603005.SH
192 2023-10-19 1.5107094655109568 002728.SZ
193 2023-10-20 1.8033472200834302 603890.SH
194 2023-10-23 2.0156758075487904 000526.SZ
195 2023-10-24 1.733095955568728 600186.SH
196 2023-10-25 1.0763644734039597 002456.SZ
197 2023-10-26 0.6254989123134431 600155.SH
198 2023-10-27 0.9189894086467906 000712.SZ
199 2023-10-30 0.82608918468284 600839.SH
200 2023-10-31 0.7212314254570089 001319.SZ
201 2023-11-01 0.7217175319235539 002657.SZ
202 2023-11-02 0.7778599932153227 002456.SZ
203 2023-11-03 1.3422820103526423 603985.SH
204 2023-11-06 0.5239681122691597 600595.SH
205 2023-11-07 0.5067988914432168 000520.SZ
206 2023-11-08 0.8068628626883659 603009.SH
207 2023-11-09 0.795444145270753 601127.SH
208 2023-11-10 0.7853290033363176 600630.SH
209 2023-11-13 0.6675304106579922 601595.SH
210 2023-11-14 0.2361369659661822 000828.SZ
211 2023-11-15 1.3945937102768664 603598.SH
212 2023-11-16 0.9576360953800751 000628.SZ
213 2023-11-17 0.6890730621251102 603108.SH
214 2023-11-20 0.7909511281469108 000628.SZ
215 2023-11-21 0.8142228770378246 000925.SZ
216 2023-11-22 0.797507102177366 000550.SZ
217 2023-11-23 0.7063630358338048 000676.SZ
218 2023-11-24 1.036008941153352 002181.SZ
219 2023-11-27 1.0291531391754778 000503.SZ
220 2023-11-28 0.9076486100273481 600775.SH
221 2023-11-29 0.7882491062137358 000669.SZ
222 2023-11-30 1.0967518981113826 000669.SZ
223 2023-12-01 0.7311870736612255 000625.SZ
224 2023-12-04 1.0691371238894785 603286.SH
225 2023-12-05 1.3131270390024472 605188.SH
226 2023-12-06 0.7752257820655966 000628.SZ
227 2023-12-07 0.8197027217611897 600107.SH
228 2023-12-08 1.3967047074635028 603488.SH
229 2023-12-11 0.687045285463665 002277.SZ
230 2023-12-12 0.665884682887716 600593.SH
231 2023-12-13 0.654047737248992 600476.SH
232 2023-12-14 1.0532572750390772 603106.SH
233 2023-12-15 1.0658083351666034 603358.SH
234 2023-12-18 0.962400311858336 000766.SZ
235 2023-12-19 0.7287547482546808 603103.SH
236 2023-12-20 1.2148728495986132 002647.SZ
237 2023-12-21 0.7541763251442525 002858.SZ
238 2023-12-22 0.8726322448001688 600178.SH
239 2023-12-25 0.8241484608574933 605011.SH
240 2023-12-26 0.9109440061301425 603992.SH
241 2023-12-27 0.8418823218408088 002660.SZ
242 2023-12-28 0.6918104133614209 002238.SZ
243 2023-12-29 0.587505902687491 002495.SZ
244 2024-01-02 0.9211111544777676 002587.SZ
245 2024-01-03 0.7226235020970133 000691.SZ
246 2024-01-04 0.9569550769001772 002962.SZ
247 2024-01-05 1.1926365483735857 605117.SH
248 2024-01-08 1.2688927804343633 603032.SH
249 2024-01-09 0.658120719671456 002862.SZ
250 2024-01-10 1.0753659753822198 000698.SZ
251 2024-01-11 0.8894494773121738 603097.SH
252 2024-01-12 0.9087175987157813 600593.SH
253 2024-01-15 0.5892323752732013 603212.SH
254 2024-01-16 0.7839193778147607 000698.SZ
255 2024-01-17 1.0625258983405035 603172.SH
256 2024-01-18 1.2631347573071583 002033.SZ
257 2024-01-19 1.178331671274573 603579.SH
258 2024-01-22 1.6352965224693876 605268.SH
259 2024-01-23 1.4266068895392103 605117.SH
260 2024-01-24 0.8002314972730927 600138.SH
261 2024-01-25 0.6269522471780932 603099.SH
262 2024-01-26 1.1309900405971738 605111.SH
263 2024-01-29 1.125066361142788 002253.SZ
264 2024-01-30 1.351423375727843 003007.SZ
265 2024-01-31 1.5739771441257069 601138.SH
266 2024-02-01 1.499054147286471 002033.SZ
267 2024-02-02 1.5167645269468597 601038.SH
268 2024-02-05 1.903436398968963 000998.SZ
269 2024-02-06 0.8212170920332696 600705.SH
270 2024-02-07 0.8351364611756162 603199.SH
271 2024-02-08 0.6822013314565247 601998.SH
272 2024-02-19 0.5444839345994206 000999.SZ
273 2024-02-20 0.5734873097155654 603369.SH
274 2024-02-21 0.43260992475178217 600023.SH
275 2024-02-22 0.4837658423417254 000526.SZ
276 2024-02-23 0.25932845682914313 000157.SZ
277 2024-02-26 0.37391625217883473 000983.SZ
278 2024-02-27 0.06249364085384111 002039.SZ
279 2024-02-28 1.038623993098607 000680.SZ
280 2024-02-29 0.11792404338777529 603871.SH
281 2024-03-01 0.30810066963043975 603605.SH
282 2024-03-04 0.17622933681947947 600375.SH
283 2024-03-05 1.0199617166369774 002009.SZ
284 2024-03-06 0.7025950679251926 002209.SZ
285 2024-03-07 0.8130361341508562 002317.SZ
286 2024-03-08 0.6714948117029352 603960.SH
287 2024-03-11 0.7527103580484402 603960.SH
288 2024-03-12 0.773794092704635 603960.SH
289 2024-03-13 0.6395980350337678 603499.SH
290 2024-03-14 0.6983134888804106 603660.SH
291 2024-03-15 0.990357376475744 601138.SH
292 2024-03-18 0.4182273803259301 002075.SZ
293 2024-03-19 0.8116021296004745 603050.SH
294 2024-03-20 0.6916582321872963 605580.SH
295 2024-03-21 0.7126108686308776 002698.SZ
296 2024-03-22 0.795964501966808 603190.SH
297 2024-03-25 1.0652068531193497 603286.SH
298 2024-03-26 1.2060727717193194 002331.SZ
299 2024-03-27 1.8308956146424886 001696.SZ
300 2024-03-28 1.5762953683649072 002645.SZ
301 2024-03-29 0.8133804882766478 002055.SZ
302 2024-04-01 0.6881987381521469 002735.SZ
303 2024-04-02 0.9728619403924941 002085.SZ
304 2024-04-03 0.9735850429701983 002625.SZ
305 2024-04-08 0.9464502611855133 002805.SZ
306 2024-04-09 1.10422053943107 002085.SZ
307 2024-04-10 0.699553803327553 603822.SH
308 2024-04-11 1.2813227488155954 002544.SZ
309 2024-04-12 0.9677010248477915 605198.SH
310 2024-04-15 1.2722648770139777 002290.SZ
311 2024-04-16 2.1135975645782725 002521.SZ
312 2024-04-17 1.0448007042761251 000737.SZ
313 2024-04-18 1.3682438721410928 603619.SH
314 2024-04-19 0.6510347025537216 000933.SZ
315 2024-04-22 1.1007294592332375 600529.SH
316 2024-04-23 1.0096847778899667 002078.SZ
317 2024-04-24 0.5132039397179469 000949.SZ
318 2024-04-25 1.7289140437217827 600066.SH
319 2024-04-26 1.048178737250126 603556.SH
320 2024-04-29 0.28151131629200876 000949.SZ
321 2024-04-30 0.5902959535550075 605098.SH
322 2024-05-06 0.8659440618533316 001696.SZ
323 2024-05-07 0.4125483888931327 002225.SZ
324 2024-05-08 0.49991019731911135 002597.SZ
325 2024-05-09 0.8523675809088074 002590.SZ
326 2024-05-10 0.6072304373378594 001696.SZ
327 2024-05-13 0.9449133844307348 600326.SH
328 2024-05-14 0.756524501371889 002025.SZ
329 2024-05-15 0.7974348512463216 600682.SH
330 2024-05-16 0.9752446361705888 600644.SH
331 2024-05-17 1.1846986232709233 000702.SZ
332 2024-05-20 0.7167728676668204 002851.SZ
333 2024-05-21 1.071890852713521 603683.SH
334 2024-05-22 0.7124540930368298 600463.SH
335 2024-05-23 1.5016154741945653 002225.SZ
336 2024-05-24 1.2198831133459211 002968.SZ
337 2024-05-27 0.9536299254414154 000656.SZ
338 2024-05-28 0.8425457543469408 002761.SZ
339 2024-05-29 0.652762060180136 600979.SH
340 2024-05-30 0.9000889953940735 002455.SZ
341 2024-05-31 0.9330771253458983 601825.SH
342 2024-06-03 1.2914669574335471 001267.SZ
343 2024-06-04 0.829699499403838 600530.SH
344 2024-06-05 1.0758350766018299 002922.SZ
345 2024-06-06 0.8595311066455215 603360.SH
346 2024-06-07 1.0888503051113 002889.SZ
347 2024-06-11 1.0628038633716435 002475.SZ
348 2024-06-12 1.1159013979424315 603009.SH
349 2024-06-13 1.1812561799680747 600996.SH
350 2024-06-14 0.8256170648299659 600039.SH
351 2024-06-17 0.8645410455127762 000528.SZ
352 2024-06-18 0.6063406599939511 600996.SH
353 2024-06-19 0.7166446473651414 600192.SH
354 2024-06-20 0.932110291603618 605598.SH
355 2024-06-21 0.9558209107020993 603936.SH
356 2024-06-24 1.119014534304907 600992.SH
357 2024-06-25 1.3527294398026957 600584.SH
358 2024-06-26 0.7188166389093542 000504.SZ
359 2024-06-27 1.9515093336713365 002452.SZ
360 2024-06-28 0.8843544096493936 600889.SH
361 2024-07-01 0.6545882280229176 003004.SZ
362 2024-07-02 0.6762487770835988 600584.SH
363 2024-07-03 0.9128444390874889 601179.SH
364 2024-07-04 1.1423863246899275 603225.SH
365 2024-07-05 0.9324658736527716 603936.SH
366 2024-07-08 1.780537827812583 603328.SH
367 2024-07-09 0.7579237257512456 000679.SZ
368 2024-07-10 0.6704021737995826 605117.SH
369 2024-07-11 0.6117132499929072 000622.SZ
370 2024-07-12 1.0566477568456074 002452.SZ
371 2024-07-15 0.6602660923500289 605081.SH
372 2024-07-16 0.5502090318853736 002420.SZ
373 2024-07-17 0.6837622842594867 002355.SZ
374 2024-07-18 0.8242173773899442 002384.SZ
375 2024-07-19 0.9979238076969816 002384.SZ
376 2024-07-22 0.4982073979858695 000421.SZ
377 2024-07-23 1.1543952284060066 002428.SZ
378 2024-07-24 1.2334918071766405 605111.SH
379 2024-07-25 0.8987252044027945 002496.SZ
380 2024-07-26 0.8562640506752258 600171.SH
381 2024-07-29 0.5774106541432314 002750.SZ
382 2024-07-30 0.5406184547635255 600563.SH
383 2024-07-31 0.5575394015591096 002700.SZ
384 2024-08-01 0.3836358457058139 600099.SH
385 2024-08-02 0.670543769867587 605081.SH
386 2024-08-05 1.2561423052432321 605117.SH
387 2024-08-06 0.9373802633817199 000584.SZ
388 2024-08-07 0.8074459777954732 603032.SH
389 2024-08-08 0.8017404350976902 600611.SH
390 2024-08-09 0.9444750578832374 000659.SZ
391 2024-08-12 0.8308531709022774 000880.SZ
392 2024-08-13 0.6345130236563948 600266.SH
393 2024-08-14 0.7618996741024034 000159.SZ
394 2024-08-15 0.7957196976564392 000880.SZ
395 2024-08-16 0.8007104277247147 603050.SH
396 2024-08-19 0.8488617680848443 603444.SH
397 2024-08-20 1.049247341754445 002488.SZ
398 2024-08-21 1.2543709456137933 002488.SZ
399 2024-08-22 1.0702026523317902 002208.SZ
400 2024-08-23 1.0790725273037058 002369.SZ
401 2024-08-26 0.8933596937509765 000532.SZ
402 2024-08-27 0.9555026539273229 605318.SH
403 2024-08-28 0.8517730333686951 002547.SZ
404 2024-08-29 0.8787028549560587 003001.SZ
405 2024-08-30 0.5949301031458588 601898.SH
406 2024-09-02 1.0927036539101782 603826.SH
407 2024-09-03 0.5011518255679451 000810.SZ
408 2024-09-04 0.913670019713004 001298.SZ
409 2024-09-05 0.5722903163709645 600375.SH
410 2024-09-06 1.054280211341685 002622.SZ
411 2024-09-09 1.1145869455283224 600375.SH
412 2024-09-10 0.6071645644461853 600804.SH
413 2024-09-11 0.8120257237744295 002808.SZ
414 2024-09-12 0.7226510652354332 600148.SH
415 2024-09-13 1.4358476935516946 603615.SH
416 2024-09-18 0.8351081061832145 002946.SZ
417 2024-09-19 0.605865384829211 600898.SH
418 2024-09-20 0.9533885243905273 603398.SH
419 2024-09-23 1.046054385469168 601162.SH
420 2024-09-24 0.3758184358111333 603559.SH
421 2024-09-25 0.8156363720747627 600756.SH
422 2024-09-26 0.5051488053045387 600550.SH
423 2024-09-27 0.16901120016969293 002016.SZ
424 2024-09-30 0.03361915273177237 603106.SH
425 2024-10-08 0.02829952163781644 603106.SH
426 2024-10-09 0.15132702693149014 601336.SH
427 2024-10-10 0.5264407322666304 000402.SZ
428 2024-10-11 1.0343311919140215 600657.SH
429 2024-10-14 0.47180187869811324 603383.SH
430 2024-10-15 0.8703255693900985 603106.SH
431 2024-10-16 0.8602575981884926 002987.SZ
432 2024-10-17 0.8415090474760394 000567.SZ
433 2024-10-18 0.15292428350076237 002542.SZ
434 2024-10-21 0.4922089945140812 002457.SZ
435 2024-10-22 0.4176771447393169 002423.SZ
436 2024-10-23 0.8519606263347589 000158.SZ
437 2024-10-24 0.5430046541942165 000935.SZ
438 2024-10-25 0.18041199007445233 603016.SH
439 2024-10-28 0.5571845419116188 000503.SZ
440 2024-10-29 0.4049481417593221 002851.SZ
441 2024-10-30 0.7134818524722009 600463.SH
442 2024-10-31 0.5829203522209173 603117.SH
443 2024-11-01 1.2246655429458404 002851.SZ
444 2024-11-04 0.8176452500049061 600843.SH
445 2024-11-05 0.896531400955133 002514.SZ
446 2024-11-06 0.8080466337179094 600292.SH
447 2024-11-07 0.8536978345761432 600481.SH
448 2024-11-08 0.735404763610977 002047.SZ
449 2024-11-11 0.7749352489908305 002428.SZ
450 2024-11-12 0.8967548353595826 002428.SZ
451 2024-11-13 1.0199850479686239 603859.SH
452 2024-11-14 0.9361081815051415 603559.SH
453 2024-11-15 1.5997213068383358 002086.SZ
454 2024-11-18 1.5789594007558525 002709.SZ
455 2024-11-19 1.5249787983366927 603825.SH
456 2024-11-20 0.736292965730012 002808.SZ
457 2024-11-21 0.7544341372210354 603859.SH
458 2024-11-22 1.2744170240551567 600593.SH
459 2024-11-25 0.8324187454861728 600787.SH
460 2024-11-26 1.0752006153991913 600736.SH
461 2024-11-27 0.6500606694243171 002245.SZ
462 2024-11-28 0.8456761058883665 000833.SZ
463 2024-11-29 0.8489157795122361 002354.SZ
464 2024-12-02 0.6832024025795977 002611.SZ
465 2024-12-03 0.8939114413301544 603366.SH
466 2024-12-04 1.0277665925094743 002822.SZ
467 2024-12-05 0.9103466279163851 002175.SZ
468 2024-12-06 0.7686238693084577 002467.SZ
469 2024-12-09 1.0846053237578963 601933.SH
470 2024-12-10 1.0700371757624498 600193.SH
471 2024-12-11 0.7673727634361369 002520.SZ
472 2024-12-12 0.8497906144901559 002362.SZ
473 2024-12-13 1.254346634364545 603429.SH
474 2024-12-16 1.0386293779387827 000727.SZ
475 2024-12-17 1.2458109349303497 600157.SH
476 2024-12-18 1.3409657396440136 003002.SZ
477 2024-12-19 1.1408332938187322 600593.SH
478 2024-12-20 0.8248161307709121 002512.SZ
479 2024-12-23 1.1576027817247634 002336.SZ
480 2024-12-24 0.8652560164174093 603610.SH
481 2024-12-25 0.8928903216570524 002045.SZ
482 2024-12-26 0.7436802683703838 603214.SH
483 2024-12-27 0.8278524197563604 002945.SZ
484 2024-12-30 0.6846259683364331 600223.SH
485 2024-12-31 1.0514482797503029 001309.SZ
486 2025-01-02 1.4104671874229635 603668.SH

265
code/train/predictions.tsv Normal file
View File

@@ -0,0 +1,265 @@
trade_date,score,ts_code
2024-01-02,0.8906433047229376,002587.SZ
2024-01-03,0.800255773815545,000691.SZ
2024-01-04,0.918203870395468,002962.SZ
2024-01-05,1.1734063865615825,605117.SH
2024-01-08,1.2784720379037475,600761.SH
2024-01-09,0.5936470874291284,002862.SZ
2024-01-10,0.9080905815108482,000698.SZ
2024-01-11,0.827458720223193,603097.SH
2024-01-12,0.994883205877543,600593.SH
2024-01-15,0.6804254263110727,603212.SH
2024-01-16,0.7194593431343859,000698.SZ
2024-01-17,1.0860069907228742,603172.SH
2024-01-18,1.3749235527137786,603828.SH
2024-01-19,1.2391308950507334,603579.SH
2024-01-22,1.7603168299560354,605268.SH
2024-01-23,1.5656552549163458,605117.SH
2024-01-24,0.7379915949457881,600138.SH
2024-01-25,0.7346719736914655,603099.SH
2024-01-26,1.0310897640701377,605111.SH
2024-01-29,1.1768938262108766,603398.SH
2024-01-30,1.235487562255028,003007.SZ
2024-01-31,1.5371910050217372,601138.SH
2024-02-01,1.3629464247750829,600551.SH
2024-02-02,1.52270944692793,601038.SH
2024-02-05,1.847344110860692,000550.SZ
2024-02-06,0.8127749986671006,600705.SH
2024-02-07,0.7565034143929377,603199.SH
2024-02-08,0.7247153170440155,600188.SH
2024-02-19,0.41560847492124364,002032.SZ
2024-02-20,0.5419618315007714,603369.SH
2024-02-21,0.44193316268825533,600023.SH
2024-02-22,0.45382033625301066,000526.SZ
2024-02-23,0.25689917770287357,000157.SZ
2024-02-26,0.4253231714991775,000983.SZ
2024-02-27,0.03172161439110529,605151.SH
2024-02-28,1.074800376390378,000680.SZ
2024-02-29,0.11241663388214615,002467.SZ
2024-03-01,0.317478967758629,603605.SH
2024-03-04,0.17878811429242739,600860.SH
2024-03-05,1.0151694508153393,002009.SZ
2024-03-06,0.8229010452846762,002209.SZ
2024-03-07,0.8017175629386889,600584.SH
2024-03-08,0.6810433978551881,603960.SH
2024-03-11,0.9532104338812376,603960.SH
2024-03-12,0.7055297835013503,603960.SH
2024-03-13,0.5920124881579221,603499.SH
2024-03-14,0.661232064922907,603660.SH
2024-03-15,0.8778620305552904,601138.SH
2024-03-18,0.42042942845890563,002075.SZ
2024-03-19,0.7527868193603998,603050.SH
2024-03-20,0.5531908723666995,605580.SH
2024-03-21,0.7900117288163369,002698.SZ
2024-03-22,0.8285381778407641,603190.SH
2024-03-25,1.0749381159867608,603286.SH
2024-03-26,1.2654734266422276,002331.SZ
2024-03-27,1.8684480159293833,001696.SZ
2024-03-28,1.6075301389782366,002645.SZ
2024-03-29,0.8465441903404123,002055.SZ
2024-04-01,0.7568317810951942,002735.SZ
2024-04-02,1.0341346018053856,002085.SZ
2024-04-03,1.0122022102013215,002130.SZ
2024-04-08,0.8881305473937254,002805.SZ
2024-04-09,1.0559556356983075,002085.SZ
2024-04-10,0.6554344664442165,603822.SH
2024-04-11,1.2760784980841757,002544.SZ
2024-04-12,1.0181838249663664,605198.SH
2024-04-15,1.221720496054648,002290.SZ
2024-04-16,2.0663546208214703,002521.SZ
2024-04-17,1.1065962300439527,000737.SZ
2024-04-18,1.34853784445544,603619.SH
2024-04-19,0.6639505828915956,000933.SZ
2024-04-22,1.1652613644520093,600529.SH
2024-04-23,1.0507483721309534,002078.SZ
2024-04-24,0.7225763953314781,000949.SZ
2024-04-25,1.9430192587586146,600066.SH
2024-04-26,1.0817360300030114,603556.SH
2024-04-29,0.21577435079395113,600480.SH
2024-04-30,0.5290265764148879,605098.SH
2024-05-06,0.7885258258967485,001696.SZ
2024-05-07,0.415812996822765,002225.SZ
2024-05-08,0.5596574674012184,603232.SH
2024-05-09,0.8548632655231382,002590.SZ
2024-05-10,0.5787850519196119,001696.SZ
2024-05-13,0.9751906596140552,000952.SZ
2024-05-14,0.7644462578838344,600645.SH
2024-05-15,0.8589488842170756,600682.SH
2024-05-16,1.049953727857974,600644.SH
2024-05-17,1.1220964730505885,000702.SZ
2024-05-20,0.8027292772970297,002851.SZ
2024-05-21,1.1153910838352858,603683.SH
2024-05-22,0.6413250933571519,002922.SZ
2024-05-23,1.570388967019694,002225.SZ
2024-05-24,1.2444795042063028,002968.SZ
2024-05-27,0.9627736773164858,600675.SH
2024-05-28,0.9448048863120843,002761.SZ
2024-05-29,0.6810520099963742,600979.SH
2024-05-30,0.842272857355848,600530.SH
2024-05-31,1.0001129400930693,600101.SH
2024-06-03,1.3637566909343166,001267.SZ
2024-06-04,0.9588694721783405,600530.SH
2024-06-05,1.0953534292665954,002922.SZ
2024-06-06,0.8110235687535462,603360.SH
2024-06-07,1.2134023901747366,002889.SZ
2024-06-11,1.0772961141495465,002655.SZ
2024-06-12,1.1183914831029496,603009.SH
2024-06-13,1.0362186103086477,600996.SH
2024-06-14,0.7480333968482387,600039.SH
2024-06-17,1.0007287301926653,000528.SZ
2024-06-18,0.5381156056733658,600996.SH
2024-06-19,0.7036814608094294,600830.SH
2024-06-20,0.8499910179916197,605598.SH
2024-06-21,1.2150720829980681,603936.SH
2024-06-24,1.0311244474924908,600992.SH
2024-06-25,1.2484419002632245,600584.SH
2024-06-26,0.7320854040096385,000819.SZ
2024-06-27,1.9029808384109885,002452.SZ
2024-06-28,0.8803270724492669,600889.SH
2024-07-01,0.6059109111833119,000622.SZ
2024-07-02,0.656778781716391,600584.SH
2024-07-03,0.8605418473204086,601179.SH
2024-07-04,1.073683249192727,603225.SH
2024-07-05,0.8800051248743536,603936.SH
2024-07-08,1.8061114289786495,603328.SH
2024-07-09,0.5826571385994789,000679.SZ
2024-07-10,0.8413277231762297,605117.SH
2024-07-11,0.6665748975268276,000622.SZ
2024-07-12,1.0278922272860618,002452.SZ
2024-07-15,0.6403011305936952,605081.SH
2024-07-16,0.592445020815451,002420.SZ
2024-07-17,0.5442518053370551,002355.SZ
2024-07-18,0.8022024783282671,002384.SZ
2024-07-19,0.9433013682690108,002384.SZ
2024-07-22,0.6240394772580439,000421.SZ
2024-07-23,1.237721650844904,002428.SZ
2024-07-24,1.186379759584258,605111.SH
2024-07-25,0.8926351872925693,002496.SZ
2024-07-26,0.8499067690354271,600171.SH
2024-07-29,0.7013969819645556,002750.SZ
2024-07-30,0.615258963090716,600563.SH
2024-07-31,0.5799237504937365,002700.SZ
2024-08-01,0.5070284832062075,600834.SH
2024-08-02,0.6485822834772664,600604.SH
2024-08-05,1.3222325162798954,605117.SH
2024-08-06,0.9935887583155018,000584.SZ
2024-08-07,0.7440148514526516,603032.SH
2024-08-08,0.8934326068252262,600611.SH
2024-08-09,0.9907610203863012,000659.SZ
2024-08-12,0.7143811940598249,000880.SZ
2024-08-13,0.5948683342786406,600266.SH
2024-08-14,0.7780755309120447,000159.SZ
2024-08-15,0.8738359592762805,000880.SZ
2024-08-16,0.7460601727356423,603050.SH
2024-08-19,0.8904872743308099,603444.SH
2024-08-20,1.077089845741329,002488.SZ
2024-08-21,1.330096420372438,002488.SZ
2024-08-22,1.04117609681098,002208.SZ
2024-08-23,1.2634267858516914,002369.SZ
2024-08-26,0.8745811905917017,000532.SZ
2024-08-27,0.836754154047108,002760.SZ
2024-08-28,0.7231326607988842,002547.SZ
2024-08-29,0.8735120215139563,003001.SZ
2024-08-30,0.6615140980616735,601898.SH
2024-09-02,1.093224090711538,603826.SH
2024-09-03,0.41407989346203866,002309.SZ
2024-09-04,0.7919233491318468,001298.SZ
2024-09-05,0.6449753890047838,000908.SZ
2024-09-06,1.17109797325565,002622.SZ
2024-09-09,1.2278175192855338,000999.SZ
2024-09-10,0.7463596223821397,600804.SH
2024-09-11,0.7470176349514708,002808.SZ
2024-09-12,0.7243651180373872,603559.SH
2024-09-13,1.474732794777432,603615.SH
2024-09-18,0.883126816576788,000659.SZ
2024-09-19,0.640225572474989,600898.SH
2024-09-20,1.051164703847969,603398.SH
2024-09-23,0.9312327237656652,601162.SH
2024-09-24,0.47774549082415085,603559.SH
2024-09-25,0.9563618822865794,600756.SH
2024-09-26,0.5275946326737218,002686.SZ
2024-09-27,0.18984202360702415,002016.SZ
2024-09-30,0.035786009050673036,603106.SH
2024-10-08,0.032889649456072596,603106.SH
2024-10-09,0.12465071252054723,601336.SH
2024-10-10,0.6969210259884471,000402.SZ
2024-10-11,1.0531806211526256,600099.SH
2024-10-14,0.46171010596010975,601162.SH
2024-10-15,1.050584350922452,000402.SZ
2024-10-16,0.9133292498947153,002987.SZ
2024-10-17,0.7700882254413255,000567.SZ
2024-10-18,0.1201641254984537,600895.SH
2024-10-21,0.6976186419462845,002457.SZ
2024-10-22,0.29432613116032685,002423.SZ
2024-10-23,0.7806425787966057,000158.SZ
2024-10-24,0.6036172569478745,002199.SZ
2024-10-25,0.12282827583399647,603016.SH
2024-10-28,0.5245178749249334,000503.SZ
2024-10-29,0.5076972792469883,002851.SZ
2024-10-30,0.7895092176015108,600463.SH
2024-10-31,0.6192784720087864,603117.SH
2024-11-01,1.204091078793982,002134.SZ
2024-11-04,0.8093625376363384,002570.SZ
2024-11-05,0.8638488115176264,600172.SH
2024-11-06,0.8186577511607894,600292.SH
2024-11-07,0.8635644200307799,600481.SH
2024-11-08,0.747868586080844,002047.SZ
2024-11-11,0.8396084711761063,002428.SZ
2024-11-12,0.7919805059954543,603859.SH
2024-11-13,0.9060991217118458,603859.SH
2024-11-14,0.9421847563274262,600966.SH
2024-11-15,1.5178035825387006,002086.SZ
2024-11-18,1.5376931721833804,600212.SH
2024-11-19,1.4060097628439219,603825.SH
2024-11-20,0.8890834002457785,002808.SZ
2024-11-21,0.8855345297456824,603859.SH
2024-11-22,1.119413451276471,600593.SH
2024-11-25,0.7785122491322624,600787.SH
2024-11-26,1.0000210964516405,600736.SH
2024-11-27,0.8847088850937169,002245.SZ
2024-11-28,0.8621169938483969,601360.SH
2024-11-29,0.7042168573520408,002354.SZ
2024-12-02,0.6426744321671465,002611.SZ
2024-12-03,0.9021248369663103,603366.SH
2024-12-04,0.9942733603597254,002822.SZ
2024-12-05,0.8594169937974554,002175.SZ
2024-12-06,0.6985253068214117,603366.SH
2024-12-09,0.9476416369172441,601933.SH
2024-12-10,1.053999067291189,600193.SH
2024-12-11,0.6996323878339654,002193.SZ
2024-12-12,0.9535599508119768,002362.SZ
2024-12-13,1.3279717542253164,603429.SH
2024-12-16,1.0260681164941636,000727.SZ
2024-12-17,1.3063049942413876,600157.SH
2024-12-18,1.3121814535335503,002878.SZ
2024-12-19,1.219098477203033,600593.SH
2024-12-20,0.8480675770196239,002512.SZ
2024-12-23,1.1806404660060321,600724.SH
2024-12-24,0.8537658533885591,603610.SH
2024-12-25,0.8752079792242901,002965.SZ
2024-12-26,0.720498836899636,603214.SH
2024-12-27,0.8552518755027023,002945.SZ
2024-12-30,0.7853260336927593,600223.SH
2024-12-31,1.0774196590782728,600183.SH
2025-01-02,1.345874429894366,603225.SH
2025-01-03,1.4595000226870254,603379.SH
2025-01-06,1.8567194520891437,002130.SZ
2025-01-07,1.327995034218316,002881.SZ
2025-01-08,0.7854520495476546,600126.SH
2025-01-09,0.8656051617404842,000756.SZ
2025-01-10,1.1141535494224937,605016.SH
2025-01-13,2.0375745364278695,605080.SH
2025-01-14,0.6228152667370752,603269.SH
2025-01-15,0.7099046974063614,600673.SH
2025-01-16,0.7230959774435842,600381.SH
2025-01-17,0.8735560458074921,603007.SH
2025-01-20,0.6265446536616674,002164.SZ
2025-01-21,1.4687297319348953,000534.SZ
2025-01-22,0.7347201431708319,000408.SZ
2025-01-23,0.7698608009850573,603121.SH
2025-01-24,0.6733337270251429,603360.SH
2025-01-27,1.3722279750234074,002484.SZ
2025-02-05,1.0995625926629562,603667.SH
2025-02-06,0.9540560778289151,603308.SH
2025-02-07,0.8152925075270021,000856.SZ
2025-02-10,0.4527649047879118,603166.SH
1 trade_date,score,ts_code
2 2024-01-02,0.8906433047229376,002587.SZ
3 2024-01-03,0.800255773815545,000691.SZ
4 2024-01-04,0.918203870395468,002962.SZ
5 2024-01-05,1.1734063865615825,605117.SH
6 2024-01-08,1.2784720379037475,600761.SH
7 2024-01-09,0.5936470874291284,002862.SZ
8 2024-01-10,0.9080905815108482,000698.SZ
9 2024-01-11,0.827458720223193,603097.SH
10 2024-01-12,0.994883205877543,600593.SH
11 2024-01-15,0.6804254263110727,603212.SH
12 2024-01-16,0.7194593431343859,000698.SZ
13 2024-01-17,1.0860069907228742,603172.SH
14 2024-01-18,1.3749235527137786,603828.SH
15 2024-01-19,1.2391308950507334,603579.SH
16 2024-01-22,1.7603168299560354,605268.SH
17 2024-01-23,1.5656552549163458,605117.SH
18 2024-01-24,0.7379915949457881,600138.SH
19 2024-01-25,0.7346719736914655,603099.SH
20 2024-01-26,1.0310897640701377,605111.SH
21 2024-01-29,1.1768938262108766,603398.SH
22 2024-01-30,1.235487562255028,003007.SZ
23 2024-01-31,1.5371910050217372,601138.SH
24 2024-02-01,1.3629464247750829,600551.SH
25 2024-02-02,1.52270944692793,601038.SH
26 2024-02-05,1.847344110860692,000550.SZ
27 2024-02-06,0.8127749986671006,600705.SH
28 2024-02-07,0.7565034143929377,603199.SH
29 2024-02-08,0.7247153170440155,600188.SH
30 2024-02-19,0.41560847492124364,002032.SZ
31 2024-02-20,0.5419618315007714,603369.SH
32 2024-02-21,0.44193316268825533,600023.SH
33 2024-02-22,0.45382033625301066,000526.SZ
34 2024-02-23,0.25689917770287357,000157.SZ
35 2024-02-26,0.4253231714991775,000983.SZ
36 2024-02-27,0.03172161439110529,605151.SH
37 2024-02-28,1.074800376390378,000680.SZ
38 2024-02-29,0.11241663388214615,002467.SZ
39 2024-03-01,0.317478967758629,603605.SH
40 2024-03-04,0.17878811429242739,600860.SH
41 2024-03-05,1.0151694508153393,002009.SZ
42 2024-03-06,0.8229010452846762,002209.SZ
43 2024-03-07,0.8017175629386889,600584.SH
44 2024-03-08,0.6810433978551881,603960.SH
45 2024-03-11,0.9532104338812376,603960.SH
46 2024-03-12,0.7055297835013503,603960.SH
47 2024-03-13,0.5920124881579221,603499.SH
48 2024-03-14,0.661232064922907,603660.SH
49 2024-03-15,0.8778620305552904,601138.SH
50 2024-03-18,0.42042942845890563,002075.SZ
51 2024-03-19,0.7527868193603998,603050.SH
52 2024-03-20,0.5531908723666995,605580.SH
53 2024-03-21,0.7900117288163369,002698.SZ
54 2024-03-22,0.8285381778407641,603190.SH
55 2024-03-25,1.0749381159867608,603286.SH
56 2024-03-26,1.2654734266422276,002331.SZ
57 2024-03-27,1.8684480159293833,001696.SZ
58 2024-03-28,1.6075301389782366,002645.SZ
59 2024-03-29,0.8465441903404123,002055.SZ
60 2024-04-01,0.7568317810951942,002735.SZ
61 2024-04-02,1.0341346018053856,002085.SZ
62 2024-04-03,1.0122022102013215,002130.SZ
63 2024-04-08,0.8881305473937254,002805.SZ
64 2024-04-09,1.0559556356983075,002085.SZ
65 2024-04-10,0.6554344664442165,603822.SH
66 2024-04-11,1.2760784980841757,002544.SZ
67 2024-04-12,1.0181838249663664,605198.SH
68 2024-04-15,1.221720496054648,002290.SZ
69 2024-04-16,2.0663546208214703,002521.SZ
70 2024-04-17,1.1065962300439527,000737.SZ
71 2024-04-18,1.34853784445544,603619.SH
72 2024-04-19,0.6639505828915956,000933.SZ
73 2024-04-22,1.1652613644520093,600529.SH
74 2024-04-23,1.0507483721309534,002078.SZ
75 2024-04-24,0.7225763953314781,000949.SZ
76 2024-04-25,1.9430192587586146,600066.SH
77 2024-04-26,1.0817360300030114,603556.SH
78 2024-04-29,0.21577435079395113,600480.SH
79 2024-04-30,0.5290265764148879,605098.SH
80 2024-05-06,0.7885258258967485,001696.SZ
81 2024-05-07,0.415812996822765,002225.SZ
82 2024-05-08,0.5596574674012184,603232.SH
83 2024-05-09,0.8548632655231382,002590.SZ
84 2024-05-10,0.5787850519196119,001696.SZ
85 2024-05-13,0.9751906596140552,000952.SZ
86 2024-05-14,0.7644462578838344,600645.SH
87 2024-05-15,0.8589488842170756,600682.SH
88 2024-05-16,1.049953727857974,600644.SH
89 2024-05-17,1.1220964730505885,000702.SZ
90 2024-05-20,0.8027292772970297,002851.SZ
91 2024-05-21,1.1153910838352858,603683.SH
92 2024-05-22,0.6413250933571519,002922.SZ
93 2024-05-23,1.570388967019694,002225.SZ
94 2024-05-24,1.2444795042063028,002968.SZ
95 2024-05-27,0.9627736773164858,600675.SH
96 2024-05-28,0.9448048863120843,002761.SZ
97 2024-05-29,0.6810520099963742,600979.SH
98 2024-05-30,0.842272857355848,600530.SH
99 2024-05-31,1.0001129400930693,600101.SH
100 2024-06-03,1.3637566909343166,001267.SZ
101 2024-06-04,0.9588694721783405,600530.SH
102 2024-06-05,1.0953534292665954,002922.SZ
103 2024-06-06,0.8110235687535462,603360.SH
104 2024-06-07,1.2134023901747366,002889.SZ
105 2024-06-11,1.0772961141495465,002655.SZ
106 2024-06-12,1.1183914831029496,603009.SH
107 2024-06-13,1.0362186103086477,600996.SH
108 2024-06-14,0.7480333968482387,600039.SH
109 2024-06-17,1.0007287301926653,000528.SZ
110 2024-06-18,0.5381156056733658,600996.SH
111 2024-06-19,0.7036814608094294,600830.SH
112 2024-06-20,0.8499910179916197,605598.SH
113 2024-06-21,1.2150720829980681,603936.SH
114 2024-06-24,1.0311244474924908,600992.SH
115 2024-06-25,1.2484419002632245,600584.SH
116 2024-06-26,0.7320854040096385,000819.SZ
117 2024-06-27,1.9029808384109885,002452.SZ
118 2024-06-28,0.8803270724492669,600889.SH
119 2024-07-01,0.6059109111833119,000622.SZ
120 2024-07-02,0.656778781716391,600584.SH
121 2024-07-03,0.8605418473204086,601179.SH
122 2024-07-04,1.073683249192727,603225.SH
123 2024-07-05,0.8800051248743536,603936.SH
124 2024-07-08,1.8061114289786495,603328.SH
125 2024-07-09,0.5826571385994789,000679.SZ
126 2024-07-10,0.8413277231762297,605117.SH
127 2024-07-11,0.6665748975268276,000622.SZ
128 2024-07-12,1.0278922272860618,002452.SZ
129 2024-07-15,0.6403011305936952,605081.SH
130 2024-07-16,0.592445020815451,002420.SZ
131 2024-07-17,0.5442518053370551,002355.SZ
132 2024-07-18,0.8022024783282671,002384.SZ
133 2024-07-19,0.9433013682690108,002384.SZ
134 2024-07-22,0.6240394772580439,000421.SZ
135 2024-07-23,1.237721650844904,002428.SZ
136 2024-07-24,1.186379759584258,605111.SH
137 2024-07-25,0.8926351872925693,002496.SZ
138 2024-07-26,0.8499067690354271,600171.SH
139 2024-07-29,0.7013969819645556,002750.SZ
140 2024-07-30,0.615258963090716,600563.SH
141 2024-07-31,0.5799237504937365,002700.SZ
142 2024-08-01,0.5070284832062075,600834.SH
143 2024-08-02,0.6485822834772664,600604.SH
144 2024-08-05,1.3222325162798954,605117.SH
145 2024-08-06,0.9935887583155018,000584.SZ
146 2024-08-07,0.7440148514526516,603032.SH
147 2024-08-08,0.8934326068252262,600611.SH
148 2024-08-09,0.9907610203863012,000659.SZ
149 2024-08-12,0.7143811940598249,000880.SZ
150 2024-08-13,0.5948683342786406,600266.SH
151 2024-08-14,0.7780755309120447,000159.SZ
152 2024-08-15,0.8738359592762805,000880.SZ
153 2024-08-16,0.7460601727356423,603050.SH
154 2024-08-19,0.8904872743308099,603444.SH
155 2024-08-20,1.077089845741329,002488.SZ
156 2024-08-21,1.330096420372438,002488.SZ
157 2024-08-22,1.04117609681098,002208.SZ
158 2024-08-23,1.2634267858516914,002369.SZ
159 2024-08-26,0.8745811905917017,000532.SZ
160 2024-08-27,0.836754154047108,002760.SZ
161 2024-08-28,0.7231326607988842,002547.SZ
162 2024-08-29,0.8735120215139563,003001.SZ
163 2024-08-30,0.6615140980616735,601898.SH
164 2024-09-02,1.093224090711538,603826.SH
165 2024-09-03,0.41407989346203866,002309.SZ
166 2024-09-04,0.7919233491318468,001298.SZ
167 2024-09-05,0.6449753890047838,000908.SZ
168 2024-09-06,1.17109797325565,002622.SZ
169 2024-09-09,1.2278175192855338,000999.SZ
170 2024-09-10,0.7463596223821397,600804.SH
171 2024-09-11,0.7470176349514708,002808.SZ
172 2024-09-12,0.7243651180373872,603559.SH
173 2024-09-13,1.474732794777432,603615.SH
174 2024-09-18,0.883126816576788,000659.SZ
175 2024-09-19,0.640225572474989,600898.SH
176 2024-09-20,1.051164703847969,603398.SH
177 2024-09-23,0.9312327237656652,601162.SH
178 2024-09-24,0.47774549082415085,603559.SH
179 2024-09-25,0.9563618822865794,600756.SH
180 2024-09-26,0.5275946326737218,002686.SZ
181 2024-09-27,0.18984202360702415,002016.SZ
182 2024-09-30,0.035786009050673036,603106.SH
183 2024-10-08,0.032889649456072596,603106.SH
184 2024-10-09,0.12465071252054723,601336.SH
185 2024-10-10,0.6969210259884471,000402.SZ
186 2024-10-11,1.0531806211526256,600099.SH
187 2024-10-14,0.46171010596010975,601162.SH
188 2024-10-15,1.050584350922452,000402.SZ
189 2024-10-16,0.9133292498947153,002987.SZ
190 2024-10-17,0.7700882254413255,000567.SZ
191 2024-10-18,0.1201641254984537,600895.SH
192 2024-10-21,0.6976186419462845,002457.SZ
193 2024-10-22,0.29432613116032685,002423.SZ
194 2024-10-23,0.7806425787966057,000158.SZ
195 2024-10-24,0.6036172569478745,002199.SZ
196 2024-10-25,0.12282827583399647,603016.SH
197 2024-10-28,0.5245178749249334,000503.SZ
198 2024-10-29,0.5076972792469883,002851.SZ
199 2024-10-30,0.7895092176015108,600463.SH
200 2024-10-31,0.6192784720087864,603117.SH
201 2024-11-01,1.204091078793982,002134.SZ
202 2024-11-04,0.8093625376363384,002570.SZ
203 2024-11-05,0.8638488115176264,600172.SH
204 2024-11-06,0.8186577511607894,600292.SH
205 2024-11-07,0.8635644200307799,600481.SH
206 2024-11-08,0.747868586080844,002047.SZ
207 2024-11-11,0.8396084711761063,002428.SZ
208 2024-11-12,0.7919805059954543,603859.SH
209 2024-11-13,0.9060991217118458,603859.SH
210 2024-11-14,0.9421847563274262,600966.SH
211 2024-11-15,1.5178035825387006,002086.SZ
212 2024-11-18,1.5376931721833804,600212.SH
213 2024-11-19,1.4060097628439219,603825.SH
214 2024-11-20,0.8890834002457785,002808.SZ
215 2024-11-21,0.8855345297456824,603859.SH
216 2024-11-22,1.119413451276471,600593.SH
217 2024-11-25,0.7785122491322624,600787.SH
218 2024-11-26,1.0000210964516405,600736.SH
219 2024-11-27,0.8847088850937169,002245.SZ
220 2024-11-28,0.8621169938483969,601360.SH
221 2024-11-29,0.7042168573520408,002354.SZ
222 2024-12-02,0.6426744321671465,002611.SZ
223 2024-12-03,0.9021248369663103,603366.SH
224 2024-12-04,0.9942733603597254,002822.SZ
225 2024-12-05,0.8594169937974554,002175.SZ
226 2024-12-06,0.6985253068214117,603366.SH
227 2024-12-09,0.9476416369172441,601933.SH
228 2024-12-10,1.053999067291189,600193.SH
229 2024-12-11,0.6996323878339654,002193.SZ
230 2024-12-12,0.9535599508119768,002362.SZ
231 2024-12-13,1.3279717542253164,603429.SH
232 2024-12-16,1.0260681164941636,000727.SZ
233 2024-12-17,1.3063049942413876,600157.SH
234 2024-12-18,1.3121814535335503,002878.SZ
235 2024-12-19,1.219098477203033,600593.SH
236 2024-12-20,0.8480675770196239,002512.SZ
237 2024-12-23,1.1806404660060321,600724.SH
238 2024-12-24,0.8537658533885591,603610.SH
239 2024-12-25,0.8752079792242901,002965.SZ
240 2024-12-26,0.720498836899636,603214.SH
241 2024-12-27,0.8552518755027023,002945.SZ
242 2024-12-30,0.7853260336927593,600223.SH
243 2024-12-31,1.0774196590782728,600183.SH
244 2025-01-02,1.345874429894366,603225.SH
245 2025-01-03,1.4595000226870254,603379.SH
246 2025-01-06,1.8567194520891437,002130.SZ
247 2025-01-07,1.327995034218316,002881.SZ
248 2025-01-08,0.7854520495476546,600126.SH
249 2025-01-09,0.8656051617404842,000756.SZ
250 2025-01-10,1.1141535494224937,605016.SH
251 2025-01-13,2.0375745364278695,605080.SH
252 2025-01-14,0.6228152667370752,603269.SH
253 2025-01-15,0.7099046974063614,600673.SH
254 2025-01-16,0.7230959774435842,600381.SH
255 2025-01-17,0.8735560458074921,603007.SH
256 2025-01-20,0.6265446536616674,002164.SZ
257 2025-01-21,1.4687297319348953,000534.SZ
258 2025-01-22,0.7347201431708319,000408.SZ
259 2025-01-23,0.7698608009850573,603121.SH
260 2025-01-24,0.6733337270251429,603360.SH
261 2025-01-27,1.3722279750234074,002484.SZ
262 2025-02-05,1.0995625926629562,603667.SH
263 2025-02-06,0.9540560778289151,603308.SH
264 2025-02-07,0.8152925075270021,000856.SZ
265 2025-02-10,0.4527649047879118,603166.SH

50
code/utils/utils.py Normal file
View File

@@ -0,0 +1,50 @@
import pandas as pd
import pandas as pd
def read_and_merge_h5_data(h5_filename, key, columns, df=None):
"""
读取 HDF5 文件中的数据,根据指定的 columns 筛选数据,
如果传入 df 参数,则将其与读取的数据根据 ts_code 和 trade_date 合并。
参数:
- h5_filename: HDF5 文件名
- key: 数据存储在 HDF5 文件中的 key
- columns: 要读取的列名列表
- df: 需要合并的 DataFrame如果为空则不进行合并
返回:
- 合并后的 DataFrame
"""
# 处理 _ 开头的列名
processed_columns = []
for col in columns:
if col.startswith('_'):
processed_columns.append(col[1:]) # 去掉下划线
else:
processed_columns.append(col)
# 从 HDF5 文件读取数据,选择需要的列
data = pd.read_hdf(h5_filename, key=key, columns=processed_columns)
# 修改列名,如果列名以前有 _加上 _
for col in data.columns:
if col not in columns: # 只有不在 columns 中的列才需要加下划线
new_col = f'_{col}'
data.rename(columns={col: new_col}, inplace=True)
# 如果传入的 df 不为空,则进行合并
if df is not None and not df.empty:
# 确保两个 DataFrame 都有 ts_code 和 trade_date 列
df['trade_date'] = pd.to_datetime(df['trade_date'], format='%Y%m%d')
data['trade_date'] = pd.to_datetime(data['trade_date'], format='%Y%m%d')
# 根据 ts_code 和 trade_date 合并
merged_df = pd.merge(df, data, on=['ts_code', 'trade_date'], how='left')
else:
# 如果 df 为空,则直接返回读取的数据
merged_df = data
return merged_df