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 -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
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -x
|
#set -x
|
||||||
mkdir -p temp
|
mkdir -p temp
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
./getNewAccessToken.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user