5/29/2023

Bash get price cryto from binance.

All

https://api.binance.com/api/v3/ticker/price? 

Some symbol

https://api.binance.com/api/v3/ticker/price?symbol=LUNCUSDT

code

#!/usr/bin/env bash
btc=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT | jq -Mr '.price')
lunc=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=LUNCUSDT | jq -Mr '.price')
shib=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=SHIBUSDT | jq -Mr '.price')
xec=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=XECUSDT | jq -Mr '.price')

echo "B $btc | L $lunc | S $shib | X $xec"

No comments:

Post a Comment