Adding SPX and corresponding filter options as schwab does not support huge result sets.
This commit is contained in:
@@ -80,6 +80,9 @@
|
|||||||
{
|
{
|
||||||
"Symbol": "SLV"
|
"Symbol": "SLV"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Symbol": "$SPX"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Symbol": "SPY"
|
"Symbol": "SPY"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,16 +14,24 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
|
|||||||
|
|
||||||
if [[ '$XSP' = ${theSymbol} ]]; then
|
if [[ '$XSP' = ${theSymbol} ]]; then
|
||||||
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}
|
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}
|
||||||
else
|
if [[ $? -ne 0 ]]; then
|
||||||
|
touch temp/hadErrors.$$.tmp
|
||||||
|
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}
|
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol}
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
touch temp/hadErrors.$$.tmp
|
touch temp/hadErrors.$$.tmp
|
||||||
|
|
||||||
# Working around error in $XSP with special handling
|
|
||||||
# if [[ '$XSP' != ${theSymbol} ]]; then
|
|
||||||
# touch temp/hadErrors.$$.tmp
|
|
||||||
# fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,23 @@
|
|||||||
#set -x
|
#set -x
|
||||||
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
|
||||||
|
|
||||||
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
|
-H "Authorization: Bearer $(<access_token.dat)" > temp/optionChain.${symbol}.tmp.$$.json
|
||||||
|
|
||||||
jqQuery=".symbol"
|
jqQuery=".symbol"
|
||||||
|
|||||||
Reference in New Issue
Block a user