citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

quadrigacx (462B)


      1 #! /usr/bin/env nix-shell
      2 #! nix-shell -i bash -p jq
      3 nbtc=33
      4 
      5 pair=XXBTZCAD
      6 cad=$(curl -sL "https://api.kraken.com/0/public/Ticker?pair=$pair" | jq -r ".result.$pair.a[0]")
      7 #usd=$(curl -sL 'https://api.bitfinex.com/v2/tickers?symbols=tBTCUSD' | jq '.[0][1]' &)
      8 #cad=$(curl -sL 'https://apiv2.bitcoinaverage.com/indices/global/ticker/all?crypto=BTC&fiat=CAD' | jq -r '.BTCCAD.last')
      9 calc=$(bc -l <<<"$cad * $nbtc")
     10 printf "$%s, ($%s)\n" "$cad" "$(nfmt <<<$calc)"