from datetime import datetime import requests from py_jftech import sendmail, format_date # 预测发送邮箱 email = ['wenwen.tang@thizgroup.com'] jrp_domain = 'https://jrp.jfquant.com/api/v1.0' # jrp_domain = 'http://localhost:7090/jrp' def send(content): receives = email subject = '预测_{today}'.format(today=format_date(datetime.today())) sendmail(receives=receives, copies=[], attach_paths=[], subject=subject, content=content) def upload_predict(ticker, predictDate, predict): predict_data = { "aiPredict": { "predictDate": format_date(predictDate), "predict": 1 if predict == 'UP' else -1 }, "bloombergTicker": ticker } headers = {"X-AUTH-token": "rt7297LwQvyAYTke2iD8Vg"} response = requests.post(url=f'{jrp_domain}/ai/predict', json=predict_data, headers=headers) if response.status_code != 200: print(response.text) print("上传ai预测结果失败,请重试")