Adding SPX and corresponding filter options as schwab does not support huge result sets.

This commit is contained in:
2024-05-17 15:17:09 -05:00
parent fa41d2e05e
commit 2d80a407cf
3 changed files with 31 additions and 8 deletions

View File

@@ -80,6 +80,9 @@
{
"Symbol": "SLV"
},
{
"Symbol": "$SPX"
},
{
"Symbol": "SPY"
},

View File

@@ -14,16 +14,24 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
if [[ '$XSP' = ${theSymbol} ]]; then
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}
else
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol}
if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp
# Working around error in $XSP with special handling
# if [[ '$XSP' != ${theSymbol} ]]; then
# touch temp/hadErrors.$$.tmp
# fi
fi
continue
fi
if [[ '$SPX' = ${theSymbol} ]]; then
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} fromDate $(date "+%Y-%m-%d" -d "+40 days") toDate $(date "+%Y-%m-%d" -d "+45 days")
if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp
fi
continue
fi
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol}
if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp
fi
done

View File

@@ -2,11 +2,23 @@
#set -x
symbol=$1
outDir=data/$(date +%Y-%m-%d)
queryString="?symbol=${symbol}"
mkdir -p "${outDir}"
mkdir -p temp
curl -s -X GET "https://api.schwabapi.com/marketdata/v1/chains?symbol=${symbol}" \
#Handle additional commandline parameters
shift
while [[ $# -gt 0 ]]; do
queryString="${queryString}&$1=$2"
shift; shift
done
msg="Querying for Symbol: _${symbol}_ query string: _${queryString}_"
systemd-cat -t "`basename $0` $1" -p debug <<< ${msg}
curl -s -X GET "https://api.schwabapi.com/marketdata/v1/chains${queryString}" \
-H "Authorization: Bearer $(<access_token.dat)" > temp/optionChain.${symbol}.tmp.$$.json
jqQuery=".symbol"