Improved error handling and taking special ITM/OTM handling out of XSP but just restricting to 200 days out.
This commit is contained in:
@@ -2,15 +2,30 @@
|
||||
#set -x
|
||||
# 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
|
||||
#
|
||||
|
||||
# 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
|
||||
outDir=data/$(date +%Y-%m-%d)
|
||||
queryString="?symbol=${symbol}"
|
||||
|
||||
mkdir -p "${outDir}"
|
||||
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
|
||||
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
|
||||
|
||||
jqQuery=".symbol"
|
||||
|
||||
Reference in New Issue
Block a user