Files
OptionRecorderSchwab/getOrders.sh
Joe Tretter e9a651f92e - Fix SPX auto trading by differntiation of SPX and SPWX
- Prevent destruciton of the refresh token when things go wrong
- add auto trading wip code for order getting, and long trading
- add recording of 90 days out expiration tracking
- Add TSLA
2024-07-17 14:08:55 -05:00

14 lines
540 B
Bash
Executable File

#!/bin/bash
set -x
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")
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)[]'