Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
06fc89ad
提交
06fc89ad
authored
11月 07, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
财务数据部署
上级
3d4f1626
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
14 行删除
+26
-14
东方财富网财务数据.py
comData/caiwushuju/东方财富网财务数据.py
+19
-14
财务数据采集说明.md
comData/caiwushuju/财务数据采集说明.md
+7
-0
没有找到文件。
comData/caiwushuju/东方财富网财务数据.py
浏览文件 @
06fc89ad
"""
"""
...
...
@@ -8,10 +8,8 @@ import pandas as pd
from
bs4
import
BeautifulSoup
from
base.BaseCore
import
BaseCore
baseCore
=
BaseCore
()
cnx
=
pymysql
.
connect
(
host
=
'114.116.44.11'
,
user
=
'caiji'
,
password
=
'f7s0&7qqtK'
,
db
=
'clb_project'
,
charset
=
'utf8mb4'
)
cursor
=
cnx
.
cursor
()
cnx_
=
baseCore
.
cnx
cursor_
=
baseCore
.
cursor
cnx
=
baseCore
.
cnx_
cursor
=
baseCore
.
cursor_
log
=
baseCore
.
getLogger
()
...
...
@@ -442,27 +440,31 @@ def get_info(social_code, com_code,info_date,delist_all,info_date_list,taskType)
def
getReportTime
():
# timeNow = baseCore.getNowTime(1)[:10]
list_date
=
[]
# 2023-04-01
#每月1号执行一次,
#todo:正式任务
# 获取当前日期和时间
current_date
=
datetime
.
now
()
# 计算昨天的日期
yesterday
=
current_date
-
timedelta
(
days
=
1
)
#
yesterday = current_date - timedelta(days=1)
# 格式化昨天的日期
report_date
=
yesterday
.
strftime
(
'
%
Y-
%
m-
%
d'
)
list_date
.
append
(
report_date
)
#
report_date = yesterday.strftime('%Y-%m-%d')
#
list_date.append(report_date)
year
=
int
(
current_date
.
strftime
(
'
%
Y'
))
# list_date = ['2023-03-31']
# list_date = ['2023-0
9-30','2023-06-30','2023-0
3-31']
list_month
=
[
'-12-31'
,
'-09-30'
,
'-06-30'
,
'-03-31'
]
for
year
in
range
(
2022
,
2018
,
-
1
):
for
year
in
range
(
year
,
2018
,
-
1
):
for
month
in
list_month
:
date
=
str
(
year
)
+
month
#todo:判断拼接的报告期是否大于当前日期,如果大于当前日期,怎说明还没到这个时间,跳过
current_date
=
current_date
.
strftime
(
'
%
Y-
%
m-
%
d'
)
if
current_date
<
date
:
continue
list_date
.
append
(
date
)
return
list_date
def
job
(
taskType
):
def
job
(
taskType
,
cnx
,
cursor
):
# 将上市企业库中的全部A股代码存入list
# 需要提供股票代码、企业信用代码
flag
=
0
...
...
@@ -475,6 +477,9 @@ def job(taskType):
if
social_code
==
None
or
social_code
==
'None'
:
log
.
info
(
'======已没有数据==========等待====='
)
time
.
sleep
(
20
)
if
baseCore
.
check_mysql_conn
(
cnx
):
cnx
=
baseCore
.
cnx
cursor
=
baseCore
.
cursor_
if
flag
==
0
:
continue
elif
flag
==
1
:
...
...
@@ -564,7 +569,7 @@ def job(taskType):
if
__name__
==
'__main__'
:
task_type
=
'财务数据/东方财富网'
job
(
task_type
)
job
(
task_type
,
cnx
,
cursor
)
comData/caiwushuju/财务数据采集说明.md
0 → 100644
浏览文件 @
06fc89ad
东方财富网财务数据 部署在224服务器
东方财富网财务数据 部署在224服务器
每个月定时采集一次
等待时期,添加连接数据库测试,如果连接断开,重新连接上
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论