added support for Pre Market

This commit is contained in:
Moritz Böhme 2021-05-27 16:32:13 +02:00
parent 78b4038989
commit 6051bb5297

View file

@ -14,11 +14,13 @@ toggle() {
trap "toggle" USR1 trap "toggle" USR1
while true; do while true; do
URL="https://query1.finance.yahoo.com/v8/finance/chart/GME" URL="https://api.nasdaq.com/api/quote/GME/info?assetclass=stocks"
res=$(curl -sf "$URL") res=$(curl --user-agent 'Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0' -sf "$URL")
close=$(jq '.["chart"]["result"][0]["meta"]["previousClose"]' <<< "$res") close="$(jq '.["data"]["keyStats"]["PreviousClose"]["value"]' <<< "$res")"
current=$(jq '.["chart"]["result"][0]["meta"]["regularMarketPrice"]' <<< "$res") close="${close//[^0-9.]/}"
current="$(jq '.["data"]["primaryData"]["lastSalePrice"]' <<< "$res")"
current="${current//[^0-9.]/}"
shares="1.650981" shares="1.650981"
buy="214" buy="214"
@ -49,7 +51,7 @@ while true; do
fi fi
echo "$output" echo "$output"
sleep 2 & sleep 5 &
sleep_pid=$! sleep_pid=$!
wait wait
done done