I'm working on this script to check pricing. It gets to line 16 and shoots an error.
#!/bin/bash
echo " Date Time Price"
echo "-----------------------------"
while [ true ]
do
new_price=$(curl -s "https://coinbase.com/api/v1/prices/spot_rate" | jq -r ".amount")
balance=0.000001
if [ -z $current_price ]; then
current_price=0
fi
if [ $current_price < $new_price ]; then
ARROW="+"
else if [ $current_price > $new_price ]; then
ARROW="-"
else
ARROW="="
fi
fi
echo "$(date '+%m/%d/%Y | %H:%M:%S') | $new_price | $ARROW"
current_price=$new_price
sleep 30
done
Outputs error
-PC:~/scripts/ticker$ ./arrows.sh
Date Time Price
-----------------------------
./arrows.sh: line 16: 7685.00: No such file or directory
11/17/2017 | 15:45:28 | 7685.00 | -
And this is the verbose
-PC:~/scripts/ticker$ bash -x ./arrows.sh
+ echo ' Date Time Price'
Date Time Price
+ echo -----------------------------
-----------------------------
+ '[' true ']'
++ curl -s https://coinbase.com/api/v1/prices/spot_rate
++ jq -r .amount
+ new_price=7685.00
+ balance=0.000001
+ '[' -z ']'
+ current_price=0
+ '[' 0 ']'
+ ARROW=+
++ date '+%m/%d/%Y | %H:%M:%S'