Dotfiles for my tiling window manager + terminal workflow.
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.

39 lines
1.6 KiB

5 days ago
5 days ago
5 days ago
5 days ago
12 months ago
5 days ago
5 days ago
  1. #!/bin/bash
  2. # price=$(curl -s "https://api.kraken.com/0/public/Ticker?pair=$1" | jq -r ".result.$1.b[0]")
  3. raw=$(curl -s "https://api.kraken.com/0/public/Ticker?pair=$1")
  4. # echo $raw
  5. if [ "$1" = "BTCUSDC" ]; then
  6. price=$(echo "$raw" | jq -r ".result.XBTUSDC.b[0]")
  7. else
  8. price=$(echo "$raw" | jq -r ".result.$1.b[0]")
  9. fi
  10. #if [ $(echo "$price < 1" | bc -l) -eq 1 ]; then
  11. #printf "%0.3f\n" "$price" | cut -c 3-
  12. #elif [ $(echo "$price < 10" | bc -l) -eq 1 ]; then
  13. #printf "%0.3f\n" "$price" | cut -c 3-
  14. #elif [ $(echo "$price < 100" | bc -l) -eq 1 ]; then
  15. #echo "$price" | numfmt --grouping | cut -c -2
  16. #elif [ $(echo "$price < 1000" | bc -l) -eq 1 ]; then
  17. #echo "$price" | numfmt --grouping | cut -c -3
  18. #elif [ $(echo "$price < 10000" | bc -l) -eq 1 ]; then
  19. ##echo "$price" | numfmt --grouping | cut -c -3
  20. #echo "$price" | cut -c -3
  21. #elif [ $(echo "$price > 100000" | bc -l) -eq 1 ]; then
  22. #echo "$price" | numfmt --grouping | cut -c -3
  23. #fi
  24. if (( $(echo "$price < 1" | bc -l) )); then
  25. printf "%0.3f\n" "$price" | cut -c 3-
  26. elif (( $(echo "$price < 10" | bc -l) )); then
  27. printf "%0.3f\n" "$price" | cut -c 3-
  28. elif (( $(echo "$price < 100" | bc -l) )); then
  29. #echo "$price" | numfmt --grouping | cut -c -2
  30. echo "$price" | tr -d '.' | awk '{print substr($0, 1, 3)}'
  31. elif (( $(echo "$price < 1000" | bc -l) )); then
  32. echo "$price" | numfmt --grouping | cut -c -3
  33. elif (( $(echo "$price < 10000" | bc -l) )); then
  34. echo "$price" | cut -c -3
  35. elif (( $(echo "$price > 100000" | bc -l) )); then
  36. echo "$price" | numfmt --grouping | cut -c -3
  37. fi