#!/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 # I am not interested in detail quotes at the moment #./recordQuoteSingleSymbolSingleRun.sh ${theSymbol} #if [[ $? -ne 0 ]]; then # touch temp/hadErrors.$$.tmp #fi if [[ '$XSP' = ${theSymbol} ]]; then ./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+200 days") 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 continue fi if [[ 'SPY' = ${theSymbol} ]]; then ./recordOptionChainSingleSymbolSingleRun.sh ${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 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 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"