Improved error handling and taking special ITM/OTM handling out of XSP but just restricting to 200 days out.
This commit is contained in:
@@ -4,6 +4,10 @@
|
|||||||
systemd-cat -t "`basename $0`" -p info <<< "Started"
|
systemd-cat -t "`basename $0`" -p info <<< "Started"
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
./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
|
jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
|
||||||
# I am not interested in detail quotes at the moment
|
# I am not interested in detail quotes at the moment
|
||||||
@@ -13,7 +17,11 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
|
|||||||
#fi
|
#fi
|
||||||
|
|
||||||
if [[ '$XSP' = ${theSymbol} ]]; then
|
if [[ '$XSP' = ${theSymbol} ]]; then
|
||||||
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}
|
#./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+200 days")
|
||||||
|
# 2024-05-27, it seems that the ITM/OTM/NTM handling no longer makes an impact, therefore falling back to the normal method but restricting to 200 days
|
||||||
|
# for XSP this is no a break of the leg I guess...
|
||||||
|
|
||||||
|
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+200 days")
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
touch temp/hadErrors.$$.tmp
|
touch temp/hadErrors.$$.tmp
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,15 +2,30 @@
|
|||||||
#set -x
|
#set -x
|
||||||
# This is for big chains, that cause the Schwab API to error out (like $XSP)
|
# This is for big chains, that cause the Schwab API to error out (like $XSP)
|
||||||
# I add the range parameter (ITM/NTM/OTM) so that I get less data per request
|
# I add the range parameter (ITM/NTM/OTM) so that I get less data per request
|
||||||
#
|
|
||||||
|
# 2024-05-27: DEPRECATED - THIS FILE IS GOING TO BE REOMVED:
|
||||||
|
# This doesn't seem to be creating smaller responses anymore, therefore this method isn't used anymore anywhere...
|
||||||
|
|
||||||
symbol=$1
|
symbol=$1
|
||||||
outDir=data/$(date +%Y-%m-%d)
|
outDir=data/$(date +%Y-%m-%d)
|
||||||
|
queryString="?symbol=${symbol}"
|
||||||
|
|
||||||
mkdir -p "${outDir}"
|
mkdir -p "${outDir}"
|
||||||
mkdir -p temp
|
mkdir -p temp
|
||||||
|
|
||||||
|
#Handle additional commandline parameters
|
||||||
|
shift
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
queryString="${queryString}&$1=$2"
|
||||||
|
shift; shift
|
||||||
|
done
|
||||||
|
|
||||||
for range in ITM OTM NTM; do
|
for range in ITM OTM NTM; do
|
||||||
curl -s -X GET "https://api.schwabapi.com/marketdata/v1/chains?symbol=${symbol}&range=${range}" \
|
msg="Querying for Symbol: _${symbol}_ query string: _${queryString}&range=${range}_"
|
||||||
|
systemd-cat -t "`basename $0` $1" -p debug <<< ${msg}
|
||||||
|
|
||||||
|
curl -s -X GET "https://api.schwabapi.com/marketdata/v1/chains${queryString}&range=${range}" \
|
||||||
-H "Authorization: Bearer $(<access_token.dat)" > temp/optionChain.${symbol}.${range}.tmp.$$.json
|
-H "Authorization: Bearer $(<access_token.dat)" > temp/optionChain.${symbol}.${range}.tmp.$$.json
|
||||||
|
|
||||||
jqQuery=".symbol"
|
jqQuery=".symbol"
|
||||||
|
|||||||
Reference in New Issue
Block a user