当前位置: 首页 > 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…...

使用docker在3台服务器上搭建基于redis 6.x的一主两从三台均是哨兵模式

一、环境及版本说明 如果服务器已经安装了docker,则忽略此步骤,如果没有安装,则可以按照一下方式安装: 1. 在线安装(有互联网环境): 请看我这篇文章 传送阵>> 点我查看 2. 离线安装(内网环境):请看我这篇文章 传送阵>> 点我查看 说明&#xff1a;假设每台服务器已…...

【kafka】Golang实现分布式Masscan任务调度系统

要求&#xff1a; 输出两个程序&#xff0c;一个命令行程序&#xff08;命令行参数用flag&#xff09;和一个服务端程序。 命令行程序支持通过命令行参数配置下发IP或IP段、端口、扫描带宽&#xff0c;然后将消息推送到kafka里面。 服务端程序&#xff1a; 从kafka消费者接收…...

【力扣数据库知识手册笔记】索引

索引 索引的优缺点 优点1. 通过创建唯一性索引&#xff0c;可以保证数据库表中每一行数据的唯一性。2. 可以加快数据的检索速度&#xff08;创建索引的主要原因&#xff09;。3. 可以加速表和表之间的连接&#xff0c;实现数据的参考完整性。4. 可以在查询过程中&#xff0c;…...

蓝桥杯 2024 15届国赛 A组 儿童节快乐

P10576 [蓝桥杯 2024 国 A] 儿童节快乐 题目描述 五彩斑斓的气球在蓝天下悠然飘荡&#xff0c;轻快的音乐在耳边持续回荡&#xff0c;小朋友们手牵着手一同畅快欢笑。在这样一片安乐祥和的氛围下&#xff0c;六一来了。 今天是六一儿童节&#xff0c;小蓝老师为了让大家在节…...

工程地质软件市场:发展现状、趋势与策略建议

一、引言 在工程建设领域&#xff0c;准确把握地质条件是确保项目顺利推进和安全运营的关键。工程地质软件作为处理、分析、模拟和展示工程地质数据的重要工具&#xff0c;正发挥着日益重要的作用。它凭借强大的数据处理能力、三维建模功能、空间分析工具和可视化展示手段&…...

React19源码系列之 事件插件系统

事件类别 事件类型 定义 文档 Event Event 接口表示在 EventTarget 上出现的事件。 Event - Web API | MDN UIEvent UIEvent 接口表示简单的用户界面事件。 UIEvent - Web API | MDN KeyboardEvent KeyboardEvent 对象描述了用户与键盘的交互。 KeyboardEvent - Web…...

【Go】3、Go语言进阶与依赖管理

前言 本系列文章参考自稀土掘金上的 【字节内部课】公开课&#xff0c;做自我学习总结整理。 Go语言并发编程 Go语言原生支持并发编程&#xff0c;它的核心机制是 Goroutine 协程、Channel 通道&#xff0c;并基于CSP&#xff08;Communicating Sequential Processes&#xff0…...

CocosCreator 之 JavaScript/TypeScript和Java的相互交互

引擎版本&#xff1a; 3.8.1 语言&#xff1a; JavaScript/TypeScript、C、Java 环境&#xff1a;Window 参考&#xff1a;Java原生反射机制 您好&#xff0c;我是鹤九日&#xff01; 回顾 在上篇文章中&#xff1a;CocosCreator Android项目接入UnityAds 广告SDK。 我们简单讲…...

Linux云原生安全:零信任架构与机密计算

Linux云原生安全&#xff1a;零信任架构与机密计算 构建坚不可摧的云原生防御体系 引言&#xff1a;云原生安全的范式革命 随着云原生技术的普及&#xff0c;安全边界正在从传统的网络边界向工作负载内部转移。Gartner预测&#xff0c;到2025年&#xff0c;零信任架构将成为超…...

拉力测试cuda pytorch 把 4070显卡拉满

import torch import timedef stress_test_gpu(matrix_size16384, duration300):"""对GPU进行压力测试&#xff0c;通过持续的矩阵乘法来最大化GPU利用率参数:matrix_size: 矩阵维度大小&#xff0c;增大可提高计算复杂度duration: 测试持续时间&#xff08;秒&…...