improve output format of get orders, add check if trade has been executed to auto trader scripts

This commit is contained in:
2024-08-15 11:30:27 -05:00
parent fd90883e79
commit ef28aa59e5
4 changed files with 39 additions and 10 deletions

View File

@@ -5,9 +5,9 @@ mkdir -p temp
./getNewAccessToken.sh
tempFile=temp/accountOrders.tmp.$$.json
#fromEnteredTime=$(date -u "+%Y-%m-%dT%H:%M:%S.000Z" -d "-5 days")
fromEnteredTime=$(date -u "+%Y-%m-%dT%H:%M:%S.000Z" -d "-1000 minutes")
toEnteredTime=$(date -u "+%Y-%m-%dT%H:%M:%S.000Z" -d "-10 minutes")
fromEnteredTime=$(date -u "+%Y-%m-%dT%H:%M:%S.000Z" -d "-100 days")
toEnteredTime=$(date -u "+%Y-%m-%dT%H:%M:%S.000Z" -d "-0 minutes")
curl -s -X GET "https://api.schwabapi.com/trader/v1/orders?fromEnteredTime=${fromEnteredTime}&toEnteredTime=${toEnteredTime}" -H "Authorization: Bearer $(<access_token.dat)" > ${tempFile}
cat ${tempFile} | jq -r 'map(.enteredTime)[]'
#jq -r 'map(.enteredTime)[]' < ${tempFile}
#jq -r '.[].orderLegCollection[].instrument.symbol' < ${tempFile}
jq -r '.[] | [.orderId | tostring][0] + "," + .status + "," + .orderLegCollection[].instrument.symbol' < ${tempFile}