From 8b63285b1646f9248ecb4517d05e57e63082c18b Mon Sep 17 00:00:00 2001 From: Andrey Arapov <107317698+andy108369@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:57:45 +0100 Subject: [PATCH] feat(bid-script): replace dead API price endpoint [skip ci] (#315) --- charts/akash-provider/scripts/price_script_generic.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/akash-provider/scripts/price_script_generic.sh b/charts/akash-provider/scripts/price_script_generic.sh index a1c6e186..eb24034b 100755 --- a/charts/akash-provider/scripts/price_script_generic.sh +++ b/charts/akash-provider/scripts/price_script_generic.sh @@ -2,7 +2,7 @@ # WARNING: the runtime of this script should NOT exceed 5 seconds! (Perhaps can be amended via AKASH_BID_PRICE_SCRIPT_PROCESS_TIMEOUT env variable) # Requirements: # curl jq bc mawk ca-certificates -# Version: April-03-2024 +# Version: February-04-2025 set -o pipefail # Example: @@ -33,9 +33,9 @@ function get_akt_price { CACHE_FILE=/tmp/aktprice.cache if ! test $(find $CACHE_FILE -mmin -60 2>/dev/null); then ## cache expired - usd_per_akt=$(curl -s --connect-timeout 3 --max-time 3 -X GET 'https://api-osmosis.imperator.co/tokens/v2/price/AKT' -H 'accept: application/json' | jq -r '.price' 2>/dev/null) + usd_per_akt=$(curl -s --connect-timeout 3 --max-time 3 -X GET 'https://api.diadata.org/v1/assetQuotation/Osmosis/ibc-C2CFB1C37C146CF95B0784FD518F8030FEFC76C5800105B1742FB65FFE65F873' -H 'accept: application/json' | jq -r '.Price' 2>/dev/null) if [[ $? -ne 0 ]] || [[ $usd_per_akt == "null" ]] || [[ -z $usd_per_akt ]]; then - # if Osmosis API fails, try CoinGecko API + # if DIA Data API fails, try CoinGecko API usd_per_akt=$(curl -s --connect-timeout 3 --max-time 3 -X GET "https://api.coingecko.com/api/v3/simple/price?ids=akash-network&vs_currencies=usd" -H "accept: application/json" | jq -r '[.[]][0].usd' 2>/dev/null) fi