Skip to content

Commit

Permalink
feat(bid-script): replace dead API price endpoint [skip ci] (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy108369 authored Feb 4, 2025
1 parent 7ae5b4f commit 8b63285
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions charts/akash-provider/scripts/price_script_generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8b63285

Please sign in to comment.