预生产数据库配置

This commit is contained in:
workpc 2024-12-11 14:52:45 +08:00
parent 1814182299
commit abd8b25914
6 changed files with 281 additions and 849 deletions

View File

@ -706,8 +706,36 @@ edbcodelist = ['CO1 Comdty', 'ovx index', 'C2404194834', 'C2404199738', 'dxy cur
# 'S5131019','ID00135604','FSGAM1 Index','S5120408','ID00136724', # 新加坡汽柴油 # 'S5131019','ID00135604','FSGAM1 Index','S5120408','ID00136724', # 新加坡汽柴油
] ]
# eta自有数据指标编码
modelsindex = {
'NHITS': 'SELF0000001',
'Informer':'SELF0000057',
'LSTM':'SELF0000058',
'iTransformer':'SELF0000059',
'TSMixer':'SELF0000060',
'TSMixerx':'SELF0000061',
'PatchTST':'SELF0000062',
'RNN':'SELF0000063',
'GRU':'SELF0000064',
'TCN':'SELF0000065',
'BiTCN':'SELF0000066',
'DilatedRNN':'SELF0000067',
'MLP':'SELF0000068',
'DLinear':'SELF0000069',
'NLinear':'SELF0000070',
'TFT':'SELF0000071',
'FEDformer':'SELF0000072',
'StemGNN':'SELF0000073',
'MLPMultivariate':'SELF0000074',
'TiDE':'SELF0000075',
'DeepNPTS':'SELF0000076'
}
edbcodelist = edbcodelist+list(modelsindex.values())
### 文件 ### 文件
data_set = '原油指标数据.xlsx' # 数据集文件 data_set = '历史预测结果.xlsx' # 数据集文件
# data_set = 'INE_OIL(1).csv' # data_set = 'INE_OIL(1).csv'
### 文件夹 ### 文件夹
dataset = 'yuanyoudataset' # 数据集文件夹 dataset = 'yuanyoudataset' # 数据集文件夹

View File

@ -90,54 +90,86 @@ data = {
ClassifyId = 1214 ClassifyId = 1214
### 报告上传配置 ################################################################################################################ 变量定义--线上环境
# 变量定义--线上环境 login_pushreport_url = "http://10.200.32.39/jingbo-api/api/server/login"
# login_pushreport_url = "http://10.200.32.39/jingbo-api/api/server/login" upload_url = "http://10.200.32.39/jingbo-api/api/analysis/reportInfo/researchUploadReportSave"
# upload_url = "http://10.200.32.39/jingbo-api/api/analysis/reportInfo/researchUploadReportSave" upload_warning_url = "http://10.200.32.39/jingbo-api/api/basicBuiness/crudeOilWarning/save"
# upload_warning_url = "http://10.200.32.39/jingbo-api/api/basicBuiness/crudeOilWarning/save"
# login_data = { login_data = {
# "data": { "data": {
# "account": "api_dev", "account": "api_dev",
# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=",
# "tenantHashCode": "8a4577dbd919675758d57999a1e891fe", "tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
# "terminal": "API" "terminal": "API"
# }, },
# "funcModule": "API", "funcModule": "API",
# "funcOperation": "获取token" "funcOperation": "获取token"
# } }
# upload_data = { upload_data = {
# "funcModule":'研究报告信息', "funcModule":'研究报告信息',
# "funcOperation":'上传原油价格预测报告', "funcOperation":'上传原油价格预测报告',
# "data":{ "data":{
# "ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋 "ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋
# "reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST "reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST
# "fileName": '', #文件名称 "fileName": '', #文件名称
# "fileBase64": '' ,#文件内容base64 "fileBase64": '' ,#文件内容base64
# "categoryNo":'yyjgycbg', # 研究报告分类编码 "categoryNo":'yyjgycbg', # 研究报告分类编码
# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码 "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
# "reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋 "reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋
# "reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部 "reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部
# "productGroupCode":"RAW_MATERIAL" # 商品分类 "productGroupCode":"RAW_MATERIAL" # 商品分类
# } }
# } }
# warning_data = { warning_data = {
# "funcModule":'原油特征停更预警', "funcModule":'原油特征停更预警',
# "funcOperation":'原油特征停更预警', "funcOperation":'原油特征停更预警',
# "data":{ "data":{
# 'WARNING_TYPE_NAME':'特征数据停更预警', 'WARNING_TYPE_NAME':'特征数据停更预警',
# 'WARNING_CONTENT':'', 'WARNING_CONTENT':'',
# 'WARNING_DATE':'' 'WARNING_DATE':''
# } }
# } }
# 生产环境数据库
# url: jdbc:mysql://rm-2zehj3r1n60ttz9x5.mysql.rds.aliyuncs.com:3306/jingbo?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&useSSL=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
# username: jingbo
# password: shihua@123
# table-schema: jingbo
# host = 'rm-2zehj3r1n60ttz9x5.mysql.rds.aliyuncs.com'
# port = 3306
# dbusername ='jingbo'
# password = 'shihua@123'
# dbname = 'jingbo'
# table_name = 'v_tbl_crude_oil_warning'
# 预生产环境
# host = 'rm-2zehj3r1n60ttz9x5ko.mysql.rds.aliyuncs.com'
# port = 3306
# dbusername ='jingbo'
# password = 'shihua@123'
# dbname = 'jingbo-test'
# table_name = 'v_tbl_crude_oil_warning'
# # 变量定义--测试环境 ### 线上开关
# is_train = True # 是否训练
# is_debug = False # 是否调试
# is_eta = True # 是否使用eta接口
# is_timefurture = True # 是否使用时间特征
# is_fivemodels = False # 是否使用之前保存的最佳的5个模型
# is_edbcode = False # 特征使用edbcoding列表中的
# is_edbnamelist = False # 自定义特征对应上面的edbnamelist
# is_update_eta = True # 预测结果上传到eta
# is_update_report = True # 是否上传报告
# is_update_warning_data = True if datetime.datetime.now().weekday() == 1 else False # 是否上传预警数据
################################################################################################################ 变量定义--测试环境
login_pushreport_url = "http://192.168.100.53:8080/jingbo-dev/api/server/login" login_pushreport_url = "http://192.168.100.53:8080/jingbo-dev/api/server/login"
upload_url = "http://192.168.100.53:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" upload_url = "http://192.168.100.53:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave"
# upload_url = "http://192.168.100.109:8080/jingbo/api/analysis/reportInfo/researchUploadReportSave" # zhaoqiwei # upload_url = "http://192.168.100.109:8080/jingbo/api/analysis/reportInfo/researchUploadReportSave" # zhaoqiwei
@ -182,17 +214,13 @@ warning_data = {
} }
} }
### 线上开关 # 北京环境数据库
# is_train = True # 是否训练 host = '192.168.101.27'
# is_debug = False # 是否调试 port = 3306
# is_eta = True # 是否使用eta接口 dbusername ='root'
# is_timefurture = True # 是否使用时间特征 password = '123456'
# is_fivemodels = False # 是否使用之前保存的最佳的5个模型 dbname = 'jingbo_test'
# is_edbcode = False # 特征使用edbcoding列表中的 table_name = 'v_tbl_crude_oil_warning'
# is_edbnamelist = False # 自定义特征对应上面的edbnamelist
# is_update_eta = True # 预测结果上传到eta
# is_update_report = True # 是否上传报告
# is_update_warning_data = True if datetime.datetime.now().weekday() == 1 else False # 是否上传预警数据
### 开关 ### 开关
@ -204,28 +232,19 @@ is_fivemodels = False # 是否使用之前保存的最佳的5个模型
is_edbcode = False # 特征使用edbcoding列表中的 is_edbcode = False # 特征使用edbcoding列表中的
is_edbnamelist = False # 自定义特征对应上面的edbnamelist is_edbnamelist = False # 自定义特征对应上面的edbnamelist
is_update_eta = False # 预测结果上传到eta is_update_eta = False # 预测结果上传到eta
is_update_report = False # 是否上传报告 is_update_report = True # 是否上传报告
is_update_warning_data = False # 是否上传预警数据 is_update_warning_data = True # 是否上传预警数据
### 北京环境数据库jbsh_test
# url: jdbc:mysql://192.168.101.27:3306/jingbo_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&useSSL=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
host = '192.168.101.27'
port = 3306
dbusername ='root'
password = '123456'
dbname = 'jingbo_test'
table_name = 'v_tbl_crude_oil_warning'
db_mysql = MySQLDB(host=host, user=dbusername, password=password, database=dbname)
# 连接到数据库 # 连接到数据库
db_mysql = MySQLDB(host=host, user=dbusername, password=password, database=dbname)
db_mysql.connect() db_mysql.connect()
print("数据库连接成功",host,dbname,dbusername)
# 数据截取日期 # 数据截取日期
start_year = 2000 # 数据开始年份 start_year = 2018 # 数据开始年份
end_time = '2024-11-23' # 数据截取日期 end_time = '' # 数据截取日期
freq = 'B' # 时间频率,"D": 天 "W": 周"M": 月"Q": 季度"A": 年 "H": 小时 "T": 分钟 "S": 秒 "B": 工作日 freq = 'B' # 时间频率,"D": 天 "W": 周"M": 月"Q": 季度"A": 年 "H": 小时 "T": 分钟 "S": 秒 "B": 工作日
delweekenday = True if freq == 'B' else False # 是否删除周末数据 delweekenday = True if freq == 'B' else False # 是否删除周末数据
is_corr = False # 特征是否参与滞后领先提升相关系数 is_corr = False # 特征是否参与滞后领先提升相关系数

