forked from yxjxx/bonds_reminder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoday_data.py
28 lines (26 loc) · 1.28 KB
/
today_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from datetime import datetime
def today_subscribe_data(bond_subscribe_data):
now_subscribe_data = []
for data in bond_subscribe_data:
STARTDATE = data['STARTDATE'].split('T')[0] # 申购日期 <class 'str'> 2020-07-06T00:00:00
# STARTDATE = '2020-07-07' # 测试日期
STARTDATE = datetime.strptime(STARTDATE, '%Y-%m-%d').date() # 把获取的时间转换成<class 'datetime.datetime'>格式
now_date = datetime.now().date()
if STARTDATE != now_date:
continue
# print(data['SNAME']+"的打新时间为:"+STARTDATE)
now_subscribe_data.append(data)
# print("now_subscribe_data:", now_subscribe_data)
return now_subscribe_data
def today_winning_data(bond_winning_data):
now_winning_data = []
for data in bond_winning_data:
ZQHDATE = data['ZQHDATE'].split('T')[0] # 申购日期 <class 'str'> 2020-07-06T00:00:00
# ZQHDATE = '2020-07-07' # 测试日期
ZQHDATE = datetime.strptime(ZQHDATE, '%Y-%m-%d').date() # 把获取的时间转换成<class 'datetime.datetime'>格式
now_date = datetime.now().date()
if ZQHDATE != now_date:
continue
now_winning_data.append(data)
# print("now_winning_data:", now_winning_data)
return now_winning_data