feat: 添加 Redis 消息展示功能到监控面板

- 新增 /api/messages API 接口,支持从 Redis Stream 读取消息
- 支持按策略筛选消息和分页展示
- 前端新增消息列表卡片,展示时间、策略、股票代码、动作、价格和状态
- 自动判断消息处理状态(已处理/待处理)
- 消息列表每30秒自动刷新,支持手动刷新
This commit is contained in:
2026-03-01 22:06:42 +08:00
parent e88ba5bcf9
commit 7bb0a0537b
14 changed files with 1814 additions and 806 deletions

View File

@@ -18,10 +18,10 @@
"Please upgrade to Gymnasium, the maintained drop-in replacement of Gym, or contact the authors of your software and request that they upgrade.\n",
"Users of this version of Gym should be able to simply replace 'import gym' with 'import gymnasium as gym' in the vast majority of cases.\n",
"See the migration guide at https://gymnasium.farama.org/introduction/migration_guide/ for additional information.\n",
"[206406:MainThread](2025-12-05 23:38:39,028) INFO - qlib.Initialization - [config.py:452] - default_conf: client.\n",
"[206406:MainThread](2025-12-05 23:38:39,028) WARNING - qlib.Initialization - [config.py:459] - Unrecognized config freq\n",
"[206406:MainThread](2025-12-05 23:38:39,034) INFO - qlib.Initialization - [__init__.py:75] - qlib successfully initialized based on client settings.\n",
"[206406:MainThread](2025-12-05 23:38:39,035) INFO - qlib.Initialization - [__init__.py:77] - data_path={'__DEFAULT_FREQ': PosixPath('/mnt/d/PyProject/NewStock/data/qlib')}\n"
"[177513:MainThread](2026-02-25 22:33:43,460) INFO - qlib.Initialization - [config.py:452] - default_conf: client.\n",
"[177513:MainThread](2026-02-25 22:33:43,461) WARNING - qlib.Initialization - [config.py:459] - Unrecognized config freq\n",
"[177513:MainThread](2026-02-25 22:33:43,467) INFO - qlib.Initialization - [__init__.py:75] - qlib successfully initialized based on client settings.\n",
"[177513:MainThread](2026-02-25 22:33:43,469) INFO - qlib.Initialization - [__init__.py:77] - data_path={'__DEFAULT_FREQ': PosixPath('/mnt/d/PyProject/NewStock/data/qlib')}\n"
]
},
{
@@ -96,7 +96,7 @@
"cyq perf\n",
"left merge on ['ts_code', 'trade_date']\n",
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 9367000 entries, 0 to 9366999\n",
"RangeIndex: 9436343 entries, 0 to 9436342\n",
"Data columns (total 33 columns):\n",
" # Column Dtype \n",
"--- ------ ----- \n",
@@ -134,7 +134,7 @@
" 31 weight_avg float64 \n",
" 32 winner_rate float64 \n",
"dtypes: bool(1), datetime64[ns](1), float64(30), object(1)\n",
"memory usage: 2.2+ GB\n",
"memory usage: 2.3+ GB\n",
"None\n"
]
}
@@ -172,6 +172,38 @@
"print(df.info())"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "5f3847ec",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" trade_date return_5_rank\n",
"6527870 2024-06-03 0.523969\n",
" trade_date ma5 ma10 close\n",
"6527870 2024-06-03 10.526 10.216 10.37\n"
]
}
],
"source": [
"\n",
"df['return_5'] = df.groupby('ts_code')['close'].pct_change(periods=5)\n",
"\n",
"df['return_5_rank'] = df.groupby('trade_date')['return_5'].transform(\n",
" lambda x: (x.rank(method='average') - 1) / (x.count() - 1) if x.count() > 1 else 0.5\n",
" )\n",
"\n",
"df['ma5'] = df.groupby('ts_code')['close'].transform(lambda x: x.rolling(window=5, min_periods=1).mean())\n",
"df['ma10'] = df.groupby('ts_code')['close'].transform(lambda x: x.rolling(window=10, min_periods=1).mean())\n",
"\n",
"print(df[(df['ts_code'] == '601117.SH') & (df['trade_date'] == '2024-06-03')][['trade_date', 'return_5_rank']])\n",
"print(df[(df['ts_code'] == '601117.SH') & (df['trade_date'] == '2024-06-03')][['trade_date', 'ma5', 'ma10', 'close']])"
]
},
{
"cell_type": "code",
"execution_count": 3,
@@ -9338,7 +9370,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
"version": "3.13.2"
}
},
"nbformat": 4,