Fixed logging
parent
38c3ebf383
commit
4b0f37165b
|
@ -35,7 +35,7 @@ fi
|
||||||
for asset in ${!assets[@]}; do
|
for asset in ${!assets[@]}; do
|
||||||
echo "Checking $asset..."
|
echo "Checking $asset..."
|
||||||
url="https://api.polygon.io/v2/aggs/ticker/${assets[${asset}]}/prev?apiKey=${POLYGON_API_KEY}"
|
url="https://api.polygon.io/v2/aggs/ticker/${assets[${asset}]}/prev?apiKey=${POLYGON_API_KEY}"
|
||||||
echo " URL: $url"
|
#echo " URL: $url"
|
||||||
res=$(curl --silent "$url")
|
res=$(curl --silent "$url")
|
||||||
|
|
||||||
# Check the result
|
# Check the result
|
||||||
|
@ -51,7 +51,7 @@ for asset in ${!assets[@]}; do
|
||||||
price=$(echo $res | jq '.results[0].vw')
|
price=$(echo $res | jq '.results[0].vw')
|
||||||
echo " Price: $price"
|
echo " Price: $price"
|
||||||
line="P $(date -I --date=yesterday) $asset"
|
line="P $(date -I --date=yesterday) $asset"
|
||||||
grep "$line" "$PRICES_FILE" \
|
grep "$line" "$PRICES_FILE" >/dev/null \
|
||||||
|| echo "$line \$$price" >> "$PRICES_FILE"
|
|| echo "$line \$$price" >> "$PRICES_FILE"
|
||||||
sleep 10 # Optional, check API limits
|
sleep 10 # Optional, check API limits
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue