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