commit 93f89f0b10c112d3e6bf48f8c4f1edf2a3e7dfd0
parent fcfe178005fc9d4d6cbf38e55cb3254aa68710ad
author: nathanael <nathanael@dalliard.ch>
date: Mon, 8 Dec 2025 16:53:17 +0000
s0: up bin fx
bip177
diffstat:
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/s0/dotfiles/bin/fx b/s0/dotfiles/bin/fx
@@ -7,7 +7,7 @@ main() {
amount="${2:-1}"
case "$currency" in
(eur|usd) fiat "$@" ;;
- (btc|sats) bitcoin "$@" ;;
+ (btc) bitcoin "$@" ;;
(*) fail 'currency not supported' ;;
esac
echo "$result"
@@ -22,10 +22,7 @@ bitcoin() {
test -z "$3" &&
price=$(ftp -MVo - "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=chf" | jq -r .bitcoin.chf) ||
price=$(ftp -MVo - "https://api.coingecko.com/api/v3/coins/bitcoin/history?date=$3&localization=false" | jq -r .market_data.current_price.chf)
-
- test "$currency" = "sats" &&
- result=$(echo "scale=8; $price * $amount / 100000000" | bc) ||
- result=$(echo "$price * $amount" | bc -l)
+ result=$(echo "scale=8; $price * $amount / 100000000" | bc)
}
fail() { echo "$1"; exit 1; }