improve output format of get orders, add check if trade has been executed to auto trader scripts
This commit is contained in:
@@ -49,6 +49,17 @@ longSymbol=$(jq -r '.symbol' < temp/longLeg.json)
|
||||
msg="Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_"
|
||||
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} > temp/existingOrders.$$
|
||||
if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
|
||||
msg="Not Yet traded, continuing"
|
||||
systemd-cat -t "`basename $0` $1" -p info <<< ${msg}
|
||||
else
|
||||
msg="Already traded, exiting"
|
||||
systemd-cat -t "`basename $0` $1" -p info <<< ${msg}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
priceOffset=0.0
|
||||
# Get the Middle price...
|
||||
@@ -76,7 +87,6 @@ orderJson=$(jq -c <<-EOM
|
||||
EOM
|
||||
)
|
||||
|
||||
|
||||
systemd-cat -t "`basename $0` $1" -p debug <<< "Order: _${orderJson}_"
|
||||
|
||||
echo Enter to continue, Ctrl+C to cancel
|
||||
@@ -84,7 +94,7 @@ read
|
||||
./getNewAccessToken.sh
|
||||
|
||||
curl -s -X POST \
|
||||
'https://api.schwabapi.com/trader/v1/accounts/CEF970366D4CC9553B5E8846E35FD92A1867F3E73C1082A52647256F42E4746B/orders' \
|
||||
'https://api.schwabapi.com/trader/v1/accounts/5A5B921917D97B89FDA53E1E1D13D2EB11E488ADA20A20B3C787477DE59A770E/orders' \
|
||||
-H "Authorization: Bearer $(<access_token.dat)" \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
|
||||
Reference in New Issue
Block a user