View File

@ -259,7 +259,7 @@ def upload_warning_info(df_count):
# 更新预警数据中的日期和内容 # 更新预警数据中的日期和内容
warning_data['data']['WARNING_DATE'] = warning_date warning_data['data']['WARNING_DATE'] = warning_date
warning_data['data']['WARNING_CONTENT'] = content + '2' warning_data['data']['WARNING_CONTENT'] = content
# 调用 upload_warning_data 函数上传预警数据 # 调用 upload_warning_data 函数上传预警数据
upload_warning_data(warning_data) upload_warning_data(warning_data)

View File

@ -109,37 +109,38 @@ def predict_main():
import datetime import datetime
# 判断当前日期是不是周一 # 判断当前日期是不是周一
is_weekday = datetime.datetime.now().weekday() == 0 is_weekday = datetime.datetime.now().weekday() == 0
# if is_weekday: if is_weekday:
# logger.info('今天是周一,更新预测模型') logger.info('今天是周一,更新预测模型')
# # 计算最近60天预测残差最低的模型名称 # 计算最近60天预测残差最低的模型名称
# model_results = sqlitedb.select_data('trueandpredict', order_by="ds DESC", limit="60") model_results = sqlitedb.select_data('trueandpredict', order_by="ds DESC", limit="60")
# # 删除空值率为40%以上的列 # 删除空值率为40%以上的列
# if len(model_results) > 10: if len(model_results) > 10:
# model_results = model_results.dropna(thresh=len(model_results)*0.6,axis=1) model_results = model_results.dropna(thresh=len(model_results)*0.6,axis=1)
# # 删除空行 # 删除空行
# model_results = model_results.dropna() model_results = model_results.dropna()
# modelnames = model_results.columns.to_list()[2:] modelnames = model_results.columns.to_list()[2:]
# for col in model_results[modelnames].select_dtypes(include=['object']).columns: for col in model_results[modelnames].select_dtypes(include=['object']).columns:
# model_results[col] = model_results[col].astype(np.float32) model_results[col] = model_results[col].astype(np.float32)
# # 计算每个预测值与真实值之间的偏差率 # 计算每个预测值与真实值之间的偏差率
# for model in modelnames: for model in modelnames:
# model_results[f'{model}_abs_error_rate'] = abs(model_results['y'] - model_results[model]) / model_results['y'] model_results[f'{model}_abs_error_rate'] = abs(model_results['y'] - model_results[model]) / model_results['y']
# # 获取每行对应的最小偏差率值 # 获取每行对应的最小偏差率值
# min_abs_error_rate_values = model_results.apply(lambda row: row[[f'{model}_abs_error_rate' for model in modelnames]].min(), axis=1) min_abs_error_rate_values = model_results.apply(lambda row: row[[f'{model}_abs_error_rate' for model in modelnames]].min(), axis=1)
# # 获取每行对应的最小偏差率值对应的列名 # 获取每行对应的最小偏差率值对应的列名
# min_abs_error_rate_column_name = model_results.apply(lambda row: row[[f'{model}_abs_error_rate' for model in modelnames]].idxmin(), axis=1) min_abs_error_rate_column_name = model_results.apply(lambda row: row[[f'{model}_abs_error_rate' for model in modelnames]].idxmin(), axis=1)
# # 将列名索引转换为列名 # 将列名索引转换为列名
# min_abs_error_rate_column_name = min_abs_error_rate_column_name.map(lambda x: x.split('_')[0]) min_abs_error_rate_column_name = min_abs_error_rate_column_name.map(lambda x: x.split('_')[0])
# # 取出现次数最多的模型名称 # 取出现次数最多的模型名称
# most_common_model = min_abs_error_rate_column_name.value_counts().idxmax() most_common_model = min_abs_error_rate_column_name.value_counts().idxmax()
# logger.info(f"最近60天预测残差最低的模型名称{most_common_model}") logger.info(f"最近60天预测残差最低的模型名称{most_common_model}")
# # 保存结果到数据库 # 保存结果到数据库
# if not sqlitedb.check_table_exists('most_model'): if not sqlitedb.check_table_exists('most_model'):
# sqlitedb.create_table('most_model', columns="ds datetime, most_common_model TEXT") sqlitedb.create_table('most_model', columns="ds datetime, most_common_model TEXT")
# sqlitedb.insert_data('most_model', (datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), most_common_model,), columns=('ds', 'most_common_model',)) sqlitedb.insert_data('most_model', (datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), most_common_model,), columns=('ds', 'most_common_model',))
try: try:
if is_weekday: # if is_weekday:
if True:
logger.info('今天是周一,发送特征预警') logger.info('今天是周一,发送特征预警')
# 上传预警信息到数据库 # 上传预警信息到数据库
warning_data_df = df_zhibiaoliebiao.copy() warning_data_df = df_zhibiaoliebiao.copy()
@ -147,6 +148,11 @@ def predict_main():
# 重命名列名 # 重命名列名
warning_data_df = warning_data_df.rename(columns={'指标名称': 'INDICATOR_NAME', '指标id': 'INDICATOR_ID', '频度': 'FREQUENCY', '更新周期': 'UPDATE_FREQUENCY', '指标来源': 'DATA_SOURCE', '最后更新时间': 'LAST_UPDATE_DATE', '停更周期': 'UPDATE_SUSPENSION_CYCLE'}) warning_data_df = warning_data_df.rename(columns={'指标名称': 'INDICATOR_NAME', '指标id': 'INDICATOR_ID', '频度': 'FREQUENCY', '更新周期': 'UPDATE_FREQUENCY', '指标来源': 'DATA_SOURCE', '最后更新时间': 'LAST_UPDATE_DATE', '停更周期': 'UPDATE_SUSPENSION_CYCLE'})
from sqlalchemy import create_engine from sqlalchemy import create_engine
import urllib
global password
if '@' in password:
password = urllib.parse.quote_plus(password)
engine = create_engine(f'mysql+pymysql://{dbusername}:{password}@{host}:{port}/{dbname}') engine = create_engine(f'mysql+pymysql://{dbusername}:{password}@{host}:{port}/{dbname}')
warning_data_df['WARNING_DATE'] = datetime.date.today().strftime("%Y-%m-%d %H:%M:%S") warning_data_df['WARNING_DATE'] = datetime.date.today().strftime("%Y-%m-%d %H:%M:%S")
warning_data_df['TENANT_CODE'] = 'T0004' warning_data_df['TENANT_CODE'] = 'T0004'

