Merge branch 'main' of https://gitea.jayhgq.cn/liurui/PriceForecast
This commit is contained in:
commit
e39d90a503
123
config_jingbo.py
123
config_jingbo.py
@ -86,50 +86,13 @@ ClassifyId = 1214
|
||||
|
||||
### 报告上传配置
|
||||
# 变量定义--线上环境
|
||||
# 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"
|
||||
|
||||
# login_data = {
|
||||
# "data": {
|
||||
# "account": "api_dev",
|
||||
# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=",
|
||||
# "tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
|
||||
# "terminal": "API"
|
||||
# },
|
||||
# "funcModule": "API",
|
||||
# "funcOperation": "获取token"
|
||||
# }
|
||||
|
||||
|
||||
|
||||
# upload_data = {
|
||||
# "funcModule":'研究报告信息',
|
||||
# "funcOperation":'上传原油价格预测报告',
|
||||
# "data":{
|
||||
# "ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋
|
||||
# "reportType":'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST
|
||||
# "fileName": '', #文件名称
|
||||
# "fileBase64": '' ,#文件内容base64
|
||||
# "categoryNo":'yyjgycbg', # 研究报告分类编码
|
||||
# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
|
||||
# "reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋
|
||||
# "reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部
|
||||
# "productGroupCode":"RAW_MATERIAL" # 商品分类
|
||||
# }
|
||||
# }
|
||||
|
||||
|
||||
|
||||
# # 变量定义--测试环境
|
||||
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.109:8080/jingbo/api/analysis/reportInfo/researchUploadReportSave" # zhaoqiwei
|
||||
|
||||
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"
|
||||
|
||||
login_data = {
|
||||
"data": {
|
||||
"account": "api_test",
|
||||
"password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=",
|
||||
"account": "api_dev",
|
||||
"password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=",
|
||||
"tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
|
||||
"terminal": "API"
|
||||
},
|
||||
@ -137,48 +100,85 @@ login_data = {
|
||||
"funcOperation": "获取token"
|
||||
}
|
||||
|
||||
|
||||
|
||||
upload_data = {
|
||||
"funcModule":'研究报告信息',
|
||||
"funcOperation":'上传原油价格预测报告',
|
||||
"data":{
|
||||
"ownerAccount":'arui', #报告所属用户账号
|
||||
"ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋
|
||||
"reportType":'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST
|
||||
"fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', #文件名称
|
||||
"fileName": '', #文件名称
|
||||
"fileBase64": '' ,#文件内容base64
|
||||
"categoryNo":'yyjgycbg', # 研究报告分类编码
|
||||
"smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
|
||||
"reportEmployeeCode":"E40116", # 报告人
|
||||
"reportDeptCode" :"D0044" ,# 报告部门
|
||||
"reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋
|
||||
"reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部
|
||||
"productGroupCode":"RAW_MATERIAL" # 商品分类
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### 线上开关
|
||||
# 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 # 是否上传报告
|
||||
|
||||
### 开关
|
||||
# # 变量定义--测试环境
|
||||
# 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.109:8080/jingbo/api/analysis/reportInfo/researchUploadReportSave" # zhaoqiwei
|
||||
|
||||
|
||||
# login_data = {
|
||||
# "data": {
|
||||
# "account": "api_test",
|
||||
# "password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=",
|
||||
# "tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
|
||||
# "terminal": "API"
|
||||
# },
|
||||
# "funcModule": "API",
|
||||
# "funcOperation": "获取token"
|
||||
# }
|
||||
|
||||
# upload_data = {
|
||||
# "funcModule":'研究报告信息',
|
||||
# "funcOperation":'上传原油价格预测报告',
|
||||
# "data":{
|
||||
# "ownerAccount":'arui', #报告所属用户账号
|
||||
# "reportType":'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST
|
||||
# "fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', #文件名称
|
||||
# "fileBase64": '' ,#文件内容base64
|
||||
# "categoryNo":'yyjgycbg', # 研究报告分类编码
|
||||
# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
|
||||
# "reportEmployeeCode":"E40116", # 报告人
|
||||
# "reportDeptCode" :"D0044" ,# 报告部门
|
||||
# "productGroupCode":"RAW_MATERIAL" # 商品分类
|
||||
# }
|
||||
# }
|
||||
|
||||
|
||||
### 线上开关
|
||||
is_train = True # 是否训练
|
||||
is_debug = False # 是否调试
|
||||
is_eta = False # 是否使用eta接口
|
||||
is_eta = True # 是否使用eta接口
|
||||
is_timefurture = True # 是否使用时间特征
|
||||
is_fivemodels = False # 是否使用之前保存的最佳的5个模型
|
||||
is_edbcode = False # 特征使用edbcoding列表中的
|
||||
is_edbnamelist = False # 自定义特征,对应上面的edbnamelist
|
||||
is_update_eta = False # 预测结果上传到eta
|
||||
is_update_report = False # 是否上传报告
|
||||
is_update_eta = True # 预测结果上传到eta
|
||||
is_update_report = True # 是否上传报告
|
||||
|
||||
### 开关
|
||||
# is_train = True # 是否训练
|
||||
# is_debug = False # 是否调试
|
||||
# is_eta = False # 是否使用eta接口
|
||||
# is_timefurture = True # 是否使用时间特征
|
||||
# is_fivemodels = False # 是否使用之前保存的最佳的5个模型
|
||||
# is_edbcode = False # 特征使用edbcoding列表中的
|
||||
# is_edbnamelist = False # 自定义特征,对应上面的edbnamelist
|
||||
# is_update_eta = False # 预测结果上传到eta
|
||||
# is_update_report = False # 是否上传报告
|
||||
|
||||
|
||||
# 数据截取日期
|
||||
end_time = '2024-10-29' # 数据截取日期
|
||||
end_time = '' # 数据截取日期
|
||||
delweekenday = True
|
||||
is_corr = False # 特征是否参与滞后领先提升相关系数
|
||||
add_kdj = False # 是否添加kdj指标
|
||||
@ -212,7 +212,8 @@ db_name = os.path.join(dataset,'jbsh_yuanyou.db')
|
||||
|
||||
settings = f'{input_size}-{horizon}-{train_steps}--{k}-{data_set}-{y}'
|
||||
# 获取日期时间
|
||||
now = datetime.datetime.now().strftime('%Y%m%d%H%M%S') # 获取当前日期时间
|
||||
# now = datetime.datetime.now().strftime('%Y%m%d%H%M%S') # 获取当前日期时间
|
||||
now = datetime.datetime.now().strftime('%Y-%m-%d') # 获取当前日期时间
|
||||
reportname = f'Brent原油大模型预测--{now}.pdf' # 报告文件名
|
||||
reportname = reportname.replace(':', '-') # 替换冒号
|
||||
|
||||
|
BIN
jbsh_yuanyou线上数据库10.7备份.db
Normal file
BIN
jbsh_yuanyou线上数据库10.7备份.db
Normal file
Binary file not shown.
13
main.py
13
main.py
@ -1,4 +1,4 @@
|
||||
# 读取配置
|
||||
# 读取配置
|
||||
from config_jingbo import *
|
||||
# from config_tansuanli import *
|
||||
# from config_juxiting import *
|
||||
@ -75,10 +75,9 @@ def predict_main():
|
||||
|
||||
import datetime
|
||||
# 判断当前日期是不是周一
|
||||
is_weekday = datetime.datetime.now().weekday() == 4
|
||||
is_weekday = datetime.datetime.now().weekday() == 0
|
||||
if is_weekday:
|
||||
logger.info('今天是周一,更新预测模型')
|
||||
try:
|
||||
# 计算最近20天预测残差最低的模型名称
|
||||
|
||||
model_results = sqlitedb.select_data('trueandpredict',order_by = "ds DESC",limit = "20")
|
||||
@ -99,10 +98,6 @@ def predict_main():
|
||||
# 取出现次数最多的模型名称
|
||||
most_common_model = min_abs_error_rate_column_name.value_counts().idxmax()
|
||||
logger.info(f"最近20天预测残差最低的模型名称:{most_common_model}")
|
||||
except Exception as e:
|
||||
logger.error(f"最近20天预测残差最低的模型名称计算失败:{e}")
|
||||
# 取txt中的模型名称
|
||||
most_common_model = pd.read_csv(os.path.join(dataset,'best_modelnames.txt'),header=None).values.flatten().tolist()[0]
|
||||
|
||||
# 保存结果到数据库
|
||||
|
||||
@ -148,7 +143,7 @@ def predict_main():
|
||||
# # 模型评估
|
||||
|
||||
logger.info('训练数据绘图ing')
|
||||
model_results3 = model_losss_juxiting(sqlitedb)
|
||||
model_results3 = model_losss(sqlitedb)
|
||||
|
||||
logger.info('训练数据绘图end')
|
||||
# 模型报告
|
||||
@ -183,7 +178,7 @@ def predict_main():
|
||||
file=max(glob.glob(os.path.join(dataset,'*.pdf')), key=os.path.getctime),
|
||||
ssl=ssl,
|
||||
)
|
||||
m.send_mail()
|
||||
# m.send_mail()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -11,4 +11,5 @@ while True:
|
||||
predict_main()
|
||||
time.sleep(60)
|
||||
except:
|
||||
pass
|
||||
time.sleep(3600)
|
||||
predict_main()
|
Loading…
Reference in New Issue
Block a user