The automatic trading script currently in operation is not stable enough to be executed stably and permanently with a while statement. I'm on a business trip from tomorrow, but I want to keep the script running even while I'm on a business trip. But I don't want to carry a PC with me. I want to complete it by operating on the iphone.
while True:
As for the fundamental countermeasures, we will consider so-called "operational coverage". (not good)
[Automatic trading completion notification] 2020-01-19 17:20:20.630975 The start process has terminated abnormally.
The number of transactions was three.
The details of the error are as follows.
{'parent_order_acceptance_id': 'JRF20200119-082028-389427'}None
rerun.sh
#!/bin/sh
cd ~/bf/code_bf/
source ~/bf/bin/activate
nohup python IFDOCOBOTv3.1.py &
--Make a script that doesn't fall in the first place. (this) ――Since we have sent you a LINE notification, put the URL in the notification content so that you can re-execute with one click. (Can you do it with API Gateway?) --If the server on which the script is executed goes down, the above flow cannot handle it, so consider a countermeasure. (I first came up with the idea of using Lambda, but I can't run Lambda for a long time, so it's NG. Can I implement it with AWS Batch? --Since the name of the automatic trading script (IFDOCOBOTv3.1.py in the above sample) is changed frequently, the re-execution script will be modified each time. (I'm thinking of solving it around CodeDeploy and CodeBuild. I hope it can be re-executed from the URL in the first place) --I'm using an EC2 instance, but the Public IP changes due to a reboot, so if I accidentally reboot, I have to connect to the AWS Management Console when connecting from the iphone, which is troublesome (I can solve it by using Elastic IP, but I want to make it a habit to shut down the server when not in use, so NG * Elastic IP is subject to billing when the OS is stopped) ――I wrote various things, but there is no script that doesn't fall. You should create a mechanism that automatically re-executes on the assumption that it will fall. Initialization (Settlement of open interest and cancellation of order) Naturally, it is done automatically.
Recommended Posts