Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
45ef43f4
提交
45ef43f4
authored
8月 26, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
东方财富网财务数据
上级
0a29619f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
20 行删除
+25
-20
东方财富网财务数据.py
comData/caiwushuju/东方财富网财务数据.py
+25
-20
没有找到文件。
comData/caiwushuju/东方财富网财务数据.py
浏览文件 @
45ef43f4
"""
"""
...
...
@@ -27,7 +27,7 @@ def check_code(com_code):
def
check_date
(
com_code
,
info_date
):
r
=
redis
.
Redis
(
host
=
"114.115.236.206"
,
port
=
6379
,
password
=
'clbzzsn'
,
db
=
3
)
res
=
r
.
sismember
(
'com_caiwushuju_
dat
e::'
+
com_code
,
info_date
)
# 注意是 保存set的方式
res
=
r
.
sismember
(
'com_caiwushuju_
cod
e::'
+
com_code
,
info_date
)
# 注意是 保存set的方式
if
res
:
return
True
else
:
...
...
@@ -437,15 +437,16 @@ def getReportTime():
# timeNow = baseCore.getNowTime(1)[:10]
list_date
=
[]
# 2023-04-01
#todo:正式任务
# 获取当前日期和时间
current_date
=
datetime
.
now
()
#
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
)
year
=
int
(
current_date
.
strftime
(
'
%
Y'
))
#
list_date = ['2023-03-31']
#
report_date = yesterday.strftime('%Y-%m-%d')
#
list_date.append(report_date)
#
year = int(current_date.strftime('%Y'))
list_date
=
[
'2023-03-31'
]
list_month
=
[
'-12-31'
,
'-09-30'
,
'-06-30'
,
'-03-31'
]
for
year
in
range
(
2022
,
2018
,
-
1
):
...
...
@@ -459,7 +460,8 @@ def job(taskType):
# 需要提供股票代码、企业信用代码
while
True
:
#从redis中获取企业信用代码
social_code
=
baseCore
.
redicPullData
(
'FinanceFromEast:finance_socialCode'
)
social_code
=
baseCore
.
redicPullData
(
'FinanceFromEast:eastfinance_socialCode'
)
# social_code = '91100000100003962T'
# 判断 如果Redis中已经没有数据,则等待
if
social_code
==
None
:
time
.
sleep
(
20
)
...
...
@@ -468,8 +470,12 @@ def job(taskType):
sql_sel
=
f
'''select securities_code,exchange from sys_base_enterprise_ipo where category = '1' and social_credit_code='{social_code}' '''
cursor
.
execute
(
sql_sel
)
row
=
cursor
.
fetchone
()
securities_code
=
row
[
0
]
try
:
securities_code
=
row
[
0
]
pass
except
:
log
.
info
(
f
'======{social_code}没有股票代码======'
)
continue
exchange
=
row
[
1
]
# for code in list_code:
# social_code = rows[0]
...
...
@@ -510,18 +516,17 @@ def job(taskType):
time
.
sleep
(
1
)
print
(
res_baocun
.
text
)
for
nnn
in
range
(
0
,
3
):
try
:
add_date
(
com_code
,
date_list
)
break
except
:
time
.
sleep
(
1
)
if
len
(
info_date_list
)
!=
0
:
for
date
in
info_date_list
:
date_list
.
append
(
date
)
print
(
date_list
)
date_list
=
str
(
date_list
)
for
nnn
in
range
(
0
,
3
):
try
:
add_date
(
com_code
,
date_list
)
break
except
:
time
.
sleep
(
1
)
# date_list = str(date_list)
end_time
=
time
.
time
()
log
.
info
(
f
'===={com_code}====该企业耗时{end_time-start_time}==='
)
cnx
.
close
()
...
...
@@ -529,7 +534,7 @@ def job(taskType):
baseCore
.
close
()
if
__name__
==
'__main__'
:
task_type
=
'财务数据/东方财富网'
task_type
=
'财务数据/东方财富网
/福布斯
'
job
(
task_type
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论