PriceForecast/aisenzhecode/沥青/沥青定性模型每日推送-ytj.ipynb

1089 lines
31 KiB
Plaintext
Raw Normal View History

2024-11-01 17:33:48 +08:00
{
"cells": [
{
"cell_type": "code",
2025-01-03 09:32:07 +08:00
"execution_count": 9,
2024-11-01 17:33:48 +08:00
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import json\n",
"import xlrd\n",
"import xlwt\n",
"from datetime import datetime, timedelta \n",
"import time\n",
"import pandas as pd\n",
"import numpy as np\n",
"# 变量定义\n",
"login_url = \"http://10.200.32.39/jingbo-api/api/server/login\"\n",
"search_url = \"http://10.200.32.39/jingbo-api/api/warehouse/dwDataItem/queryByItemNos\"\n",
"\n",
"login_push_url = \"http://10.200.32.39/jingbo-api/api/server/login\"\n",
"upload_url = \"http://10.200.32.39/jingbo-api/api/dw/dataValue/pushDataValueList\"\n",
"\n",
"login_data = {\n",
" \"data\": {\n",
" \"account\": \"api_dev\",\n",
" \"password\": \"ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=\",\n",
" \"tenantHashCode\": \"8a4577dbd919675758d57999a1e891fe\",\n",
" \"terminal\": \"API\"\n",
" },\n",
" \"funcModule\": \"API\",\n",
" \"funcOperation\": \"获取token\"\n",
"}\n",
"\n",
"login_push_data = {\n",
" \"data\": {\n",
" \"account\": \"api_dev\",\n",
" \"password\": \"ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=\",\n",
" \"tenantHashCode\": \"8a4577dbd919675758d57999a1e891fe\",\n",
" \"terminal\": \"API\"\n",
" },\n",
" \"funcModule\": \"API\",\n",
" \"funcOperation\": \"获取token\"\n",
"}\n",
"\n",
"read_file_path_name = \"定性模型数据项12-11.xls\"\n",
"one_cols = []\n",
"two_cols = []\n",
"\n",
"\n",
"\n",
"\n",
"def start(date=''):\n",
" workbook = xlrd.open_workbook(read_file_path_name)\n",
"\n",
"\n",
"\n",
" # 选择第一个表格\n",
" sheet = workbook.sheet_by_index(0)\n",
"\n",
" # 获取行数和列数\n",
" num_rows = sheet.nrows\n",
"\n",
"\n",
"\n",
" row_data = sheet.row_values(1)\n",
" one_cols = row_data\n",
"\n",
"\n",
" login_res = requests.post(url=login_url, json=login_data, timeout=(3, 5))\n",
" text = json.loads(login_res.text)\n",
" if text[\"status\"]:\n",
" token = text[\"data\"][\"accessToken\"]\n",
" else:\n",
" print(\"获取认证失败\")\n",
" token = None\n",
"\n",
" if date == '':\n",
" now = datetime.now()\n",
" else:\n",
" now = date\n",
" year = now.year\n",
" month = now.month\n",
" day = now.day\n",
"\n",
" if month < 10:\n",
" month = \"0\" + str(month)\n",
" if day < 10:\n",
" day = \"0\" + str(day)\n",
" cur_time = str(year) + str(month) + str(day)\n",
" cur_time2 = str(year) + \"-\" + str(month) + \"-\" + str(day)\n",
" search_data = {\n",
" \"data\": {\n",
" \"date\": cur_time,\n",
" \"dataItemNoList\": one_cols[1:]\n",
" },\n",
" \"funcModule\": \"数据项\",\n",
" \"funcOperation\": \"查询\"\n",
" }\n",
" headers = {\"Authorization\": token}\n",
" search_res = requests.post(url=search_url, headers=headers, json=search_data, timeout=(3, 5))\n",
" search_value = json.loads(search_res.text)[\"data\"]\n",
"# datas = search_value\n",
" if search_value:\n",
" datas = search_value\n",
" else :\n",
" datas = None\n",
" \n",
"\n",
" append_rows = [cur_time2]\n",
" dataItemNo_dataValue = {}\n",
"# for data_value in datas:\n",
"# dataItemNo_dataValue[data_value[\"dataItemNo\"]] = data_value[\"dataValue\"]\n",
" for data_value in datas:\n",
" if \"dataValue\" not in data_value:\n",
" print(data_value)\n",
" dataItemNo_dataValue[data_value[\"dataItemNo\"]] = \"\"\n",
" else:\n",
" dataItemNo_dataValue[data_value[\"dataItemNo\"]] = data_value[\"dataValue\"]\n",
" for value in one_cols[1:]:\n",
" if value in dataItemNo_dataValue:\n",
" append_rows.append(dataItemNo_dataValue[value])\n",
" else:\n",
" append_rows.append(\"\")\n",
"\n",
" workbook = xlrd.open_workbook('定性模型数据项12-11.xls')\n",
"\n",
" # 获取所有sheet的个数\n",
" sheet_count = len(workbook.sheet_names())\n",
"\n",
" # 获取所有sheet的名称\n",
" sheet_names = workbook.sheet_names()\n",
"\n",
" new_workbook = xlwt.Workbook()\n",
" for i in range(sheet_count):\n",
" # 获取当前sheet\n",
" sheet = workbook.sheet_by_index(i)\n",
"\n",
" # 获取sheet的行数和列数\n",
" row_count = sheet.nrows\n",
" col_count = sheet.ncols\n",
" # 获取原有数据\n",
" data = []\n",
" for row in range(row_count):\n",
" row_data = []\n",
" for col in range(col_count):\n",
" row_data.append(sheet.cell_value(row, col))\n",
" data.append(row_data)\n",
" # 创建xlwt的Workbook对象\n",
" # 创建sheet\n",
" new_sheet = new_workbook.add_sheet(sheet_names[i])\n",
"\n",
" # 将原有的数据写入新的sheet\n",
" for row in range(row_count):\n",
" for col in range(col_count):\n",
" new_sheet.write(row, col, data[row][col])\n",
"\n",
" if i == 0:\n",
" # 在新的sheet中添加数据\n",
" for col in range(col_count):\n",
" new_sheet.write(row_count, col, append_rows[col])\n",
"\n",
" # 保存新的xls文件\n",
" new_workbook.save(\"定性模型数据项12-11.xls\")\n",
"\n",
" df = pd.read_excel('定性模型数据项12-11.xls')\n",
" df=df.fillna(df.ffill())\n",
" df1 = df[-2:].reset_index()\n",
" if df1.loc[1,'70号沥青开工率'] > 0.3:\n",
" a = (df1.loc[1,'70号沥青开工率']-0.2)*5/0.1\n",
" else :\n",
" a = 0\n",
" b = df1.loc[1,'资金因素']\n",
" if df1.loc[1,'昨日计划提货偏差']>0:\n",
" c = df1.loc[1,'昨日计划提货偏差']*10/2000\n",
" else :\n",
" c = df1.loc[1,'昨日计划提货偏差']*10/3000\n",
" d = df1.loc[1,'生产情况']\n",
" if df1.loc[1,'基质沥青库存']/265007 >0.8:\n",
" e = (df1.loc[1,'基质沥青库存'] - df1.loc[0,'基质沥青库存'])*10/-5000\n",
" else : \n",
" e = 0\n",
" f = df1.loc[1,'下游客户价格预期']\n",
" if abs(df1.loc[1,'即期成本'] - df1.loc[0,'即期成本'])>=100:\n",
" g = (df1.loc[1,'即期成本'] - df1.loc[0,'即期成本'])*50/100\n",
" else :\n",
" g = 0\n",
" h = df1.loc[1,'订单结构']\n",
" x = round(0.08*a+0*b+0.15*c+0.08*d +0.03*e +0.08*f +0.4*g+0.18*h+df1.loc[0,'京博指导价'],2)\n",
"\n",
" login_res1 = requests.post(url=login_push_url, json=login_push_data, timeout=(3, 5))\n",
" text1 = json.loads(login_res1.text)\n",
" token_push = text1[\"data\"][\"accessToken\"]\n",
"\n",
"\n",
" data1 = {\n",
" \"funcModule\": \"数据表信息列表\",\n",
" \"funcOperation\": \"新增\",\n",
" \"data\": [\n",
" {\"dataItemNo\": \"C01100036|Forecast_Price|DX|ACN\",\n",
" \"dataDate\": cur_time,\n",
" \"dataStatus\": \"add\",\n",
" \"dataValue\": x\n",
" }\n",
"\n",
" ]\n",
" }\n",
" headers1 = {\"Authorization\": token_push}\n",
2025-01-03 09:32:07 +08:00
" # res = requests.post(url=upload_url, headers=headers1, json=data1, timeout=(3, 5))\n",
2024-11-01 17:33:48 +08:00
" \n",
" \n",
" \n",
"def start_1():\n",
" workbook = xlrd.open_workbook(read_file_path_name)\n",
"\n",
"\n",
"\n",
" # 选择第一个表格\n",
" sheet = workbook.sheet_by_index(0)\n",
"\n",
" # 获取行数和列数\n",
" num_rows = sheet.nrows\n",
"\n",
"\n",
"\n",
" row_data = sheet.row_values(1)\n",
" one_cols = row_data\n",
"\n",
"\n",
" login_res = requests.post(url=login_url, json=login_data, timeout=(3, 5))\n",
" text = json.loads(login_res.text)\n",
" if text[\"status\"]:\n",
" token = text[\"data\"][\"accessToken\"]\n",
" else:\n",
" print(\"获取认证失败\")\n",
" token = None\n",
"\n",
"\n",
" now = datetime.now() - timedelta(days=1) \n",
" year = now.year\n",
" month = now.month\n",
" day = now.day\n",
"\n",
" if month < 10:\n",
" month = \"0\" + str(month)\n",
" if day < 10:\n",
" day = \"0\" + str(day)\n",
" cur_time = str(year) + str(month) + str(day)\n",
" cur_time2 = str(year) + \"-\" + str(month) + \"-\" + str(day)\n",
" search_data = {\n",
" \"data\": {\n",
" \"date\": cur_time,\n",
" \"dataItemNoList\": one_cols[1:]\n",
" },\n",
" \"funcModule\": \"数据项\",\n",
" \"funcOperation\": \"查询\"\n",
" }\n",
" headers = {\"Authorization\": token}\n",
" search_res = requests.post(url=search_url, headers=headers, json=search_data, timeout=(3, 5))\n",
" search_value = json.loads(search_res.text)[\"data\"]\n",
"# datas = search_value\n",
" if search_value:\n",
" datas = search_value\n",
" else :\n",
" datas = None\n",
" \n",
" \n",
"\n",
" append_rows = [cur_time2]\n",
" dataItemNo_dataValue = {}\n",
"# for data_value in datas:\n",
"# dataItemNo_dataValue[data_value[\"dataItemNo\"]] = data_value[\"dataValue\"]\n",
" for data_value in datas:\n",
" if \"dataValue\" not in data_value:\n",
" print(data_value)\n",
" dataItemNo_dataValue[data_value[\"dataItemNo\"]] = \"\"\n",
" else:\n",
" dataItemNo_dataValue[data_value[\"dataItemNo\"]] = data_value[\"dataValue\"]\n",
" for value in one_cols[1:]:\n",
" if value in dataItemNo_dataValue:\n",
" append_rows.append(dataItemNo_dataValue[value])\n",
" else:\n",
" append_rows.append(\"\")\n",
"\n",
" workbook = xlrd.open_workbook('定性模型数据项12-11.xls')\n",
"\n",
" # 获取所有sheet的个数\n",
" sheet_count = len(workbook.sheet_names())\n",
"\n",
" # 获取所有sheet的名称\n",
" sheet_names = workbook.sheet_names()\n",
"\n",
" new_workbook = xlwt.Workbook()\n",
" for i in range(sheet_count):\n",
" # 获取当前sheet\n",
" sheet = workbook.sheet_by_index(i)\n",
"\n",
" # 获取sheet的行数和列数\n",
" row_count = sheet.nrows - 1\n",
" col_count = sheet.ncols\n",
" # 获取原有数据\n",
" data = []\n",
" for row in range(row_count):\n",
" row_data = []\n",
" for col in range(col_count):\n",
" row_data.append(sheet.cell_value(row, col))\n",
" data.append(row_data)\n",
" # 创建xlwt的Workbook对象\n",
" # 创建sheet\n",
" new_sheet = new_workbook.add_sheet(sheet_names[i])\n",
"\n",
" # 将原有的数据写入新的sheet\n",
" for row in range(row_count):\n",
" for col in range(col_count):\n",
" new_sheet.write(row, col, data[row][col])\n",
"\n",
" if i == 0:\n",
" # 在新的sheet中添加数据\n",
" for col in range(col_count):\n",
" new_sheet.write(row_count, col, append_rows[col])\n",
"\n",
" # 保存新的xls文件\n",
" new_workbook.save(\"定性模型数据项12-11.xls\")\n",
"\n",
"\n",
"def start_2(date):\n",
" workbook = xlrd.open_workbook(read_file_path_name)\n",
"\n",
"\n",
"\n",
" # 选择第一个表格\n",
" sheet = workbook.sheet_by_index(0)\n",
"\n",
" # 获取行数和列数\n",
" num_rows = sheet.nrows\n",
"\n",
"\n",
"\n",
" row_data = sheet.row_values(1)\n",
" one_cols = row_data\n",
"\n",
"\n",
" login_res = requests.post(url=login_url, json=login_data, timeout=(3, 5))\n",
" text = json.loads(login_res.text)\n",
" if text[\"status\"]:\n",
" token = text[\"data\"][\"accessToken\"]\n",
" else:\n",
" print(\"获取认证失败\")\n",
" token = None\n",
"\n",
"\n",
" now = date\n",
" year = now.year\n",
" month = now.month\n",
" day = now.day\n",
"\n",
" if month < 10:\n",
" month = \"0\" + str(month)\n",
" if day < 10:\n",
" day = \"0\" + str(day)\n",
" cur_time = str(year) + str(month) + str(day)\n",
" cur_time2 = str(year) + \"-\" + str(month) + \"-\" + str(day)\n",
" search_data = {\n",
" \"data\": {\n",
" \"date\": cur_time,\n",
" \"dataItemNoList\": one_cols[1:]\n",
" },\n",
" \"funcModule\": \"数据项\",\n",
" \"funcOperation\": \"查询\"\n",
" }\n",
" headers = {\"Authorization\": token}\n",
" search_res = requests.post(url=search_url, headers=headers, json=search_data, timeout=(3, 5))\n",
" search_value = json.loads(search_res.text)[\"data\"]\n",
"# datas = search_value\n",
" if search_value:\n",
" datas = search_value\n",
" else :\n",
" datas = None\n",
" \n",
"\n",
" append_rows = [cur_time2]\n",
" dataItemNo_dataValue = {}\n",
"# for data_value in datas:\n",
"# dataItemNo_dataValue[data_value[\"dataItemNo\"]] = data_value[\"dataValue\"]\n",
" for data_value in datas:\n",
" if \"dataValue\" not in data_value:\n",
" print(data_value)\n",
" dataItemNo_dataValue[data_value[\"dataItemNo\"]] = \"\"\n",
" else:\n",
" dataItemNo_dataValue[data_value[\"dataItemNo\"]] = data_value[\"dataValue\"]\n",
" for value in one_cols[1:]:\n",
" if value in dataItemNo_dataValue:\n",
" append_rows.append(dataItemNo_dataValue[value])\n",
" else:\n",
" append_rows.append(\"\")\n",
"\n",
" workbook = xlrd.open_workbook('定性模型数据项12-11.xls')\n",
"\n",
" # 获取所有sheet的个数\n",
" sheet_count = len(workbook.sheet_names())\n",
"\n",
" # 获取所有sheet的名称\n",
" sheet_names = workbook.sheet_names()\n",
"\n",
" new_workbook = xlwt.Workbook()\n",
" for i in range(sheet_count):\n",
" # 获取当前sheet\n",
" sheet = workbook.sheet_by_index(i)\n",
"\n",
" # 获取sheet的行数和列数\n",
" row_count = sheet.nrows\n",
" col_count = sheet.ncols\n",
" # 获取原有数据\n",
" data = []\n",
" for row in range(row_count):\n",
" row_data = []\n",
" for col in range(col_count):\n",
" row_data.append(sheet.cell_value(row, col))\n",
" data.append(row_data)\n",
" # 创建xlwt的Workbook对象\n",
" # 创建sheet\n",
" new_sheet = new_workbook.add_sheet(sheet_names[i])\n",
"\n",
" # 将原有的数据写入新的sheet\n",
" for row in range(row_count):\n",
" for col in range(col_count):\n",
" new_sheet.write(row, col, data[row][col])\n",
"\n",
" if i == 0:\n",
" # 在新的sheet中添加数据\n",
" for col in range(col_count):\n",
" new_sheet.write(row_count, col, append_rows[col])\n",
"\n",
" # 保存新的xls文件\n",
" new_workbook.save(\"定性模型数据项12-11.xls\")\n",
" print('关闭文件')\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"if __name__ == \"__main__\":\n",
" pass\n",
" # 需要单独运行放开\n",
" \n",
" # start_1()\n",
"\n",
" # 每天定时12点运行\n",
" # while True:\n",
" # # 获取当前时间\n",
" # current_time = time.strftime(\"%H:%M:%S\", time.localtime())\n",
" # current_time_1 = time.strftime(\"%H:%M:%S\", time.localtime())\n",
"\n",
" # # 判断当前时间是否为执行任务的时间点\n",
" # if current_time == \"12:00:00\":\n",
" # print(\"执行定时任务\")\n",
" # start()\n",
"\n",
" # # 休眠1秒钟避免过多占用CPU资源\n",
" # time.sleep(1)\n",
" \n",
" # elif current_time_1 == \"20:00:00\":\n",
" # print(\"更新数据\")\n",
" # start_1()\n",
" # time.sleep(1)\n",
"\n"
]
},
{
"cell_type": "code",
2025-01-03 09:32:07 +08:00
"execution_count": 11,
2024-11-01 17:33:48 +08:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2025-01-03 09:32:07 +08:00
"20230803\n",
"20230804\n",
"20230805\n",
"20230806\n",
"20230807\n",
"20230808\n",
"20230809\n",
"20230810\n",
"20230811\n",
"20230812\n",
"20230813\n",
"20230814\n",
"20230815\n",
"20230816\n",
"20230817\n",
"20230818\n",
"20230819\n",
"20230820\n",
"20230821\n",
"20230822\n",
"20230823\n",
"20230824\n",
"20230825\n",
"20230826\n",
"20230827\n",
"20230828\n",
"20230829\n",
"20230830\n",
"20230831\n",
"20230901\n",
"20230902\n",
"20230903\n",
"20230904\n",
"20230905\n",
"20230906\n",
"20230907\n",
"20230908\n",
"20230909\n",
"20230910\n",
"20230911\n",
"20230912\n",
"20230913\n",
"20230914\n",
"20230915\n",
"20230916\n",
"20230917\n",
"20230918\n",
"20230919\n",
"20230920\n",
"20230921\n",
"20230922\n",
"20230923\n",
"20230924\n",
"20230925\n",
"20230926\n",
"20230927\n",
"20230928\n",
"20230929\n",
"20230930\n",
"20231001\n",
"20231002\n",
"20231003\n",
"20231004\n",
"20231005\n",
"20231006\n",
"20231007\n",
"20231008\n",
"20231009\n",
"20231010\n",
"20231011\n",
"20231012\n",
"20231013\n",
"20231014\n",
"20231015\n",
"20231016\n",
"20231017\n",
"20231018\n",
"20231019\n",
"20231020\n",
"20231021\n",
"20231022\n",
"20231023\n",
"20231024\n",
"20231025\n",
"20231026\n",
"20231027\n",
"20231028\n",
"20231029\n",
"20231030\n",
"20231031\n",
"20231101\n",
"20231102\n",
"20231103\n",
"20231104\n",
"20231105\n",
"20231106\n",
"20231107\n",
"20231108\n",
"20231109\n",
"20231110\n",
"20231111\n",
"20231112\n",
"20231113\n",
"20231114\n",
"20231115\n",
"20231116\n",
"20231117\n",
"20231118\n",
"20231119\n",
"20231120\n",
"20231121\n",
"20231122\n",
"20231123\n",
"20231124\n",
"20231125\n",
"20231126\n",
"20231127\n",
"20231128\n",
"20231129\n",
"20231130\n",
"20231201\n",
"20231202\n",
"20231203\n",
"20231204\n",
"20231205\n",
"20231206\n",
"20231207\n",
"20231208\n",
"20231209\n",
"20231210\n",
"20231211\n",
"20231212\n",
"20231213\n",
"{'dataDate': '20231213', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20231213', 'dataItemNo': 'SDHYSCQK'}\n",
"{'dataDate': '20231213', 'dataItemNo': 'SDHYZJYS'}\n",
"20231214\n",
"20231215\n",
"20231216\n",
"20231217\n",
"20231218\n",
"20231219\n",
"20231220\n",
"{'dataDate': '20231220', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20231220', 'dataItemNo': 'SDHYSCQK'}\n",
"{'dataDate': '20231220', 'dataItemNo': 'SDHYZJYS'}\n",
"20231221\n",
"20231222\n",
"20231223\n",
"20231224\n",
"20231225\n",
"20231226\n",
"20231227\n",
"{'dataDate': '20231227', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20231227', 'dataItemNo': 'SDHYSCQK'}\n",
"{'dataDate': '20231227', 'dataItemNo': 'SDHYZJYS'}\n",
"20231228\n",
"20231229\n",
"20231230\n",
"20231231\n",
"20240101\n",
"20240102\n",
"20240103\n",
"{'dataDate': '20240103', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240103', 'dataItemNo': 'SDHYSCQK'}\n",
"{'dataDate': '20240103', 'dataItemNo': 'SDHYZJYS'}\n",
"20240104\n",
"20240105\n",
"20240106\n",
"20240107\n",
"20240108\n",
"20240109\n",
"20240110\n",
"{'dataDate': '20240110', 'dataItemNo': 'SDHYDDJG'}\n",
"20240111\n",
"20240112\n",
"20240113\n",
"20240114\n",
"20240115\n",
"20240116\n",
"20240117\n",
"{'dataDate': '20240117', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240117', 'dataItemNo': 'SDHYSCQK'}\n",
"20240118\n",
"20240119\n",
"20240120\n",
"20240121\n",
"20240122\n",
"20240123\n",
"20240124\n",
"{'dataDate': '20240124', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240124', 'dataItemNo': 'SDHYSCQK'}\n",
"20240125\n",
"20240126\n",
"20240127\n",
"20240128\n",
"20240129\n",
"20240130\n",
"20240131\n",
"{'dataDate': '20240131', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240131', 'dataItemNo': 'SDHYSCQK'}\n",
"20240201\n",
"20240202\n",
"20240203\n",
"20240204\n",
"20240205\n",
"20240206\n",
"20240207\n",
"{'dataDate': '20240207', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240207', 'dataItemNo': 'SDHYSCQK'}\n",
"20240208\n",
"20240209\n",
"20240210\n",
"20240211\n",
"20240212\n",
"20240213\n",
"20240214\n",
"{'dataDate': '20240214', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240214', 'dataItemNo': 'SDHYSCQK'}\n",
"20240215\n",
"20240216\n",
"20240217\n",
"20240218\n",
"20240219\n",
"20240220\n",
"20240221\n",
"20240222\n",
"20240223\n",
"20240224\n",
"20240225\n",
"20240226\n",
"20240227\n",
"20240228\n",
"20240229\n",
"20240301\n",
"20240302\n",
"20240303\n",
"20240304\n",
"20240305\n",
"20240306\n",
"{'dataDate': '20240306', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240306', 'dataItemNo': 'SDHYSCQK'}\n",
"20240307\n",
"20240308\n",
"20240309\n",
"20240310\n",
"20240311\n",
"20240312\n",
"20240313\n",
"{'dataDate': '20240313', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240313', 'dataItemNo': 'SDHYSCQK'}\n",
"20240314\n",
"20240315\n",
"20240316\n",
"20240317\n",
"20240318\n",
"20240319\n",
"20240320\n",
"{'dataDate': '20240320', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240320', 'dataItemNo': 'SDHYSCQK'}\n",
"20240321\n",
"20240322\n",
"20240323\n",
"20240324\n",
"20240325\n",
"20240326\n",
"20240327\n",
"{'dataDate': '20240327', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240327', 'dataItemNo': 'SDHYSCQK'}\n",
"20240328\n",
"20240329\n",
"20240330\n",
"20240331\n",
"20240401\n",
"20240402\n",
"20240403\n",
"{'dataDate': '20240403', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240403', 'dataItemNo': 'SDHYSCQK'}\n",
"20240404\n",
"20240405\n",
"20240406\n",
"20240407\n",
"20240408\n",
"20240409\n",
"20240410\n",
"{'dataDate': '20240410', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240410', 'dataItemNo': 'SDHYSCQK'}\n",
"20240411\n",
"20240412\n",
"20240413\n",
"20240414\n",
"20240415\n",
"20240416\n",
"20240417\n",
"{'dataDate': '20240417', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240417', 'dataItemNo': 'SDHYSCQK'}\n",
"20240418\n",
"20240419\n",
"20240420\n",
"20240421\n",
"20240422\n",
"20240423\n",
"20240424\n",
"{'dataDate': '20240424', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240424', 'dataItemNo': 'SDHYSCQK'}\n",
"20240425\n",
"20240426\n",
"20240427\n",
"20240428\n",
"20240429\n",
"20240430\n",
"20240501\n",
"{'dataDate': '20240501', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240501', 'dataItemNo': 'SDHYSCQK'}\n",
"20240502\n",
"20240503\n",
"20240504\n",
"20240505\n",
"20240506\n",
"20240507\n",
"20240508\n",
"20240509\n",
"20240510\n",
"20240511\n",
"20240512\n",
"20240513\n",
"20240514\n",
"20240515\n",
"20240516\n",
"20240517\n",
"20240518\n",
"20240519\n",
"20240520\n",
"20240521\n",
"20240522\n",
"20240523\n",
"20240524\n",
"20240525\n",
"20240526\n",
"20240527\n",
"20240528\n",
"20240529\n",
"20240530\n",
"20240531\n",
"20240601\n",
"20240602\n",
"20240603\n",
"20240604\n",
"20240605\n",
"{'dataDate': '20240605', 'dataItemNo': 'SDHYDDJG'}\n",
"{'dataDate': '20240605', 'dataItemNo': 'SDHYSCQK'}\n",
"20240606\n",
"20240607\n",
"20240608\n",
"20240609\n",
"20240610\n",
"20240611\n",
"20240612\n",
"20240613\n",
"20240614\n",
"20240615\n",
"20240616\n",
"20240617\n",
"20240618\n",
"20240619\n",
"20240620\n",
"20240621\n",
"20240622\n",
"20240623\n",
"20240624\n",
"20240625\n",
"20240626\n",
"20240627\n",
"20240628\n",
"20240629\n",
"20240630\n",
"20240701\n",
"20240702\n",
"20240703\n",
"20240704\n",
"20240705\n",
"20240706\n",
"20240707\n",
"20240708\n",
"20240709\n",
"20240710\n",
"20240711\n",
"20240712\n",
"20240713\n",
"20240714\n",
"20240715\n",
"20240716\n",
"20240717\n",
"20240718\n",
"20240719\n",
"20240720\n",
"20240721\n",
"20240722\n",
"20240723\n",
"20240724\n",
"20240725\n",
"20240726\n",
"20240727\n",
"20240728\n",
"20240729\n",
"20240730\n",
"20240731\n",
"20240801\n",
"20240802\n",
"20240803\n",
"20240804\n",
"20240805\n",
"20240806\n",
"20240807\n",
"20240808\n",
"20240809\n",
"20240810\n",
"20240811\n",
"20240812\n",
"20240813\n",
"20240814\n",
"20240815\n",
"20240816\n",
"20240817\n",
"20240818\n",
"20240819\n",
"20240820\n",
"20240821\n",
"20240822\n",
"20240823\n",
"20240824\n",
"20240825\n",
"20240826\n",
"20240827\n",
"20240828\n",
"20240829\n",
"20240830\n",
"20240831\n",
"20240901\n",
"20240902\n",
"20240903\n",
"20240904\n",
"20240905\n",
"20240906\n",
"20240907\n",
"20240908\n",
"20240909\n",
"20240910\n",
"20240911\n",
"20240912\n",
"20240913\n",
"20240914\n",
"20240915\n",
"20240916\n",
"20240917\n",
"20240918\n",
"20240919\n",
"20240920\n",
"20240921\n",
"20240922\n",
"20240923\n",
"20240924\n",
"20240925\n",
"20240926\n",
"20240927\n",
"20240928\n",
"20240929\n",
"20240930\n",
"20241001\n",
"20241002\n",
"20241003\n",
"20241004\n",
"20241005\n",
"20241006\n",
"20241007\n",
"20241008\n",
"20241009\n",
"20241010\n",
"20241011\n",
"20241012\n",
"20241013\n",
"20241014\n",
"20241015\n",
"20241016\n",
"20241017\n",
"20241018\n",
"20241019\n",
"20241020\n",
"20241021\n",
"20241022\n",
"20241023\n",
"20241024\n",
"20241025\n",
"20241026\n",
"20241027\n",
"20241028\n",
"20241029\n",
"20241030\n",
"20241031\n",
"20241101\n",
"20241102\n",
"20241103\n",
"20241104\n",
"20241105\n",
"20241106\n",
"20241107\n",
"20241108\n",
"20241109\n",
"20241110\n",
"20241111\n",
"20241112\n",
"20241113\n",
"20241114\n",
"20241115\n",
"20241116\n",
"20241117\n",
"20241118\n",
"20241119\n",
"20241120\n",
"20241121\n",
"20241122\n",
"20241123\n",
"20241124\n",
"20241125\n",
"20241126\n",
"20241127\n",
"20241128\n",
"20241129\n",
"20241130\n",
"20241201\n",
"20241202\n",
"20241203\n",
"20241204\n",
"20241205\n",
"20241206\n",
"20241207\n",
"20241208\n",
"20241209\n",
"20241210\n",
"20241211\n",
"20241212\n",
"20241213\n",
"20241214\n",
"20241215\n",
"20241216\n",
"20241217\n",
"20241218\n",
"20241219\n",
"20241220\n",
"20241221\n",
"20241222\n",
"20241223\n",
2024-12-27 14:15:20 +08:00
"20241224\n",
2025-01-03 09:32:07 +08:00
"20241225\n",
"20241226\n",
"20241227\n",
"20241228\n",
"20241229\n",
"20241230\n",
"20241231\n",
"20250101\n"
2024-11-01 17:33:48 +08:00
]
}
],
"source": [
"from datetime import datetime, timedelta\n",
"\n",
2025-01-03 09:32:07 +08:00
"start_date = datetime(2023, 8, 3)\n",
"end_date = datetime(2025, 1, 2)\n",
2024-11-01 17:33:48 +08:00
"\n",
"while start_date < end_date:\n",
" print(start_date.strftime('%Y%m%d'))\n",
" start(start_date)\n",
2025-01-03 09:32:07 +08:00
" # start_1(start_date)\n",
2024-11-01 17:33:48 +08:00
" start_date += timedelta(days=1)\n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}