首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >获取开盘啦情绪温度、涨停家数、连板数、亏钱效应图表显示

获取开盘啦情绪温度、涨停家数、连板数、亏钱效应图表显示

作者头像
子晓聊技术
发布2026-04-23 14:57:44
发布2026-04-23 14:57:44
1710
举报
文章被收录于专栏:子晓AI量化子晓AI量化

市场情绪本质是投资者心理的集体映射,通过交易行为转化为价格波动。研究表明,情绪极端乐观时往往伴随市场顶部,而极度悲观时常孕育反转机会。情绪指标的价值在于:

  • 量化主观感受:将难以言喻的“市场氛围”转化为可分析的数据
  • 预判拐点信号:极端情绪值常领先于技术图形的转折
  • 辅助仓位管理:通过情绪热度控制仓位大小,规避非理性操作

之前写过获取同花顺获取情绪温度的文章, 星球一些同学提到能不能写一写怎么获取开盘啦的情绪数据,这里就用开盘啦获取这些数据演示下。

其实代码很简单,按照开盘啦的定义,情绪温度 由 涨停家数、 连板家数、亏钱效应等多种因素组成, 那这里就简单获取下数据, 绘制成折线图。

这里提供部分代码, 如何通过ploty绘制折线图的。 这也是我喜欢用ploty绘制图表的原因,很方便。

代码语言:javascript
复制
# 创建2x2的子图布局(4个独立折线图)
fig = make_subplots(
    rows=2, cols=2,
    subplot_titles=("情绪温度趋势", "涨停家数趋势", "连板高度趋势", "亏钱效应趋势"),
    vertical_spacing=0.15,
    horizontal_spacing=0.1
)
# 1. 情绪温度折线图(左上)
fig.add_trace(
    go.Scatter(
        x=filtered_df['Day'],
        y=filtered_df['strong'],
        name='情绪温度',
        mode='lines+markers',
        line=dict(color='#636EFA', width=2),
        marker=dict(size=6)
    ),
    row=1, col=1
)
# 添加警戒线
fig.add_hline(y=75, line_dash="dot", line_color="red", row=1, col=1,
              annotation_text="过热警戒线", annotation_position="top right")
fig.add_hline(y=25, line_dash="dot", line_color="green", row=1, col=1,
              annotation_text="过冷警戒线", annotation_position="bottom right")
fig.update_yaxes(title_text="情绪指数(0-100)", range=[0, 100], row=1, col=1)
# 2. 涨停家数折线图(右上)
fig.add_trace(
    go.Scatter(
        x=filtered_df['Day'],
        y=filtered_df['ztjs'],
        name='涨停家数',
        mode='lines+markers',
        line=dict(color='#00C853', width=2),
        marker=dict(size=6, symbol='diamond')
    ),
    row=1, col=2
)
# 添加活跃警戒线
fig.add_hline(y=50, line_dash="dot", line_color="orange", row=1, col=2,
              annotation_text="情绪活跃线", annotation_position="top right")
fig.update_yaxes(title_text="涨停数量", row=1, col=2)
# 3. 连板高度折线图(左下)
fig.add_trace(
    go.Scatter(
        x=filtered_df['Day'],
        y=filtered_df['lbgd'],
        name='连板高度',
        mode='lines+markers',
        line=dict(color='#FF6D00', width=2, dash='dot'),
        marker=dict(size=7, symbol='triangle-up')
    ),
    row=2, col=1
)
# 添加龙头股识别线
fig.add_hline(y=5, line_dash="dot", line_color="purple", row=2, col=1,
              annotation_text="龙头股阈值", annotation_position="top right")
fig.update_yaxes(title_text="连板天数", row=2, col=1)
# 4. 亏钱效应折线图(右下)
fig.add_trace(
    go.Scatter(
        x=filtered_df['Day'],
        y=filtered_df['df_num'],
        name='亏钱效应',
        mode='lines+markers',
        line=dict(color='#D50000', width=2),
        marker=dict(size=6, symbol='x')
    ),
    row=2, col=2
)
# 添加风险警戒线
fig.add_hline(y=30, line_dash="dot", line_color="brown", row=2, col=2,
              annotation_text="风险警戒线", annotation_position="top right")
fig.update_yaxes(title_text="跌停数量", row=2, col=2)
# 统一设置布局
fig.update_layout(
    height=700,
    showlegend=False,  # 每个图表独立展示,无需图例
    template='plotly_white',
    margin=dict(t=50, b=50),
    hovermode='x unified'
)
fig.update_xaxes(title_text="日期", row=2, col=1)
fig.update_xaxes(title_text="日期", row=2, col=2)
st.plotly_chart(fig, use_container_width=True)

开盘啦数据如何获取可以参考我前面的几篇文章, 基本上用fiddler或charles网络抓包就能搞定。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2025-07-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 子晓聊技术 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档