Introduce mnemonic account name resolution in getAccountNumbers
This commit is contained in:
@@ -2,9 +2,16 @@
|
||||
#set -x
|
||||
mkdir -p temp
|
||||
|
||||
./getNewAccessToken.sh
|
||||
|
||||
tempFile=temp/accountNumbers.tmp.$$.json
|
||||
tempFlatFile=temp/accountNumbers.flat.$$.tsv
|
||||
curl -s -X GET "https://api.schwabapi.com/trader/v1/accounts/accountNumbers" -H "Authorization: Bearer $(<access_token.dat)" > ${tempFile}
|
||||
jq '.' < ${tempFile}
|
||||
(jq -r '.[] | [.accountNumber, .hashValue ] | @tsv' < ${tempFile} | while read accNo accHash; do
|
||||
read accInfo <<< $(grep ${accNo} accountNumberNameMapping.dat; echo ${accNo})
|
||||
echo ${accInfo} ${accHash}
|
||||
done) >> ${tempFlatFile}
|
||||
|
||||
if [[ "$1" != "" ]]; then
|
||||
read accName accNum accHash <<< $(grep $1 ${tempFlatFile}); echo -n ${accHash}
|
||||
else
|
||||
cat ${tempFlatFile}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user