View File

@ -1,16 +1,16 @@
ds,ACCURACY,PREDICT_DATE,CREAT_DATE,HIGH_PRICE_y,LOW_PRICE_y,MIN_PRICE,MAX_PRICE,Ds_Week,Pre_Week ds,ACCURACY,PREDICT_DATE,CREAT_DATE,HIGH_PRICE_y,LOW_PRICE_y,MIN_PRICE,MAX_PRICE,Ds_Week,Pre_Week
2024-12-02,0.0,2024-12-02,2024-11-29,72.89,71.52,81.17999,81.17999,48,48 2024-11-26,1.0,2024-11-26,2024-11-25,73.8,71.63,71.071556,76.0069,47,47
2024-12-03,0.0,2024-12-03,2024-11-29,73.93,71.68,80.79155,80.79155,48,48 2024-11-27,1.0,2024-11-27,2024-11-25,72.85,71.71,71.003624,75.58056,47,47
2024-12-04,0.0,2024-12-04,2024-11-29,74.28,72.25,80.650894,80.650894,48,48 2024-11-28,0.7893243243243208,2024-11-28,2024-11-25,72.96,71.85,72.08385,76.20426,47,47
2024-12-05,0.0,2024-12-05,2024-11-29,72.92,71.8,80.298,80.298,48,48 2024-11-29,1.0,2024-11-29,2024-11-25,73.34,71.75,71.32973,75.70395,47,47
2024-12-06,0.0,2024-12-06,2024-11-29,72.19,70.85,75.50838,80.264275,48,48 2024-11-27,0.6068728070175414,2024-11-27,2024-11-26,72.85,71.71,72.158165,76.17365,47,47
2024-12-03,1.0,2024-12-03,2024-12-02,73.93,71.68,69.80779,75.83719,48,48 2024-11-28,0.8021441441441385,2024-11-28,2024-11-26,72.96,71.85,72.06962,76.447,47,47
2024-12-04,1.0,2024-12-04,2024-12-02,74.28,72.25,71.281296,76.24051,48,48 2024-11-29,0.6082389937106918,2024-11-29,2024-11-26,73.34,71.75,72.3729,76.08291,47,47
2024-12-05,1.0,2024-12-05,2024-12-02,72.92,71.8,70.52623,75.95541,48,48 2024-11-28,1.0,2024-11-28,2024-11-27,72.96,71.85,70.70975,75.20803,47,47
2024-12-06,1.0,2024-12-06,2024-12-02,72.19,70.85,70.71932,75.99768,48,48 2024-11-29,1.0,2024-11-29,2024-11-27,73.34,71.75,69.92311,75.423775,47,47
2024-12-04,0.9432068965517233,2024-12-04,2024-12-03,74.28,72.25,72.36529,75.89061,48,48 2024-11-29,1.0,2024-11-29,2024-11-28,73.34,71.75,70.43276,75.48062,47,47
2024-12-05,0.6439196428571465,2024-12-05,2024-12-03,72.92,71.8,72.19881,75.72962,48,48 2024-11-25,0.11832806324110515,2024-11-25,2024-11-22,74.83,72.3,74.53063,76.67314,47,47
2024-12-06,0.04017164179103775,2024-12-06,2024-12-03,72.19,70.85,72.13617,75.97762,48,48 2024-11-26,0.0,2024-11-26,2024-11-22,73.8,71.63,74.44043,76.874565,47,47
2024-12-05,0.0,2024-12-05,2024-12-04,72.92,71.8,82.40537,82.40537,48,48 2024-11-27,0.0,2024-11-27,2024-11-22,72.85,71.71,74.66318,76.73413,47,47
2024-12-06,0.0,2024-12-06,2024-12-04,72.19,70.85,82.0727,82.0727,48,48 2024-11-28,0.0,2024-11-28,2024-11-22,72.96,71.85,74.70841,77.14105,47,47
2024-12-06,0.0,2024-12-06,2024-12-05,72.19,70.85,83.367485,83.367485,48,48 2024-11-29,0.0,2024-11-29,2024-11-22,73.34,71.75,74.70321,77.74617,47,47

