diff --git a/dabo/functions/market_performance.sh b/dabo/functions/market_performance.sh index 63edde1..03910df 100644 --- a/dabo/functions/market_performance.sh +++ b/dabo/functions/market_performance.sh @@ -127,17 +127,21 @@ function market_performance { f_index_performance_csv="${f_index_performance_csv},${f_index_performance}" done - # price performance bitcoin (last 30 minutes) - local f_from=$(tail -n 30 asset-histories/BTC${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2) - local f_to=$(tail -n 1 asset-histories/BTC${CURRENCY}.history.csv | cut -d, -f2) + # price performance bitcoin (last 48 intervals) + #local f_from=$(tail -n 48 asset-histories/BTC${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2) + #local f_to=$(tail -n 1 asset-histories/BTC${CURRENCY}.history.csv | cut -d, -f2) + local f_from=$(tail -n 48 asset-histories/BTC${CURRENCY}.history.csv | head -n 24 | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }') + local f_to=$(tail -n 24 asset-histories/BTC${CURRENCY}.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }') local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to}) #get_rate_percentage_min_before_and_now BTC ${CURRENCY} 360 || return 1 local f_btc_performance=${f_exchange_rate_diff_percentage} - # price performance ethereum (last 30 minutes) + # price performance ethereum (last 48 intervals) #get_rate_percentage_min_before_and_now ETH ${CURRENCY} 360 || return 1 - local f_from=$(tail -n 30 asset-histories/ETH${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2) - local f_to=$(tail -n 1 asset-histories/ETH${CURRENCY}.history.csv | cut -d, -f2) + #local f_from=$(tail -n 48 asset-histories/ETH${CURRENCY}.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2) + #local f_to=$(tail -n 1 asset-histories/ETH${CURRENCY}.history.csv | cut -d, -f2) + local f_from=$(tail -n 48 asset-histories/ETH${CURRENCY}.history.csv | head -n 24 | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }') + local f_to=$(tail -n 24 asset-histories/ETH${CURRENCY}.history.csv | cut -d, -f2 | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }') local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to}) local f_eth_performance=${f_exchange_rate_diff_percentage} @@ -149,7 +153,7 @@ function market_performance { local f_date=$(g_date_print) echo "${f_date} Market Performance: ${f_market_performance}%; BTC forecast: ${f_btc_forecast}%; ETH forecast: ${f_eth_forecast}%; ${f_index_performance_txt}BTC: ${f_btc_performance}%; ETH: ${f_eth_performance}%; TOP250 Marketcap: ${f_top250_marketcap_performance}%" >>MARKET_PERFORMANCE local f_indexlistcsv=$(echo "$f_indexlist" | perl -pe 's/\n/,/g; s/ +/,/g; s/,+/,/g') - local f_market_csv_headline="date,market performance,btc,eth,btc forecast,eth forecast,top250,${f_indexlistcsv}US-FED-FEDERAL-FUNDS-RATE,US-UNEMPLOYMENT forecast,US-CONSUMER-PRICE forecast" + local f_market_csv_headline="date,market performance,btc,eth,btc forecast,eth forecast,top250,${f_indexlistcsv}US-FED-FEDERAL-FUNDS-RATE-INVERTED,US-UNEMPLOYMENT forecast,US-CONSUMER-PRICE forecast" if [ -s MARKET_PERFORMANCE.csv ] then sed -i -e 1c"$f_market_csv_headline" MARKET_PERFORMANCE.csv