PriceForecast/pushdata.py

104 lines
3.4 KiB
Python
Raw Permalink Normal View History

2024-11-01 16:38:21 +08:00
# 读取配置
from config_jingbo import *
# from config_tansuanli import *
from lib.tools import *
from lib.dataread import *
from models.nerulforcastmodels import ex_Model,model_losss,brent_export_pdf,tansuanli_export_pdf
from models.lstmmodels import ex_Lstm_M,ex_Lstm
from models.grumodels import ex_GRU
import glob
import torch
torch.set_float32_matmul_precision("high")
if __name__ == '__main__':
signature = BinanceAPI(APPID, SECRET)
etadata = EtaReader(signature=signature,
classifylisturl = classifylisturl,
classifyidlisturl=classifyidlisturl,
edbcodedataurl=edbcodedataurl,
edbcodelist=edbcodelist,
edbdatapushurl = edbdatapushurl,
edbdeleteurl = edbdeleteurl,
edbbusinessurl = edbbusinessurl
)
models = [
'NHITS',
'Informer',
'LSTM',
'iTransformer',
'TSMixer',
'TSMixerx',
'PatchTST',
'RNN',
'GRU',
'TCN',
'BiTCN',
'DilatedRNN',
'MLP',
'DLinear',
'NLinear',
'TFT',
'FEDformer',
'StemGNN',
'MLPMultivariate',
'TiDE',
'DeepNPT']
# 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',
'DeepNPT':'SELF0000076'
}
# df_predict = pd.read_csv('dataset/predict.csv',encoding='gbk')
# # df_predict.rename(columns={'ds':'Date'},inplace=True)
# for m in modelsindex.keys():
# list = []
# for date,value in zip(df_predict['ds'],df_predict[m]):
# list.append({'Date':date,'Value':value})
# data['DataList'] = list
# data['IndexCode'] = modelsindex[m]
# data['IndexName'] = f'价格预测{m}模型'
# data['Remark'] = m
# # print(data['DataList'])
# etadata.push_data(data)
# 删除指标
# IndexCodeList = ['SELF0000055']
# for i in range(1,57):
# if i < 10 : i = f'0{i}'
# IndexCodeList.append(f'SELF00000{i}')
# print(IndexCodeList)
# etadata.del_zhibiao(IndexCodeList)
# 删除特定日期的值
indexcodelist = modelsindex.values()
for indexcode in indexcodelist:
data = {
"IndexCode": indexcode, #指标编码
"StartDate": "2020-04-20", #指标需要删除的开始日期(>=),如果开始日期和结束日期相等,那么就是删除该日期
"EndDate": "2024-05-28" #指标需要删除的结束日期(<=),如果开始日期和结束日期相等,那么就是删除该日期
}
# etadata.del_business(data)