1 ds ACCURACY PREDICT_DATE CREAT_DATE HIGH_PRICE_y LOW_PRICE_y MIN_PRICE MAX_PRICE Ds_Week Pre_Week
2 2024-12-02 2024-11-26 0.0 1.0 2024-12-02 2024-11-26 2024-11-29 2024-11-25 72.89 73.8 71.52 71.63 81.17999 71.071556 81.17999 76.0069 48 47 48 47
3 2024-12-03 2024-11-27 0.0 1.0 2024-12-03 2024-11-27 2024-11-29 2024-11-25 73.93 72.85 71.68 71.71 80.79155 71.003624 80.79155 75.58056 48 47 48 47
4 2024-12-04 2024-11-28 0.0 0.7893243243243208 2024-12-04 2024-11-28 2024-11-29 2024-11-25 74.28 72.96 72.25 71.85 80.650894 72.08385 80.650894 76.20426 48 47 48 47
5 2024-12-05 2024-11-29 0.0 1.0 2024-12-05 2024-11-29 2024-11-29 2024-11-25 72.92 73.34 71.8 71.75 80.298 71.32973 80.298 75.70395 48 47 48 47
6 2024-12-06 2024-11-27 0.0 0.6068728070175414 2024-12-06 2024-11-27 2024-11-29 2024-11-26 72.19 72.85 70.85 71.71 75.50838 72.158165 80.264275 76.17365 48 47 48 47
7 2024-12-03 2024-11-28 1.0 0.8021441441441385 2024-12-03 2024-11-28 2024-12-02 2024-11-26 73.93 72.96 71.68 71.85 69.80779 72.06962 75.83719 76.447 48 47 48 47
8 2024-12-04 2024-11-29 1.0 0.6082389937106918 2024-12-04 2024-11-29 2024-12-02 2024-11-26 74.28 73.34 72.25 71.75 71.281296 72.3729 76.24051 76.08291 48 47 48 47
9 2024-12-05 2024-11-28 1.0 2024-12-05 2024-11-28 2024-12-02 2024-11-27 72.92 72.96 71.8 71.85 70.52623 70.70975 75.95541 75.20803 48 47 48 47
10 2024-12-06 2024-11-29 1.0 2024-12-06 2024-11-29 2024-12-02 2024-11-27 72.19 73.34 70.85 71.75 70.71932 69.92311 75.99768 75.423775 48 47 48 47
11 2024-12-04 2024-11-29 0.9432068965517233 1.0 2024-12-04 2024-11-29 2024-12-03 2024-11-28 74.28 73.34 72.25 71.75 72.36529 70.43276 75.89061 75.48062 48 47 48 47
12 2024-12-05 2024-11-25 0.6439196428571465 0.11832806324110515 2024-12-05 2024-11-25 2024-12-03 2024-11-22 72.92 74.83 71.8 72.3 72.19881 74.53063 75.72962 76.67314 48 47 48 47
13 2024-12-06 2024-11-26 0.04017164179103775 0.0 2024-12-06 2024-11-26 2024-12-03 2024-11-22 72.19 73.8 70.85 71.63 72.13617 74.44043 75.97762 76.874565 48 47 48 47
14 2024-12-05 2024-11-27 0.0 2024-12-05 2024-11-27 2024-12-04 2024-11-22 72.92 72.85 71.8 71.71 82.40537 74.66318 82.40537 76.73413 48 47 48 47
15 2024-12-06 2024-11-28 0.0 2024-12-06 2024-11-28 2024-12-04 2024-11-22 72.19 72.96 70.85 71.85 82.0727 74.70841 82.0727 77.14105 48 47 48 47
16 2024-12-06 2024-11-29 0.0 2024-12-06 2024-11-29 2024-12-05 2024-11-22 72.19 73.34 70.85 71.75 83.367485 74.70321 83.367485 77.74617 48 47 48 47

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 130, "execution_count": 136,
"id": "9daadf20-caa6-4b25-901c-6cc3ef563f58", "id": "9daadf20-caa6-4b25-901c-6cc3ef563f58",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -10,9 +10,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"(50, 9)\n", "(75, 9)\n",
"(20, 4)\n", "(20, 4)\n",
"(50, 12)\n", "(75, 12)\n",
" id PREDICT_DATE CREAT_DATE MIN_PRICE MAX_PRICE HIGH_PRICE_x LOW_PRICE_x \\\n", " id PREDICT_DATE CREAT_DATE MIN_PRICE MAX_PRICE HIGH_PRICE_x LOW_PRICE_x \\\n",
"0 1 2024-11-26 2024-11-25 71.071556 76.006900 \n", "0 1 2024-11-26 2024-11-25 71.071556 76.006900 \n",
"1 2 2024-11-27 2024-11-25 71.003624 75.580560 \n", "1 2 2024-11-27 2024-11-25 71.003624 75.580560 \n",
@ -27,18 +27,18 @@
"3 2024-11-29 6.0 71.75 73.34 \n", "3 2024-11-29 6.0 71.75 73.34 \n",
"4 2024-12-02 5.0 71.52 72.89 \n", "4 2024-12-02 5.0 71.52 72.89 \n",
" id PREDICT_DATE CREAT_DATE MIN_PRICE MAX_PRICE HIGH_PRICE_x \\\n", " id PREDICT_DATE CREAT_DATE MIN_PRICE MAX_PRICE HIGH_PRICE_x \\\n",
"45 46 2024-12-09 2024-12-06 68.894770 73.909450 \n", "70 71 2024-11-25 2024-11-22 74.53063 76.673140 \n",
"46 47 2024-12-10 2024-12-06 68.845604 73.921120 \n", "71 72 2024-11-26 2024-11-22 74.44043 76.874565 \n",
"47 48 2024-12-11 2024-12-06 69.181210 73.906260 \n", "72 73 2024-11-27 2024-11-22 74.66318 76.734130 \n",
"48 49 2024-12-12 2024-12-06 69.075340 73.862946 \n", "73 74 2024-11-28 2024-11-22 74.70841 77.141050 \n",
"49 50 2024-12-13 2024-12-06 69.076550 74.007740 \n", "74 75 2024-11-29 2024-11-22 74.70321 77.746170 \n",
"\n", "\n",
" LOW_PRICE_x RIGHT_ROTE ds 序号 LOW_PRICE_y HIGH_PRICE_y \n", " LOW_PRICE_x RIGHT_ROTE ds 序号 LOW_PRICE_y HIGH_PRICE_y \n",
"45 2024-12-09 NaN NaN NaN \n", "70 2024-11-25 10.0 72.30 74.83 \n",
"46 2024-12-10 NaN NaN NaN \n", "71 2024-11-26 9.0 71.63 73.80 \n",
"47 2024-12-11 NaN NaN NaN \n", "72 2024-11-27 8.0 71.71 72.85 \n",
"48 2024-12-12 NaN NaN NaN \n", "73 2024-11-28 7.0 71.85 72.96 \n",
"49 2024-12-13 NaN NaN NaN \n" "74 2024-11-29 6.0 71.75 73.34 \n"
] ]
} }
], ],
@ -87,7 +87,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 131, "execution_count": 137,
"id": "e51c3fd0-6bff-45de-b8b6-971e7986c7a7", "id": "e51c3fd0-6bff-45de-b8b6-971e7986c7a7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -101,51 +101,14 @@
"2 2024-11-28 0.789324 72.96 71.85 72.083850 76.204260\n", "2 2024-11-28 0.789324 72.96 71.85 72.083850 76.204260\n",
"3 2024-11-29 1.000000 73.34 71.75 71.329730 75.703950\n", "3 2024-11-29 1.000000 73.34 71.75 71.329730 75.703950\n",
"4 2024-12-02 0.853412 72.89 71.52 71.720825 76.264275\n", "4 2024-12-02 0.853412 72.89 71.52 71.720825 76.264275\n",
"5 2024-11-27 0.606873 72.85 71.71 72.158165 76.173650\n", ".. ... ... ... ... ... ...\n",
"6 2024-11-28 0.802144 72.96 71.85 72.069620 76.447000\n", "70 2024-11-25 0.118328 74.83 72.30 74.530630 76.673140\n",
"7 2024-11-29 0.608239 73.34 71.75 72.372900 76.082910\n", "71 2024-11-26 0.000000 73.80 71.63 74.440430 76.874565\n",
"8 2024-12-02 0.457007 72.89 71.52 72.263900 76.198685\n", "72 2024-11-27 0.000000 72.85 71.71 74.663180 76.734130\n",
"9 2024-12-03 0.758302 73.93 71.68 72.223820 76.041725\n", "73 2024-11-28 0.000000 72.96 71.85 74.708410 77.141050\n",
"10 2024-11-28 1.000000 72.96 71.85 70.709750 75.208030\n", "74 2024-11-29 0.000000 73.34 71.75 74.703210 77.746170\n",
"11 2024-11-29 1.000000 73.34 71.75 69.923110 75.423775\n", "\n",
"12 2024-12-02 1.000000 72.89 71.52 70.810356 75.786860\n", "[75 rows x 6 columns]\n"
"13 2024-12-03 1.000000 73.93 71.68 70.814430 75.791115\n",
"14 2024-12-04 1.000000 74.28 72.25 70.476650 75.623730\n",
"15 2024-11-29 1.000000 73.34 71.75 70.432760 75.480620\n",
"16 2024-12-02 1.000000 72.89 71.52 69.651825 75.270940\n",
"17 2024-12-03 1.000000 73.93 71.68 70.536285 75.826430\n",
"18 2024-12-04 1.000000 74.28 72.25 70.568340 75.770290\n",
"19 2024-12-05 1.000000 72.92 71.80 70.222640 76.113310\n",
"20 2024-12-02 0.000000 72.89 71.52 81.179990 81.179990\n",
"21 2024-12-03 0.000000 73.93 71.68 80.791550 80.791550\n",
"22 2024-12-04 0.000000 74.28 72.25 80.650894 80.650894\n",
"23 2024-12-05 0.000000 72.92 71.80 80.298000 80.298000\n",
"24 2024-12-06 0.000000 72.19 70.85 75.508380 80.264275\n",
"25 2024-12-03 1.000000 73.93 71.68 69.807790 75.837190\n",
"26 2024-12-04 1.000000 74.28 72.25 71.281296 76.240510\n",
"27 2024-12-05 1.000000 72.92 71.80 70.526230 75.955410\n",
"28 2024-12-06 1.000000 72.19 70.85 70.719320 75.997680\n",
"29 2024-12-09 0.000000 NaN NaN 71.642590 75.828636\n",
"30 2024-12-04 0.943207 74.28 72.25 72.365290 75.890610\n",
"31 2024-12-05 0.643920 72.92 71.80 72.198810 75.729620\n",
"32 2024-12-06 0.040172 72.19 70.85 72.136170 75.977620\n",
"33 2024-12-09 0.000000 NaN NaN 72.165790 75.880104\n",
"34 2024-12-10 0.000000 NaN NaN 72.000620 75.906100\n",
"35 2024-12-05 0.000000 72.92 71.80 82.405370 82.405370\n",
"36 2024-12-06 0.000000 72.19 70.85 82.072700 82.072700\n",
"37 2024-12-09 0.000000 NaN NaN 82.652700 82.652700\n",
"38 2024-12-10 0.000000 NaN NaN 81.920910 81.920910\n",
"39 2024-12-11 0.000000 NaN NaN 81.091270 81.091270\n",
"40 2024-12-06 0.000000 72.19 70.85 83.367485 83.367485\n",
"41 2024-12-09 0.000000 NaN NaN 82.869705 82.869705\n",
"42 2024-12-10 0.000000 NaN NaN 82.580550 82.580550\n",
"43 2024-12-11 0.000000 NaN NaN 82.442154 82.442154\n",
"44 2024-12-12 0.000000 NaN NaN 82.276510 82.276510\n",
"45 2024-12-09 0.000000 NaN NaN 68.894770 73.909450\n",
"46 2024-12-10 0.000000 NaN NaN 68.845604 73.921120\n",
"47 2024-12-11 0.000000 NaN NaN 69.181210 73.906260\n",
"48 2024-12-12 0.000000 NaN NaN 69.075340 73.862946\n",
"49 2024-12-13 0.000000 NaN NaN 69.076550 74.007740\n"
] ]
} }
], ],
@ -176,7 +139,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 132, "execution_count": 138,
"id": "0f942c69", "id": "0f942c69",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -189,7 +152,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 133, "execution_count": 139,
"id": "a7b05510", "id": "a7b05510",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -293,592 +256,86 @@
" <td>48</td>\n", " <td>48</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>5</th>\n", " <th>...</th>\n",
" <td>2024-11-27</td>\n", " <td>...</td>\n",
" <td>0.606873</td>\n", " <td>...</td>\n",
" <td>2024-11-27</td>\n", " <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>70</th>\n",
" <td>2024-11-25</td>\n",
" <td>0.118328</td>\n",
" <td>2024-11-25</td>\n",
" <td>2024-11-22</td>\n",
" <td>74.83</td>\n",
" <td>72.30</td>\n",
" <td>74.530630</td>\n",
" <td>76.673140</td>\n",
" <td>47</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>2024-11-26</td>\n", " <td>2024-11-26</td>\n",
" <td>0.000000</td>\n",
" <td>2024-11-26</td>\n",
" <td>2024-11-22</td>\n",
" <td>73.80</td>\n",
" <td>71.63</td>\n",
" <td>74.440430</td>\n",
" <td>76.874565</td>\n",
" <td>47</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>72</th>\n",
" <td>2024-11-27</td>\n",
" <td>0.000000</td>\n",
" <td>2024-11-27</td>\n",
" <td>2024-11-22</td>\n",
" <td>72.85</td>\n", " <td>72.85</td>\n",
" <td>71.71</td>\n", " <td>71.71</td>\n",
" <td>72.158165</td>\n", " <td>74.663180</td>\n",
" <td>76.173650</td>\n", " <td>76.734130</td>\n",
" <td>47</td>\n", " <td>47</td>\n",
" <td>47</td>\n", " <td>47</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>6</th>\n", " <th>73</th>\n",
" <td>2024-11-28</td>\n", " <td>2024-11-28</td>\n",
" <td>0.802144</td>\n", " <td>0.000000</td>\n",
" <td>2024-11-28</td>\n", " <td>2024-11-28</td>\n",
" <td>2024-11-26</td>\n", " <td>2024-11-22</td>\n",
" <td>72.96</td>\n", " <td>72.96</td>\n",
" <td>71.85</td>\n", " <td>71.85</td>\n",
" <td>72.069620</td>\n", " <td>74.708410</td>\n",
" <td>76.447000</td>\n", " <td>77.141050</td>\n",
" <td>47</td>\n", " <td>47</td>\n",
" <td>47</td>\n", " <td>47</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>7</th>\n", " <th>74</th>\n",
" <td>2024-11-29</td>\n", " <td>2024-11-29</td>\n",
" <td>0.608239</td>\n", " <td>0.000000</td>\n",
" <td>2024-11-29</td>\n", " <td>2024-11-29</td>\n",
" <td>2024-11-26</td>\n", " <td>2024-11-22</td>\n",
" <td>73.34</td>\n", " <td>73.34</td>\n",
" <td>71.75</td>\n", " <td>71.75</td>\n",
" <td>72.372900</td>\n", " <td>74.703210</td>\n",
" <td>76.082910</td>\n", " <td>77.746170</td>\n",
" <td>47</td>\n", " <td>47</td>\n",
" <td>47</td>\n", " <td>47</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>2024-12-02</td>\n",
" <td>0.457007</td>\n",
" <td>2024-12-02</td>\n",
" <td>2024-11-26</td>\n",
" <td>72.89</td>\n",
" <td>71.52</td>\n",
" <td>72.263900</td>\n",
" <td>76.198685</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>2024-12-03</td>\n",
" <td>0.758302</td>\n",
" <td>2024-12-03</td>\n",
" <td>2024-11-26</td>\n",
" <td>73.93</td>\n",
" <td>71.68</td>\n",
" <td>72.223820</td>\n",
" <td>76.041725</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>2024-11-28</td>\n",
" <td>1.000000</td>\n",
" <td>2024-11-28</td>\n",
" <td>2024-11-27</td>\n",
" <td>72.96</td>\n",
" <td>71.85</td>\n",
" <td>70.709750</td>\n",
" <td>75.208030</td>\n",
" <td>47</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>2024-11-29</td>\n",
" <td>1.000000</td>\n",
" <td>2024-11-29</td>\n",
" <td>2024-11-27</td>\n",
" <td>73.34</td>\n",
" <td>71.75</td>\n",
" <td>69.923110</td>\n",
" <td>75.423775</td>\n",
" <td>47</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>2024-12-02</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-02</td>\n",
" <td>2024-11-27</td>\n",
" <td>72.89</td>\n",
" <td>71.52</td>\n",
" <td>70.810356</td>\n",
" <td>75.786860</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>2024-12-03</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-03</td>\n",
" <td>2024-11-27</td>\n",
" <td>73.93</td>\n",
" <td>71.68</td>\n",
" <td>70.814430</td>\n",
" <td>75.791115</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>2024-12-04</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-04</td>\n",
" <td>2024-11-27</td>\n",
" <td>74.28</td>\n",
" <td>72.25</td>\n",
" <td>70.476650</td>\n",
" <td>75.623730</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>2024-11-29</td>\n",
" <td>1.000000</td>\n",
" <td>2024-11-29</td>\n",
" <td>2024-11-28</td>\n",
" <td>73.34</td>\n",
" <td>71.75</td>\n",
" <td>70.432760</td>\n",
" <td>75.480620</td>\n",
" <td>47</td>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>2024-12-02</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-02</td>\n",
" <td>2024-11-28</td>\n",
" <td>72.89</td>\n",
" <td>71.52</td>\n",
" <td>69.651825</td>\n",
" <td>75.270940</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>2024-12-03</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-03</td>\n",
" <td>2024-11-28</td>\n",
" <td>73.93</td>\n",
" <td>71.68</td>\n",
" <td>70.536285</td>\n",
" <td>75.826430</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>2024-12-04</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-04</td>\n",
" <td>2024-11-28</td>\n",
" <td>74.28</td>\n",
" <td>72.25</td>\n",
" <td>70.568340</td>\n",
" <td>75.770290</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>2024-12-05</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-05</td>\n",
" <td>2024-11-28</td>\n",
" <td>72.92</td>\n",
" <td>71.80</td>\n",
" <td>70.222640</td>\n",
" <td>76.113310</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>2024-12-02</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-02</td>\n",
" <td>2024-11-29</td>\n",
" <td>72.89</td>\n",
" <td>71.52</td>\n",
" <td>81.179990</td>\n",
" <td>81.179990</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>2024-12-03</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-03</td>\n",
" <td>2024-11-29</td>\n",
" <td>73.93</td>\n",
" <td>71.68</td>\n",
" <td>80.791550</td>\n",
" <td>80.791550</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>2024-12-04</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-04</td>\n",
" <td>2024-11-29</td>\n",
" <td>74.28</td>\n",
" <td>72.25</td>\n",
" <td>80.650894</td>\n",
" <td>80.650894</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>2024-12-05</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-05</td>\n",
" <td>2024-11-29</td>\n",
" <td>72.92</td>\n",
" <td>71.80</td>\n",
" <td>80.298000</td>\n",
" <td>80.298000</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>2024-12-06</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-06</td>\n",
" <td>2024-11-29</td>\n",
" <td>72.19</td>\n",
" <td>70.85</td>\n",
" <td>75.508380</td>\n",
" <td>80.264275</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>2024-12-03</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-03</td>\n",
" <td>2024-12-02</td>\n",
" <td>73.93</td>\n",
" <td>71.68</td>\n",
" <td>69.807790</td>\n",
" <td>75.837190</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>2024-12-04</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-04</td>\n",
" <td>2024-12-02</td>\n",
" <td>74.28</td>\n",
" <td>72.25</td>\n",
" <td>71.281296</td>\n",
" <td>76.240510</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>2024-12-05</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-05</td>\n",
" <td>2024-12-02</td>\n",
" <td>72.92</td>\n",
" <td>71.80</td>\n",
" <td>70.526230</td>\n",
" <td>75.955410</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>2024-12-06</td>\n",
" <td>1.000000</td>\n",
" <td>2024-12-06</td>\n",
" <td>2024-12-02</td>\n",
" <td>72.19</td>\n",
" <td>70.85</td>\n",
" <td>70.719320</td>\n",
" <td>75.997680</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>2024-12-09</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-09</td>\n",
" <td>2024-12-02</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>71.642590</td>\n",
" <td>75.828636</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>2024-12-04</td>\n",
" <td>0.943207</td>\n",
" <td>2024-12-04</td>\n",
" <td>2024-12-03</td>\n",
" <td>74.28</td>\n",
" <td>72.25</td>\n",
" <td>72.365290</td>\n",
" <td>75.890610</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>2024-12-05</td>\n",
" <td>0.643920</td>\n",
" <td>2024-12-05</td>\n",
" <td>2024-12-03</td>\n",
" <td>72.92</td>\n",
" <td>71.80</td>\n",
" <td>72.198810</td>\n",
" <td>75.729620</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>2024-12-06</td>\n",
" <td>0.040172</td>\n",
" <td>2024-12-06</td>\n",
" <td>2024-12-03</td>\n",
" <td>72.19</td>\n",
" <td>70.85</td>\n",
" <td>72.136170</td>\n",
" <td>75.977620</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>2024-12-09</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-09</td>\n",
" <td>2024-12-03</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>72.165790</td>\n",
" <td>75.880104</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>2024-12-10</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-10</td>\n",
" <td>2024-12-03</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>72.000620</td>\n",
" <td>75.906100</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>2024-12-05</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-05</td>\n",
" <td>2024-12-04</td>\n",
" <td>72.92</td>\n",
" <td>71.80</td>\n",
" <td>82.405370</td>\n",
" <td>82.405370</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>2024-12-06</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-06</td>\n",
" <td>2024-12-04</td>\n",
" <td>72.19</td>\n",
" <td>70.85</td>\n",
" <td>82.072700</td>\n",
" <td>82.072700</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>2024-12-09</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-09</td>\n",
" <td>2024-12-04</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>82.652700</td>\n",
" <td>82.652700</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>2024-12-10</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-10</td>\n",
" <td>2024-12-04</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>81.920910</td>\n",
" <td>81.920910</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
" <td>2024-12-11</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-11</td>\n",
" <td>2024-12-04</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>81.091270</td>\n",
" <td>81.091270</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
" <td>2024-12-06</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-06</td>\n",
" <td>2024-12-05</td>\n",
" <td>72.19</td>\n",
" <td>70.85</td>\n",
" <td>83.367485</td>\n",
" <td>83.367485</td>\n",
" <td>48</td>\n",
" <td>48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>2024-12-09</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-09</td>\n",
" <td>2024-12-05</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>82.869705</td>\n",
" <td>82.869705</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>2024-12-10</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-10</td>\n",
" <td>2024-12-05</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>82.580550</td>\n",
" <td>82.580550</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>2024-12-11</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-11</td>\n",
" <td>2024-12-05</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>82.442154</td>\n",
" <td>82.442154</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>2024-12-12</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-12</td>\n",
" <td>2024-12-05</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>82.276510</td>\n",
" <td>82.276510</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>45</th>\n",
" <td>2024-12-09</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-09</td>\n",
" <td>2024-12-06</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>68.894770</td>\n",
" <td>73.909450</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>2024-12-10</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-10</td>\n",
" <td>2024-12-06</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>68.845604</td>\n",
" <td>73.921120</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>47</th>\n",
" <td>2024-12-11</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-11</td>\n",
" <td>2024-12-06</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>69.181210</td>\n",
" <td>73.906260</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>48</th>\n",
" <td>2024-12-12</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-12</td>\n",
" <td>2024-12-06</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>69.075340</td>\n",
" <td>73.862946</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>49</th>\n",
" <td>2024-12-13</td>\n",
" <td>0.000000</td>\n",
" <td>2024-12-13</td>\n",
" <td>2024-12-06</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>69.076550</td>\n",
" <td>74.007740</td>\n",
" <td>49</td>\n",
" <td>49</td>\n",
" </tr>\n",
" </tbody>\n", " </tbody>\n",
"</table>\n", "</table>\n",
"<p>75 rows × 10 columns</p>\n",
"</div>" "</div>"
], ],
"text/plain": [ "text/plain": [
@ -888,51 +345,12 @@
"2 2024-11-28 0.789324 2024-11-28 2024-11-25 72.96 71.85 \n", "2 2024-11-28 0.789324 2024-11-28 2024-11-25 72.96 71.85 \n",
"3 2024-11-29 1.000000 2024-11-29 2024-11-25 73.34 71.75 \n", "3 2024-11-29 1.000000 2024-11-29 2024-11-25 73.34 71.75 \n",
"4 2024-12-02 0.853412 2024-12-02 2024-11-25 72.89 71.52 \n", "4 2024-12-02 0.853412 2024-12-02 2024-11-25 72.89 71.52 \n",
"5 2024-11-27 0.606873 2024-11-27 2024-11-26 72.85 71.71 \n", ".. ... ... ... ... ... ... \n",
"6 2024-11-28 0.802144 2024-11-28 2024-11-26 72.96 71.85 \n", "70 2024-11-25 0.118328 2024-11-25 2024-11-22 74.83 72.30 \n",
"7 2024-11-29 0.608239 2024-11-29 2024-11-26 73.34 71.75 \n", "71 2024-11-26 0.000000 2024-11-26 2024-11-22 73.80 71.63 \n",
"8 2024-12-02 0.457007 2024-12-02 2024-11-26 72.89 71.52 \n", "72 2024-11-27 0.000000 2024-11-27 2024-11-22 72.85 71.71 \n",
"9 2024-12-03 0.758302 2024-12-03 2024-11-26 73.93 71.68 \n", "73 2024-11-28 0.000000 2024-11-28 2024-11-22 72.96 71.85 \n",
"10 2024-11-28 1.000000 2024-11-28 2024-11-27 72.96 71.85 \n", "74 2024-11-29 0.000000 2024-11-29 2024-11-22 73.34 71.75 \n",
"11 2024-11-29 1.000000 2024-11-29 2024-11-27 73.34 71.75 \n",
"12 2024-12-02 1.000000 2024-12-02 2024-11-27 72.89 71.52 \n",
"13 2024-12-03 1.000000 2024-12-03 2024-11-27 73.93 71.68 \n",
"14 2024-12-04 1.000000 2024-12-04 2024-11-27 74.28 72.25 \n",
"15 2024-11-29 1.000000 2024-11-29 2024-11-28 73.34 71.75 \n",
"16 2024-12-02 1.000000 2024-12-02 2024-11-28 72.89 71.52 \n",
"17 2024-12-03 1.000000 2024-12-03 2024-11-28 73.93 71.68 \n",
"18 2024-12-04 1.000000 2024-12-04 2024-11-28 74.28 72.25 \n",
"19 2024-12-05 1.000000 2024-12-05 2024-11-28 72.92 71.80 \n",
"20 2024-12-02 0.000000 2024-12-02 2024-11-29 72.89 71.52 \n",
"21 2024-12-03 0.000000 2024-12-03 2024-11-29 73.93 71.68 \n",
"22 2024-12-04 0.000000 2024-12-04 2024-11-29 74.28 72.25 \n",
"23 2024-12-05 0.000000 2024-12-05 2024-11-29 72.92 71.80 \n",
"24 2024-12-06 0.000000 2024-12-06 2024-11-29 72.19 70.85 \n",
"25 2024-12-03 1.000000 2024-12-03 2024-12-02 73.93 71.68 \n",
"26 2024-12-04 1.000000 2024-12-04 2024-12-02 74.28 72.25 \n",
"27 2024-12-05 1.000000 2024-12-05 2024-12-02 72.92 71.80 \n",
"28 2024-12-06 1.000000 2024-12-06 2024-12-02 72.19 70.85 \n",
"29 2024-12-09 0.000000 2024-12-09 2024-12-02 NaN NaN \n",
"30 2024-12-04 0.943207 2024-12-04 2024-12-03 74.28 72.25 \n",
"31 2024-12-05 0.643920 2024-12-05 2024-12-03 72.92 71.80 \n",
"32 2024-12-06 0.040172 2024-12-06 2024-12-03 72.19 70.85 \n",
"33 2024-12-09 0.000000 2024-12-09 2024-12-03 NaN NaN \n",
"34 2024-12-10 0.000000 2024-12-10 2024-12-03 NaN NaN \n",
"35 2024-12-05 0.000000 2024-12-05 2024-12-04 72.92 71.80 \n",
"36 2024-12-06 0.000000 2024-12-06 2024-12-04 72.19 70.85 \n",
"37 2024-12-09 0.000000 2024-12-09 2024-12-04 NaN NaN \n",
"38 2024-12-10 0.000000 2024-12-10 2024-12-04 NaN NaN \n",
"39 2024-12-11 0.000000 2024-12-11 2024-12-04 NaN NaN \n",
"40 2024-12-06 0.000000 2024-12-06 2024-12-05 72.19 70.85 \n",
"41 2024-12-09 0.000000 2024-12-09 2024-12-05 NaN NaN \n",
"42 2024-12-10 0.000000 2024-12-10 2024-12-05 NaN NaN \n",
"43 2024-12-11 0.000000 2024-12-11 2024-12-05 NaN NaN \n",
"44 2024-12-12 0.000000 2024-12-12 2024-12-05 NaN NaN \n",
"45 2024-12-09 0.000000 2024-12-09 2024-12-06 NaN NaN \n",
"46 2024-12-10 0.000000 2024-12-10 2024-12-06 NaN NaN \n",
"47 2024-12-11 0.000000 2024-12-11 2024-12-06 NaN NaN \n",
"48 2024-12-12 0.000000 2024-12-12 2024-12-06 NaN NaN \n",
"49 2024-12-13 0.000000 2024-12-13 2024-12-06 NaN NaN \n",
"\n", "\n",
" MIN_PRICE MAX_PRICE Ds_Week Pre_Week \n", " MIN_PRICE MAX_PRICE Ds_Week Pre_Week \n",
"0 71.071556 76.006900 47 47 \n", "0 71.071556 76.006900 47 47 \n",
@ -940,54 +358,17 @@
"2 72.083850 76.204260 47 47 \n", "2 72.083850 76.204260 47 47 \n",
"3 71.329730 75.703950 47 47 \n", "3 71.329730 75.703950 47 47 \n",
"4 71.720825 76.264275 48 48 \n", "4 71.720825 76.264275 48 48 \n",
"5 72.158165 76.173650 47 47 \n", ".. ... ... ... ... \n",
"6 72.069620 76.447000 47 47 \n", "70 74.530630 76.673140 47 47 \n",
"7 72.372900 76.082910 47 47 \n", "71 74.440430 76.874565 47 47 \n",
"8 72.263900 76.198685 48 48 \n", "72 74.663180 76.734130 47 47 \n",
"9 72.223820 76.041725 48 48 \n", "73 74.708410 77.141050 47 47 \n",
"10 70.709750 75.208030 47 47 \n", "74 74.703210 77.746170 47 47 \n",
"11 69.923110 75.423775 47 47 \n", "\n",
"12 70.810356 75.786860 48 48 \n", "[75 rows x 10 columns]"
"13 70.814430 75.791115 48 48 \n",
"14 70.476650 75.623730 48 48 \n",
"15 70.432760 75.480620 47 47 \n",
"16 69.651825 75.270940 48 48 \n",
"17 70.536285 75.826430 48 48 \n",
"18 70.568340 75.770290 48 48 \n",
"19 70.222640 76.113310 48 48 \n",
"20 81.179990 81.179990 48 48 \n",
"21 80.791550 80.791550 48 48 \n",
"22 80.650894 80.650894 48 48 \n",
"23 80.298000 80.298000 48 48 \n",
"24 75.508380 80.264275 48 48 \n",
"25 69.807790 75.837190 48 48 \n",
"26 71.281296 76.240510 48 48 \n",
"27 70.526230 75.955410 48 48 \n",
"28 70.719320 75.997680 48 48 \n",
"29 71.642590 75.828636 49 49 \n",
"30 72.365290 75.890610 48 48 \n",
"31 72.198810 75.729620 48 48 \n",
"32 72.136170 75.977620 48 48 \n",
"33 72.165790 75.880104 49 49 \n",
"34 72.000620 75.906100 49 49 \n",
"35 82.405370 82.405370 48 48 \n",
"36 82.072700 82.072700 48 48 \n",
"37 82.652700 82.652700 49 49 \n",
"38 81.920910 81.920910 49 49 \n",
"39 81.091270 81.091270 49 49 \n",
"40 83.367485 83.367485 48 48 \n",
"41 82.869705 82.869705 49 49 \n",
"42 82.580550 82.580550 49 49 \n",
"43 82.442154 82.442154 49 49 \n",
"44 82.276510 82.276510 49 49 \n",
"45 68.894770 73.909450 49 49 \n",
"46 68.845604 73.921120 49 49 \n",
"47 69.181210 73.906260 49 49 \n",
"48 69.075340 73.862946 49 49 \n",
"49 69.076550 74.007740 49 49 "
] ]
}, },
"execution_count": 133, "execution_count": 139,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -998,7 +379,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 134, "execution_count": 140,
"id": "1374e354", "id": "1374e354",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1006,14 +387,20 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"['2024-11-29', '2024-11-30', '2024-12-01', '2024-12-02', '2024-12-03', '2024-12-04', '2024-12-05', '2024-12-06']\n", "['2024-11-22', '2024-11-23', '2024-11-24', '2024-11-25', '2024-11-26', '2024-11-27', '2024-11-28', '2024-11-29']\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"(15, 10)\n" "(15, 10)\n"
] ]
} }
], ],
"source": [ "source": [
"# 取结束日期上一周的日期\n", "# 取结束日期上一周的日期\n",
"endtime = '2024-12-9'\n", "endtime = '2024-12-3'\n",
"endtimeweek = datetime.datetime.strptime(endtime, '%Y-%m-%d')\n", "endtimeweek = datetime.datetime.strptime(endtime, '%Y-%m-%d')\n",
"up_week = endtimeweek - datetime.timedelta(days=endtimeweek.weekday() + 14)\n", "up_week = endtimeweek - datetime.timedelta(days=endtimeweek.weekday() + 14)\n",
"up_week_dates = [up_week + datetime.timedelta(days=i) for i in range(14)][4:-2]\n", "up_week_dates = [up_week + datetime.timedelta(days=i) for i in range(14)][4:-2]\n",
@ -1030,7 +417,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 135, "execution_count": 141,
"id": "8aa47e90", "id": "8aa47e90",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1038,22 +425,22 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2024-12-02 00:00:00\n", "2024-11-25 00:00:00\n",
"权重: 0.07\n", "权重: 0.07\n",
"准确率: 0.0\n", "准确率: 1.7749209486165771\n",
"2024-12-03 00:00:00\n", "2024-11-26 00:00:00\n",
"权重: 0.13\n", "权重: 0.13\n",
"准确率: 7.5\n", "准确率: 7.5\n",
"2024-12-04 00:00:00\n", "2024-11-27 00:00:00\n",
"权重: 0.2\n", "权重: 0.2\n",
"准确率: 9.716034482758616\n", "准确率: 8.034364035087705\n",
"2024-12-05 00:00:00\n", "2024-11-28 00:00:00\n",
"权重: 0.27\n", "权重: 0.27\n",
"准确率: 6.1646986607143\n", "准确率: 9.718006756756724\n",
"2024-12-06 00:00:00\n", "2024-11-29 00:00:00\n",
"权重: 0.33\n", "权重: 0.33\n",
"准确率: 3.1205149253731137\n", "准确率: 10.824716981132076\n",
"26.50124806884603\n" "37.85200872159308\n"
] ]
} }
], ],
@ -1069,14 +456,6 @@
"\n", "\n",
"print(accuracy_rote)" "print(accuracy_rote)"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3e69cacc",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {