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

第19节 Node.js Express 框架

Express 是一个为Node.js设计的web开发框架&#xff0c;它基于nodejs平台。 Express 简介 Express是一个简洁而灵活的node.js Web应用框架, 提供了一系列强大特性帮助你创建各种Web应用&#xff0c;和丰富的HTTP工具。 使用Express可以快速地搭建一个完整功能的网站。 Expre…...

golang循环变量捕获问题​​

在 Go 语言中&#xff0c;当在循环中启动协程&#xff08;goroutine&#xff09;时&#xff0c;如果在协程闭包中直接引用循环变量&#xff0c;可能会遇到一个常见的陷阱 - ​​循环变量捕获问题​​。让我详细解释一下&#xff1a; 问题背景 看这个代码片段&#xff1a; fo…...

【JavaEE】-- HTTP

1. HTTP是什么&#xff1f; HTTP&#xff08;全称为"超文本传输协议"&#xff09;是一种应用非常广泛的应用层协议&#xff0c;HTTP是基于TCP协议的一种应用层协议。 应用层协议&#xff1a;是计算机网络协议栈中最高层的协议&#xff0c;它定义了运行在不同主机上…...

python/java环境配置

环境变量放一起 python&#xff1a; 1.首先下载Python Python下载地址&#xff1a;Download Python | Python.org downloads ---windows -- 64 2.安装Python 下面两个&#xff0c;然后自定义&#xff0c;全选 可以把前4个选上 3.环境配置 1&#xff09;搜高级系统设置 2…...

cf2117E

原题链接&#xff1a;https://codeforces.com/contest/2117/problem/E 题目背景&#xff1a; 给定两个数组a,b&#xff0c;可以执行多次以下操作&#xff1a;选择 i (1 < i < n - 1)&#xff0c;并设置 或&#xff0c;也可以在执行上述操作前执行一次删除任意 和 。求…...

Neo4j 集群管理:原理、技术与最佳实践深度解析

Neo4j 的集群技术是其企业级高可用性、可扩展性和容错能力的核心。通过深入分析官方文档,本文将系统阐述其集群管理的核心原理、关键技术、实用技巧和行业最佳实践。 Neo4j 的 Causal Clustering 架构提供了一个强大而灵活的基石,用于构建高可用、可扩展且一致的图数据库服务…...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)

笔记整理&#xff1a;刘治强&#xff0c;浙江大学硕士生&#xff0c;研究方向为知识图谱表示学习&#xff0c;大语言模型 论文链接&#xff1a;http://arxiv.org/abs/2407.16127 发表会议&#xff1a;ISWC 2024 1. 动机 传统的知识图谱补全&#xff08;KGC&#xff09;模型通过…...

ios苹果系统,js 滑动屏幕、锚定无效

现象&#xff1a;window.addEventListener监听touch无效&#xff0c;划不动屏幕&#xff0c;但是代码逻辑都有执行到。 scrollIntoView也无效。 原因&#xff1a;这是因为 iOS 的触摸事件处理机制和 touch-action: none 的设置有关。ios有太多得交互动作&#xff0c;从而会影响…...

docker 部署发现spring.profiles.active 问题

报错&#xff1a; org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property spring.profiles.active imported from location class path resource [application-test.yml] is invalid in a profile specific resource [origin: class path re…...

逻辑回归暴力训练预测金融欺诈

简述 「使用逻辑回归暴力预测金融欺诈&#xff0c;并不断增加特征维度持续测试」的做法&#xff0c;体现了一种逐步建模与迭代验证的实验思路&#xff0c;在金融欺诈检测中非常有价值&#xff0c;本文作为一篇回顾性记录了早年间公司给某行做反欺诈预测用到的技术和思路。百度…...