Tôi đã sử dụng nó để kiểm soát việc tự động khởi động và tắt các giao dịch trong nước, và có thể hoạt động bình thường trong một ngày, nhưng thỉnh thoảng có vấn đề như sau:
Traceback (most recent call last): File “”, line 982, in init_ctx File “”, line 119, in File “”, line 65, in main File “”, line 27, in api URLError:
Một phần mã như sau: if currentime (() > 0.2100 and currentime (() < 0.2359 and currentwday (()! = 6 and currentwday (()! = 0 and status==False:# Không phải cuối tuần mỗi ngày từ 8:55 đến 3:01 khởi động robot status=True LogStatus(“0.2100–0.2359,Restart”) robotftrade=api(‘RestartRobot’,RobotFTrade) Log ((“robotftrade thực thi khởi động, api==”,robotftrade) swtradetrade=api(‘RestartRobot’,swTrade) Log ((“swtradetrade thực hiện khởi động, api==”,swtradetrade) Sleep(10000) if currentime (((<0.0855 or currentwday ((() == 6 or currentwday (()) == 0 and status== True: # ít hơn 8:55 hoặc là thứ Bảy hoặc Chủ nhật dừng robot status=False LogStatus(“0.0000–0.900 or weekend,StopRobot”) robotftrade=api(‘StopRobot’,RobotFTrade) Log ((“robotftrade stop execution, api==”, robotftrade) swtradetrade=api(‘StopRobot’,swTrade) Log ((“swtradetrade stop,api==”,swtradetrade) Sleep(10000)