Files
OptionRecorderSchwab/recordAllSymbolsSingleRun.sh
Joe Tretter 5535bdae7f - Separate getting option chains from recording
- Add checking for market open
- Remove SPX from recording
- Hopefully precent the refresh token from being
  overwritten sometimes
2024-08-26 15:18:24 -05:00

44 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
#set -x
systemd-cat -t "`basename $0`" -p info <<< "Started"
./getNewAccessToken.sh
if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p err <<< "Child process to get access token reported error. Exiting."
exit 1
fi
jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
#The result of XSP is too big causing a problem at the server, therefore limiting to future 400 days and splitting if needed
if [[ '$XSP' = ${theSymbol} ]]; then
./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days")
if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days")
if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp
fi
fi
continue
fi
#Default behavior - fall back to stitching on error
./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol}
if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}
if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp
fi
fi
done
if [[ -e temp/hadErrors.$$.tmp ]]; then
rm temp/hadErrors.$$.tmp
curl -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.recordAllSymbolsSingleRun&secs=1&email=joe@kawomi.com"
fi
systemd-cat -t "`basename $0`" -p info <<< "Finished"