- 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:
@@ -3,8 +3,11 @@
|
||||
|
||||
mkdir -p temp
|
||||
|
||||
echo Set Dyn-IP
|
||||
myIP=$(ip a | grep 'inet.*192.168.10' | awk -F "[ /]*" '{print $3}')
|
||||
curl -s "https://ddns.kawomi.com/?domain=cstradebotcallback&address=${myIP}"
|
||||
echo Get latest certificate
|
||||
ssh root@192.168.10.2 'cd /etc/letsencrypt/live/current && cat privkey.pem cert.pem' > cert.pem
|
||||
echo
|
||||
|
||||
echo OPEN URL: "https://api.schwabapi.com/v1/oauth/authorize?client_id=$(<appKey.dat)&redirect_uri=https://cstradebotcallback.ddns.kawomi.com:2222/"
|
||||
@@ -17,6 +20,17 @@ curl -s -X POST "https://api.schwabapi.com/v1/oauth/token" \
|
||||
-H "Authorization: Basic $(<appCredentials.dat)" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-d "grant_type=authorization_code&code=${theCode}&redirect_uri=https://cstradebotcallback.ddns.kawomi.com:2222/" > temp/refreshTokenReqResp.$$.json
|
||||
jq -r .refresh_token temp/refreshTokenReqResp.$$.json > refresh_token.dat
|
||||
|
||||
jq -e -r .refresh_token temp/refreshTokenReqResp.$$.json > temp/refresh_token.$$.dat
|
||||
if [[ $? -eq 0 ]]; then
|
||||
errMsg="New Refresh Token created."
|
||||
systemd-cat -t "`basename $0`" -p info <<< ${errMsg}
|
||||
echo "${errMsg}"
|
||||
cp temp/refresh_token.$$.dat refresh_token.dat
|
||||
else
|
||||
errMsg="Error getting new refresh token _$(<temp/refresh_token.$$.dat)_"
|
||||
systemd-cat -t "`basename $0`" -p err <<< ${errMsg}
|
||||
>&2 echo "${errMsg}"
|
||||
fi
|
||||
echo Refresh Token: $(<refresh_token.dat)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user