Fix auto trading SPX, ends program if order doesn't exist due to grep errorlevel
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#set -x
|
||||
set -e
|
||||
IFS=$'\0'
|
||||
myPID=$$
|
||||
|
||||
inputFile="$1"
|
||||
if [[ "" == "$inputFile" ]]; then
|
||||
@@ -40,8 +41,9 @@ systemd-cat -t "`basename $0` $1" -p info <<< ${msg}
|
||||
echo "${msg}"
|
||||
|
||||
#Check if this order has already been submitted.
|
||||
./getOrders.sh | grep '\(WORKING\|FILLED\),\('${longSymbol}'\|'${shortSymbol}'\)' > temp/existingOrders.$$
|
||||
if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
|
||||
./getOrders.sh | (grep '\(WORKING\|FILLED\),\('${longSymbol}'\|'${shortSymbol}'\)' || true) > temp/existingOrders.${myPID}
|
||||
|
||||
if [[ $(wc -l < temp/existingOrders.${myPID} -eq 0 ]];then
|
||||
msg="Not Yet traded, continuing"
|
||||
systemd-cat -t "`basename $0` $1" -p info <<< ${msg}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user