- Separate getting option chains from recording

- Add checking for market open
- Remove SPX from recording
- Hopefully precent the refresh token from being
  overwritten sometimes
This commit is contained in:
2024-08-26 15:18:24 -05:00
parent 917703386d
commit 5535bdae7f
10 changed files with 508 additions and 37 deletions

View File

@@ -7,6 +7,14 @@ daysOutMax=91
deltaMin=0.35
deltaMax=0.40
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
if [[ ${marketOpen} == false ]]; then
errMsg="The market is closed, exiting."
systemd-cat -t "`basename $0` $1" -p info <<< ${errMsg}
>&2 echo "${errMsg}"
exit 2
fi
inputFile="$1"
if [[ "" == "$inputFile" ]]; then
latestFile="$(ls data/`date +%Y-%m-%d`/*SPY* | sort | tail -n 1)"
@@ -21,7 +29,7 @@ if [[ ! -f "${inputFile}" ]]; then
exit 1
fi
dateKey=$(jq -r '.callExpDateMap | keys | .[]' temp/orderInputFile.json | sort -r -t ":" +2 | awk -F ":" -e '{theDay=$2; if (theDay < '${daysOutMin}') { print lastDay; exit; } else { lastDay=$0; } }')
dateKey=$(jq -r '.callExpDateMap | keys | .[]' "${inputFile}" | sort -r -t ":" +2 | awk -F ":" -e '{theDay=$2; if (theDay < '${daysOutMin}') { print lastDay; exit; } else { lastDay=$0; } }')
systemd-cat -t "`basename $0` $1" -p debug <<< "Date-Key: _${dateKey}_"
daysOut=$(cut -d : -f 2 <<< ${dateKey})
@@ -89,8 +97,11 @@ EOM
systemd-cat -t "`basename $0` $1" -p debug <<< "Order: _${orderJson}_"
echo Enter to continue, Ctrl+C to cancel
read
if [[ "${noconfirm}" != "true" ]]; then
echo Enter to continue, Ctrl+C to cancel _${noconfirm}_
read
fi
./getNewAccessToken.sh
curl -s -X POST \