Get access token before execute auto-trading.
This commit is contained in:
@@ -4,6 +4,8 @@ IFS=$'\0'
|
|||||||
|
|
||||||
. helpers.sh
|
. helpers.sh
|
||||||
|
|
||||||
|
./getNewAccessToken.sh
|
||||||
|
|
||||||
daysOutMin=90
|
daysOutMin=90
|
||||||
daysOutMax=91
|
daysOutMax=91
|
||||||
deltaMin=0.35
|
deltaMin=0.35
|
||||||
@@ -84,8 +86,6 @@ if [[ "${noconfirm}" != "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
|
||||||
|
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh IRA)/orders" \
|
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh IRA)/orders" \
|
||||||
-H "Authorization: Bearer $(<access_token.dat)" \
|
-H "Authorization: Bearer $(<access_token.dat)" \
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ set -e
|
|||||||
IFS=$'\0'
|
IFS=$'\0'
|
||||||
myPID=$$
|
myPID=$$
|
||||||
. helpers.sh
|
. helpers.sh
|
||||||
|
./getNewAccessToken.sh
|
||||||
|
|
||||||
|
|
||||||
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
|
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
|
||||||
if [[ ${marketOpen} == false ]]; then
|
if [[ ${marketOpen} == false ]]; then
|
||||||
@@ -86,8 +88,6 @@ if [[ "${noconfirm}" != "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
|
||||||
|
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Regular)/orders" \
|
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Regular)/orders" \
|
||||||
-H "Authorization: Bearer $(<access_token.dat)" \
|
-H "Authorization: Bearer $(<access_token.dat)" \
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ set -e
|
|||||||
IFS=$'\0'
|
IFS=$'\0'
|
||||||
myPID=$$
|
myPID=$$
|
||||||
. helpers.sh
|
. helpers.sh
|
||||||
|
./getNewAccessToken.sh
|
||||||
|
|
||||||
|
|
||||||
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
|
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
|
||||||
if [[ ${marketOpen} == false ]]; then
|
if [[ ${marketOpen} == false ]]; then
|
||||||
@@ -174,9 +176,6 @@ if [[ "${noconfirm}" != "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
|
||||||
|
|
||||||
|
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Regular)/orders" \
|
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Regular)/orders" \
|
||||||
-H "Authorization: Bearer $(<access_token.dat)" \
|
-H "Authorization: Bearer $(<access_token.dat)" \
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ IFS=$'\0'
|
|||||||
myPID=$$
|
myPID=$$
|
||||||
. helpers.sh
|
. helpers.sh
|
||||||
|
|
||||||
|
./getNewAccessToken.sh
|
||||||
|
|
||||||
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
|
marketOpen=$([[ $(./getMarketHours.sh | jq '.option[].isOpen' | grep true | wc -l) -ne 0 ]] && echo true || echo false)
|
||||||
if [[ ${marketOpen} == false ]]; then
|
if [[ ${marketOpen} == false ]]; then
|
||||||
throw "The market is closed, exiting." info 2
|
throw "The market is closed, exiting." info 2
|
||||||
@@ -130,9 +132,6 @@ if [[ "${noconfirm}" != "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
|
||||||
|
|
||||||
|
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Regular)/orders" \
|
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Regular)/orders" \
|
||||||
-H "Authorization: Bearer $(<access_token.dat)" \
|
-H "Authorization: Bearer $(<access_token.dat)" \
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ set -x
|
|||||||
IFS=$'\0'
|
IFS=$'\0'
|
||||||
|
|
||||||
. helpers.sh
|
. helpers.sh
|
||||||
|
./getNewAccessToken.sh
|
||||||
|
|
||||||
|
|
||||||
daysOutMin=90
|
daysOutMin=90
|
||||||
daysOutMax=95
|
daysOutMax=95
|
||||||
@@ -89,8 +91,6 @@ if [[ "${noconfirm}" != "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./getNewAccessToken.sh
|
|
||||||
|
|
||||||
echo curl -s -X POST \
|
echo curl -s -X POST \
|
||||||
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Roth)/orders" \
|
"https://api.schwabapi.com/trader/v1/accounts/$(./getAccountNumbers.sh Roth)/orders" \
|
||||||
-H "Authorization: Bearer $(<access_token.dat)" \
|
-H "Authorization: Bearer $(<access_token.dat)" \
|
||||||
|
|||||||
Reference in New Issue
Block a user