mirror of
https://github.com/rottenwheel/revuo-weekly.git
synced 2024-12-26 17:47:49 +00:00
Up and working atm
This commit is contained in:
parent
9a1f4ccdc3
commit
47f715da3a
1 changed files with 10 additions and 11 deletions
|
@ -11,26 +11,25 @@ COINGECKO_QUERY='?localization=false&tickers=false&market_data=true&community_da
|
||||||
|
|
||||||
# Function to query best street price source
|
# Function to query best street price source
|
||||||
get_street_price() {
|
get_street_price() {
|
||||||
#TODO: More sources!
|
|
||||||
# Haveno.Markets
|
# Haveno.Markets
|
||||||
xidel https://haveno.markets/ --xpath "//span[@class='price']" | head -n1
|
haveno_streetprice=$(xidel https://haveno.markets/ --xpath "//span[@class='price']" | head -n1)
|
||||||
# Monero.boats
|
# Monero.boats (RIP)
|
||||||
#curl --silent --header 'Accept: application/json' 'https://monero.boats/prices'
|
#boats_streetprice=$(curl --silent --header 'Accept: application/json' 'https://monero.boats/prices' | jq -r '.haveno.USD')
|
||||||
|
# Bisq TODO
|
||||||
|
# bisq_streetprice=$()
|
||||||
|
printf '%s\n' "${haveno_streetprice}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fetch API data in parallel like a BAMF
|
# Fetch CoinGecko data
|
||||||
{
|
market_data=$(curl --silent --header 'Accept: application/json' \
|
||||||
streetprice_data="$(get_street_price)" & \
|
"${COINGECKO_ENDPOINT}${COINGECKO_QUERY}" | jq '.market_data')
|
||||||
market_data=$(curl --silent --header 'Accept: application/json' \
|
|
||||||
"${COINGECKO_ENDPOINT}${COINGECKO_QUERY}" | jq '.market_data')
|
|
||||||
}
|
|
||||||
|
|
||||||
# Extract the relevant data using jq
|
# Extract the relevant data using jq
|
||||||
usd_price=$(echo $market_data | jq -r '.current_price.usd')
|
usd_price=$(echo $market_data | jq -r '.current_price.usd')
|
||||||
eur_price=$(echo $market_data | jq -r '.current_price.eur')
|
eur_price=$(echo $market_data | jq -r '.current_price.eur')
|
||||||
btc_price=$(echo $market_data | jq -r '.current_price.btc')
|
btc_price=$(echo $market_data | jq -r '.current_price.btc')
|
||||||
market_cap=$(echo $market_data | jq -r '.market_cap.usd' | xargs numfmt --g)
|
market_cap=$(echo $market_data | jq -r '.market_cap.usd' | xargs numfmt --g)
|
||||||
street_price="$(echo $streetprice_data | jq -r '.haveno.USD')"
|
street_price="$(get_street_price)"
|
||||||
week_change_usd=$(echo $market_data | jq -r '.price_change_percentage_7d_in_currency.usd')
|
week_change_usd=$(echo $market_data | jq -r '.price_change_percentage_7d_in_currency.usd')
|
||||||
month_change_usd=$(echo $market_data | jq -r '.price_change_percentage_30d_in_currency.usd')
|
month_change_usd=$(echo $market_data | jq -r '.price_change_percentage_30d_in_currency.usd')
|
||||||
year_change_usd=$(echo $market_data | jq -r '.price_change_percentage_1y_in_currency.usd')
|
year_change_usd=$(echo $market_data | jq -r '.price_change_percentage_1y_in_currency.usd')
|
||||||
|
|
Loading…
Reference in a new issue