- Fix SPX auto trading by differntiation of SPX and SPWX
- Prevent destruciton of the refresh token when things go wrong - add auto trading wip code for order getting, and long trading - add recording of 90 days out expiration tracking - Add TSLA
This commit is contained in:
32
record90dayOut.sh
Executable file
32
record90dayOut.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
IFS=$'\0'
|
||||
|
||||
daysOutMin=90
|
||||
daysOutMax=91
|
||||
|
||||
inputFile="$1"
|
||||
latestFile="$1"
|
||||
if [[ "" == "$inputFile" ]]; then
|
||||
latestFile="$(ls data/`date +%Y-%m-%d`/*SPY* | sort | tail -n 1)"
|
||||
systemd-cat -t "`basename $0` $1" -p debug <<< "Latest File: _${latestFile}_"
|
||||
inputFile=temp/orderInputFile.json
|
||||
bzip2 -dc < "${latestFile}" > "${inputFile}"
|
||||
fi
|
||||
if [[ ! -f "${inputFile}" ]]; then
|
||||
errMsg="ERROR: Input file _${inputFile}_ does not exist."
|
||||
systemd-cat -t "`basename $0` $1" -p err <<< ${errMsg}
|
||||
>&2 echo "${errMsg}"
|
||||
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; } }')
|
||||
systemd-cat -t "`basename $0` $1" -p debug <<< "Date-Key: _${dateKey}_"
|
||||
|
||||
daysOut=$(cut -d : -f 2 <<< ${dateKey})
|
||||
if [[ ${daysOut} -gt ${daysOutMax} ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "$(date +%Y-%m-%d): ${dateKey} (${latestFile})" >> record90dayOut.log
|
||||
|
||||
Reference in New Issue
Block a user