You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
# /bin/bash
|
|
|
|
# curl -s https://api.dexscreener.com/latest/dex/pairs/$1/$2| jq -r '.pairs | .[] | .priceUsd'
|
|
raw=$(curl -s "https://api.dexscreener.com/latest/dex/pairs/$1/$2")
|
|
price=$(echo "$raw" | jq -r ".pairs | .[] | .priceUsd")
|
|
# if (( $(echo "$price < .05" | bc -l) )); then
|
|
# printf "%0.4f\n" "$price" | cut -c 4-
|
|
# elif (( $(echo "$price < .1" | bc -l) )); then
|
|
# printf "%0.3f\n" "$price" | cut -c 4-
|
|
#if (( $(echo "$price < .09" | bc -l) )); then
|
|
#printf "%0.4f\n" "$price" | cut -c 4-
|
|
#elif (( $(echo "$price < .1" | bc -l) )); then
|
|
#printf "%0.3f\n" "$price" | cut -c 4-
|
|
#elif (( $(echo "$price < 1" | bc -l) )); then
|
|
#printf "%0.3f\n" "$price" | cut -c 3-
|
|
#elif (( $(echo "$price < 10" | bc -l) )); then
|
|
#printf "%0.2f\n" "$price"
|
|
#fi
|
|
|
|
if [ $(echo "$price < 0.09" | bc -l) -eq 1 ]; then
|
|
printf "%0.4f\n" "$price" | cut -c 4-
|
|
elif [ $(echo "$price < 0.1" | bc -l) -eq 1 ]; then
|
|
printf "%0.3f\n" "$price" | cut -c 4-
|
|
elif [ $(echo "$price < 1" | bc -l) -eq 1 ]; then
|
|
printf "%0.3f\n" "$price" | cut -c 3-
|
|
elif [ $(echo "$price < 10" | bc -l) -eq 1 ]; then
|
|
printf "%0.2f\n" "$price"
|
|
fi
|