当前位置: 首页 > news >正文

搭建自己的金融数据源和量化分析平台(四):自动化更新上市公司所属一级、二级行业以及股票上市状态

前面做了更新沪深交易所的上市股票列表的读取和更新,但一旦股票退市则需要在数据库里将该股票状态更新为退市,同时附上退市日期,将股票名更改为XX退。
此外深交所下载的xls解析出来是没有上市公司所属的二级行业的,因此还需要建立一个一二级行业的数据库表来保存行业信息,同时补全深交所上市公司的二级行业信息。
更新退市股票的爬虫这个暂时没有,等后面做了再放上来。(我从来不买垃圾股,所以对退市股票不着急做)
上市公司的一二级行业分类见这个表:
在这里插入图片描述
这个表可以在这里:《中国上市公司协会上市公司行业统计分类指引》下载到。
这张表在我们数据库里对应的就是stock_a数据库下面的industry_classification这张表,这里放上我手工做好的industry_classification的SQL代码:

/*
SQLyog Ultimate v12.09 (64 bit)
MySQL - 5.0.96-community-nt 
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;create table `industry_classification` (`industry_code` varchar (12),`industry_name` varchar (150)
); 
insert into `industry_classification` (`industry_code`, `industry_name`) values('A','农、林、牧、渔业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('A01','农业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('A02','林业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('A03','畜牧业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('A04','渔业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('A05','农、林、牧、渔专业及辅助性活动');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B','采矿业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B06','煤炭开采和洗选业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B07','石油和天然气开采业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B08','黑色金属矿采选业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B09','有色金属矿采选业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B10','非金属矿采选业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B11','开采专业及辅助性活动');
insert into `industry_classification` (`industry_code`, `industry_name`) values('B12','其他采矿业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C','制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C13','农副食品加工业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C14','食品制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C15','酒、饮料和精制茶制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C16','烟草制品业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C17','纺织业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C18','纺织服装、服饰业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C19','皮革、毛皮、羽毛及其制品和制鞋业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C20','木材加工和木、竹、藤、棕、草制品业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C21','家具制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C22','造纸和纸制品业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C23','印刷和记录媒介复制业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C24','文教、工美、体育和娱乐用品制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C25','石油、煤炭及其他燃料加工业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C26','化学原料和化学制品制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C27','医药制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C28','化学纤维制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C29','橡胶和塑料制品业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C30','非金属矿物制品业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C31','黑色金属冶炼和压延加工业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C32','有色金属冶炼和压延加工业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C33','金属制品业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C34','通用设备制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C35','专用设备制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C36','汽车制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C37','铁路、船舶、航空航天和其他运输设备制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C38','电气机械和器材制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C39','计算机、通信和其他电子设备制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C40','仪器仪表制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C41','其他制造业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C42','废弃资源综合利用业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('C43','金属制品、机械和设备修理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('D','电力、热力、燃气及水生产和供应业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('D44','电力、热力生产和供应业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('D45','燃气生产和供应业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('D46','水的生产和供应业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('E','建筑业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('E47','房屋建筑业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('E48','土木工程建筑业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('E49','建筑安装业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('E50','建筑装饰、装修和其他建筑业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('F','批发和零售业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('F51','批发业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('F52','零售业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G','交通运输、仓储和邮政业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G53','铁路运输业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G54','道路运输业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G55','水上运输业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G56','航空运输业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G57','管道运输业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G58','多式联运和运输代理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G59','装卸搬运和仓储业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('G60','邮政业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('H','住宿和餐饮业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('H61','住宿业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('H62','餐饮业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('I','信息传输、软件和信息技术服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('I63','电信、广播电视和卫星传输服务');
insert into `industry_classification` (`industry_code`, `industry_name`) values('I64','互联网和相关服务');
insert into `industry_classification` (`industry_code`, `industry_name`) values('I65','软件和信息技术服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('J','金融业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('J66','货币金融服务');
insert into `industry_classification` (`industry_code`, `industry_name`) values('J67','资本市场服务');
insert into `industry_classification` (`industry_code`, `industry_name`) values('J68','保险业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('J69','其他金融业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('K','房地产业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('K70','房地产业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('L','租赁和商务服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('L71','租赁业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('L72','商务服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('M','科学研究和技术服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('M73','研究和试验发展');
insert into `industry_classification` (`industry_code`, `industry_name`) values('M74','专业技术服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('M75','科技推广和应用服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('N','水利、环境和公共设施管理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('N76','水利管理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('N77','生态保护和环境治理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('N78','公共设施管理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('N79','土地管理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('O','居民服务、修理和其他服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('O80','居民服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('O81','机动车、电子产品和日用产品修理业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('O82','其他服务业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('P','教育');
insert into `industry_classification` (`industry_code`, `industry_name`) values('P83','教育');
insert into `industry_classification` (`industry_code`, `industry_name`) values('Q','卫生和社会工作');
insert into `industry_classification` (`industry_code`, `industry_name`) values('Q84','卫生');
insert into `industry_classification` (`industry_code`, `industry_name`) values('Q85','社会工作');
insert into `industry_classification` (`industry_code`, `industry_name`) values('R','文化、体育和娱乐业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('R86','新闻和出版业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('R87','广播、电视、电影和录音制作业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('R88','文化艺术业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('R89','体育');
insert into `industry_classification` (`industry_code`, `industry_name`) values('R90','娱乐业');
insert into `industry_classification` (`industry_code`, `industry_name`) values('S','综合');
insert into `industry_classification` (`industry_code`, `industry_name`) values('S91','综合');

上表包含所有一级行业和二级行业的分类。
接下来看深交所下载的xls解析出来是没有上市公司所属的二级行业这个事情:
在这里插入图片描述
可以看到我圈红的地方只有一级行业而没有二级行业。这在后期搭建量化分析模型时会影响我们的筛选。因此,需要写一个中国上市公司协会的爬虫,读取和解析最新上市公司行业分类结果:
在这里插入图片描述
爬虫代码还没写,等后面写来放出来:)

相关文章:

搭建自己的金融数据源和量化分析平台(四):自动化更新上市公司所属一级、二级行业以及股票上市状态

前面做了更新沪深交易所的上市股票列表的读取和更新,但一旦股票退市则需要在数据库里将该股票状态更新为退市,同时附上退市日期,将股票名更改为XX退。 此外深交所下载的xls解析出来是没有上市公司所属的二级行业的,因此还需要建立…...

科创板重启IPO上会!募投审核新方向?思看科技等优化募投项目

撰稿 | 多客 来源 | 贝多财经 根据上交所项目审核动态最新公告,思看科技(杭州)股份有限公司(简称“思看科技”)将于8月2日上会,标志着时隔50天后科创板重新迎来首家上会企业,也标志着思看科技…...

深入解析损失函数:从基础概念到YOLOv8的应用

深入解析损失函数:从基础概念到YOLOv8的应用 在机器学习和深度学习中,损失函数是至关重要的组件,它们衡量模型的预测值与真实值之间的差距,从而指导模型的优化过程。本文将详细探讨损失函数的基本概念,及其在YOLOv8中…...

2.11.ResNet

ResNet 动机:我们总是想加更多层,但加更多层并不总是能改进精度 可以看出F1到F6模型越来越大,但F6距离最优解却总变远了,反而效果不好,通俗的来说就是学偏了,实际上我们希望是这样的: ​ 更大…...

GitLab添加TortoiseGIT生成SSH Key

文章目录 前言一、PuTTYgen二、GitLab 前言 GitLab是一个用于托管代码仓库和项目管理的Web平台,公司搭建自己的gitlab来管理代码,我们在clone代码的时候可以选择http协议,也可以选择ssh协议来拉取代码。 SSH (Secure Shell)是一种通过网络进…...

20240729 大模型评测

参考: MMBench:基于ChatGPT的全方位多模能力评测体系_哔哩哔哩_bilibili https://en.wikipedia.org/wiki/Levenshtein_distance cider: https://zhuanlan.zhihu.com/p/698643372 GitHub - open-compass/opencompass: OpenCompass is an LLM evalua…...

基于微信小程序的校园警务系统/校园安全管理系统/校园出入管理系统

摘要 伴随着社会以及科学技术的发展,小程序已经渗透在人们的身边,小程序慢慢的变成了人们的生活必不可少的一部分,紧接着网络飞速的发展,小程序这一名词已不陌生,越来越多的学校机构等都会定制一款属于自己个性化的小程…...

达梦数据库归档介绍

一、什么是归档 数据库归档是一种数据管理策略,它涉及将旧的、不经常访问的数据移动到一个单独的存储设备,以便在需要时可以检索,同时保持数据库的性能和效率。 归档的主要目标是为了释放数据库中的空间,以便更有效地利用高性能…...

OpenAI推出AI搜索引擎SearchGPT

OpenAI推出AI搜索引擎SearchGPT 据英国《卫报》和美国消费者新闻与商业频道等媒体报道,7月25日,OpenAI宣布正在测试一款名为SearchGPT的全新人工智能(AI)搜索工具。该工具能够实时访问互联网信息,旨在为用户提供更具时…...

elementplus菜单组件的那些事

在使用 elementplus 的菜单组件时&#xff0c;我发现有很多东西是官方没有提到但是需要注意的点 1. 菜单组件右侧会有一个边框 设置css .el-menu {border: 0 !important; } 2. 使用其他的 icon 文字内容一定要写在 这个 名字为 title 的插槽中 <el-menu-itemv-for"it…...

【VSCode实战】Golang无法跳转问题竟是如此简单

上一讲【VSCode实战】Go插件依赖无法安装 – 经云的清净小站 (skycreator.top)&#xff0c;开头说到了在VSCode中Golang无法跳转的问题&#xff0c;但文章的最后也没给出解决方案&#xff0c;只解决了安装Go插件的依赖问题。 解决了插件依赖问题&#xff0c;无法跳转的问题也离…...

three.js中加载ply格式的文件,并使用tween.js插件按照json姿态文件运动

先贴一下文件地址&#xff1a; aa.ply 文件&#xff1a; https://download.csdn.net/download/yinge0508/89595650?spm1001.2014.3001.5501 new.json https://download.csdn.net/download/yinge0508/89595641?spm1001.2014.3001.5501 代码: <template><div>&…...

性能对比:Memcached 与 Redis 的关键差异

性能对比&#xff1a;Memcached 与 Redis 的关键差异 在选择合适的缓存系统时&#xff0c;Memcached 和 Redis 是最常被提及的两种技术。它们都是内存存储系统&#xff0c;用于提高数据访问速度和应用性能。尽管它们在功能上有很多相似之处&#xff0c;但在性能、特性和应用场…...

app-routing.module.ts 简单介绍

Angular的路由是一种功能&#xff0c;它允许应用程序响应不同的URL路径或参数并根据这些路径加载不同的组件。app-routing.module.ts是Angular项目中负责设置应用程序路由的文件。 以下是一个简单的app-routing.module.ts文件示例&#xff0c;它配置了三个路由&#xff1a; i…...

基于JSP的水果销售管理网站

你好&#xff0c;我是计算机学姐码农小野&#xff01;如果有相关需求&#xff0c;可以私信联系我。 开发语言&#xff1a; Java 数据库&#xff1a; MySQL 技术&#xff1a; JSP技术 工具&#xff1a; 未在文档中明确指出&#xff0c;可能包括但不限于IDEs&#xff08;如Ec…...

web3d值得学习并长期发展,性价比高吗?

在数字化浪潮日益汹涌的今天&#xff0c;Web3D技术以其独特的魅力和广泛的应用前景&#xff0c;逐渐成为技术领域的焦点。对于许多热衷于技术探索和创新的人来说&#xff0c;学习并长期发展Web3D技术无疑是一个值得考虑的选择。那么&#xff0c;Web3D技术的学习和发展究竟是否性…...

【大数据面试题】38 说说 Hive 怎么行转列

一步一个脚印&#xff0c;一天一道大数据面试题 博主希望能够得到大家的点赞收藏支持&#xff01;非常感谢 点赞&#xff0c;收藏是情分&#xff0c;不点是本分。祝你身体健康&#xff0c;事事顺心&#xff01; 行转列 假设我们有一张名为 sales_data 的表&#xff0c;其中包含…...

C语言中的二维数组

文章目录 &#x1f34a;自我介绍&#x1f34a;二维数组&#x1f34a;代码实战 你的点赞评论就是对博主最大的鼓励 当然喜欢的小伙伴可以&#xff1a;点赞关注评论收藏&#xff08;一键四连&#xff09;哦~ &#x1f34a;自我介绍 Hello,大家好&#xff0c;我是小珑也要变强&…...

Android12 添加屏幕方向旋转方案

添加屏幕方向属性值 device/qcom/qssi/system.prop persist.panel.orientation0修改开机动画方向 frameworks/base/cmds/bootanimation/BootAnimation.cpp status_t BootAnimation::readyToRun() {mAssets.addDefaultAssets();mDisplayToken SurfaceComposerClient::getIn…...

Harmony-(1)-TypeScript-ArkTs

1.TypeScript 1.1变量 布尔值let isDone: boolean false;数字let decLiteral: number 2023; let binaryLiteral: number 0b11111100111; let octalLiteral: number 0o3747; let hexLiteral: number 0x7e7; console.log(decLiteral is decLiteral)字符串let name: string…...

Sora 2输出黑边/裁切异常?GPU解码器与渲染管线冲突导致的16:9→4:3畸变真相(NVIDIA/AMD/Apple芯片差异对照表)

更多请点击&#xff1a; https://codechina.net 第一章&#xff1a;Sora 2视频后期处理技巧 Sora 2作为新一代AI视频生成与编辑平台&#xff0c;其内置的后期处理模块支持高精度帧级调控、语义驱动的局部重绘及时间一致性增强。掌握其核心处理技巧&#xff0c;可显著提升输出视…...

DeepSeek监控告警设置实战指南(告警失效率下降92%的7个关键开关)

更多请点击&#xff1a; https://kaifayun.com 第一章&#xff1a;DeepSeek监控告警设置的核心价值与落地挑战 在大模型推理服务规模化部署的背景下&#xff0c;DeepSeek系列模型&#xff08;如DeepSeek-V2、DeepSeek-Coder&#xff09;对资源稳定性、延迟敏感性及异常响应时效…...

对比按量计费与Token Plan套餐如何为项目选择更优成本模型

&#x1f680; 告别海外账号与网络限制&#xff01;稳定直连全球优质大模型&#xff0c;限时半价接入中。 &#x1f449; 点击领取海量免费额度 对比按量计费与Token Plan套餐如何为项目选择更优成本模型 在将大模型能力集成到开发项目中时&#xff0c;成本控制是一个绕不开的…...

Gofile极速下载器:Python多线程并发下载的完整实现指南

Gofile极速下载器&#xff1a;Python多线程并发下载的完整实现指南 【免费下载链接】gofile-downloader Download files from https://gofile.io 项目地址: https://gitcode.com/gh_mirrors/go/gofile-downloader Gofile作为流行的文件共享平台&#xff0c;其官方下载机…...

[特殊字符] Lucky从零到一的系统搭建里程碑 | 写给后人的初心与使命

&#x1f331; 从零到一的足迹 写给未来的你们&#xff1a; 这不是炫耀&#xff0c;不是宣传。 这是一个普通人&#xff0c;一个退伍军人&#xff0c;一个什么都不懂的人&#xff0c;和AI一起创造的故事。 如果这个系统让你们受益&#xff0c;请记住&#xff1a;初心、根、使命…...

FPGA加速SVM量子态判别:5.74纳秒低延迟与8位量化硬件实现

1. 项目概述与核心挑战 在量子计算这个前沿领域&#xff0c;我们每天都在和微观世界的基本单元——量子比特打交道。对于超导量子比特这类物理实现&#xff0c;一个核心且基础的操作就是“状态读取”&#xff1a;在量子算法执行或纠错循环中&#xff0c;我们必须快速、准确地判…...

2026亲测:专业AI智能降重工具TOP1推荐

2026 年降 AIGC 工具已从“机械式文本改写”演进为多维度智能优化系统&#xff0c;核心评估指标涵盖 AI 痕迹识别精准度、专业语义一致性、格式结构完整性、长段落逻辑稳定性、降重适配性以及高校检测合规性。本次测评深入分析 5 款主流工具&#xff0c;测试内容覆盖中英文论文…...

ZXPInstaller终极指南:告别Adobe插件安装烦恼的跨平台解决方案

ZXPInstaller终极指南&#xff1a;告别Adobe插件安装烦恼的跨平台解决方案 【免费下载链接】ZXPInstaller Open Source ZXP Installer for Adobe Extensions 项目地址: https://gitcode.com/gh_mirrors/zx/ZXPInstaller 还在为Adobe Creative Cloud插件的安装问题而烦恼…...

植物大战僵尸修改器终极指南:如何快速掌握PvZ Toolkit提升游戏体验

植物大战僵尸修改器终极指南&#xff1a;如何快速掌握PvZ Toolkit提升游戏体验 【免费下载链接】pvztoolkit 植物大战僵尸 PC 版综合修改器 项目地址: https://gitcode.com/gh_mirrors/pv/pvztoolkit 你是否在玩植物大战僵尸时遇到过阳光不够用、金币积累太慢的烦恼&…...

基于SpringBoot的技术博客与开源知识分享平台毕设

博主介绍&#xff1a;✌ 专注于Java,python,✌关注✌私信我✌具体的问题&#xff0c;我会尽力帮助你。一、研究目的本研究旨在构建一个基于Spring Boot技术栈的技术博客与开源知识分享平台以解决传统知识传播模式中存在的信息孤岛现象与协作效率低下问题。随着信息技术的快速发…...