diff --git a/allSymbols.json b/allSymbols.json index da99c47..8b12e70 100644 --- a/allSymbols.json +++ b/allSymbols.json @@ -80,6 +80,9 @@ { "Symbol": "SLV" }, + { + "Symbol": "$SPX" + }, { "Symbol": "SPY" }, diff --git a/recordAllSymbolsSingleRun.sh b/recordAllSymbolsSingleRun.sh index c8c067e..9f9d4cb 100755 --- a/recordAllSymbolsSingleRun.sh +++ b/recordAllSymbolsSingleRun.sh @@ -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 diff --git a/recordOptionChainSingleSymbolSingleRun.sh b/recordOptionChainSingleSymbolSingleRun.sh index 739a350..66071d2 100755 --- a/recordOptionChainSingleSymbolSingleRun.sh +++ b/recordOptionChainSingleSymbolSingleRun.sh @@ -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 $( temp/optionChain.${symbol}.tmp.$$.json jqQuery=".symbol"