diff --git a/dabo/functions/get_assets.sh b/dabo/functions/get_assets.sh index d769323..b06f8ba 100644 --- a/dabo/functions/get_assets.sh +++ b/dabo/functions/get_assets.sh @@ -29,39 +29,6 @@ function get_assets { return 2 fi - ## write assets list and filter by marketcap and sort by price - # get krypto symbol list sorted by marketcap - echo "curl -s -X 'GET' \"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=250&page=1&sparkline=false&price_change_percentage=1h,24h,7d,14d,30d,1y\" -H 'accept: application/json'" >COINGECKO_GET_ASSETS_CMD - g_runcmd g_retrycmd sh COINGECKO_GET_ASSETS_CMD >COINGECKO_GET_ASSETS_CMD_OUT || return 1 -#ASSET_MARKETCAP_OUT.tmp || return 1 - if [ -s COINGECKO_GET_ASSETS_CMD_OUT ] && grep -q "market_cap_rank" COINGECKO_GET_ASSETS_CMD_OUT - then - - # get marketcap sort - jq -r '.[].symbol' COINGECKO_GET_ASSETS_CMD_OUT | tr [:lower:] [:upper:] | head -n $LARGEST_MARKETCAP >ASSET_MARKETCAP_OUT.tmp-sort - if [ -s ASSET_MARKETCAP_OUT.tmp-sort ] && egrep -q "^[A-Z0-9]+$" ASSET_MARKETCAP_OUT.tmp-sort - then - mv ASSET_MARKETCAP_OUT.tmp-sort SORTMARKETCAP - else - g_echo_warn "ASSET_MARKETCAP_OUT.tmp-sort has wrong Syntax. - Not updating ASSET_MARKETCAP_OUT.tmp-sort $(tail -n 10 ASSET_MARKETCAP_OUT.tmp-sort)" - return 2 - fi - - # write down 24h pricechange - cat COINGECKO_GET_ASSETS_CMD_OUT | jq -r '.[] | .symbol + "," + (.price_change_percentage_24h|tostring)' | tr [:lower:] [:upper:] >ASSET_PRICE_CHANGE_PERCENTAGE_24H - - # store coingecko symbolids for coingecko info URLs - jq -r '.[] | .symbol + "," + .id' COINGECKO_GET_ASSETS_CMD_OUT >COINGECKO_IDS.tmp - if [ -s COINGECKO_IDS.tmp ] - then - mv COINGECKO_IDS.tmp COINGECKO_IDS - else - g_echo_warn "COINGECKO_IDS.tmp has wrong Syntax. - Not updating COINGECKO_IDS $(tail -n 10 COINGECKO_IDS.tmp)" - return 2 - fi - fi - - # Write file with asset list and ignore marketcap under LARGEST_MARKETCAP cat EXCHANGE_GET_ASSETS_CMD_OUT | cut -d"," -f1 | while read f_ASSET do