Fix auto trading SPX, ends program if order doesn't exist due to grep errorlevel

This commit is contained in:
2024-08-22 11:17:17 -05:00
parent 7f3e1d74bb
commit ea050ab12a
2 changed files with 5 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#set -x #set -x
set -e set -e
IFS=$'\0' IFS=$'\0'
myPID=$$
inputFile="$1" inputFile="$1"
if [[ "" == "$inputFile" ]]; then if [[ "" == "$inputFile" ]]; then
@@ -40,8 +41,9 @@ systemd-cat -t "`basename $0` $1" -p info <<< ${msg}
echo "${msg}" echo "${msg}"
#Check if this order has already been submitted. #Check if this order has already been submitted.
./getOrders.sh | grep '\(WORKING\|FILLED\),\('${longSymbol}'\|'${shortSymbol}'\)' > temp/existingOrders.$$ ./getOrders.sh | (grep '\(WORKING\|FILLED\),\('${longSymbol}'\|'${shortSymbol}'\)' || true) > temp/existingOrders.${myPID}
if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
if [[ $(wc -l < temp/existingOrders.${myPID} -eq 0 ]];then
msg="Not Yet traded, continuing" msg="Not Yet traded, continuing"
systemd-cat -t "`basename $0` $1" -p info <<< ${msg} systemd-cat -t "`basename $0` $1" -p info <<< ${msg}
else else

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -x #set -x
mkdir -p temp mkdir -p temp
./getNewAccessToken.sh ./getNewAccessToken.sh