From 6807c6c78c7282dabed13742cf8b5f80dfae9735 Mon Sep 17 00:00:00 2001 From: olli Date: Tue, 9 Apr 2024 09:22:43 +0200 Subject: [PATCH] fix US-CONSUMER-PRICE-INDEX, US-UNEMPLOYMENT-INDEX --- dabo/functions/market_performance.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/dabo/functions/market_performance.sh b/dabo/functions/market_performance.sh index 45ea4ba..66f2484 100644 --- a/dabo/functions/market_performance.sh +++ b/dabo/functions/market_performance.sh @@ -61,7 +61,6 @@ function market_performance { f_eth_forecast=$(echo "scale=2; ${f_eth_forecast}/3" | bc -l | sed -r 's/^(-?)\./\10./') # Calculate available market data week changes - local f_index_performance_txt="" local f_index_performance_added=0 local f_index_performance_csv="" local f_INDEX @@ -98,13 +97,11 @@ function market_performance { fi fi # finishing vars - f_index_performance_txt="${f_index_performance_txt}${f_INDEX}: ${f_index_performance}%; " f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')" f_index_performance_csv="${f_index_performance_csv},${f_index_performance}" done # calculate US-FED-FEDERAL-FUNDS-RATE-INVERTED - local f_economic for f_eco_data in US-FED-FEDERAL-FUNDS-RATE-INVERTED-INDEX do local f_index_performance=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f2) @@ -117,22 +114,19 @@ function market_performance { f_index_performance="-${f_index_performance}" fi fi - f_index_performance_txt="${f_index_performance_txt}${f_eco_data}: ${f_index_performance}%; " f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')" f_index_performance_csv="${f_index_performance_csv},${f_index_performance}" done # calculate forecast US Unemployment Rate and US Consumer Price Index (CPI) - local f_economic for f_eco_data in US-UNEMPLOYMENT-INDEX US-CONSUMER-PRICE-INDEX do local f_current=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f2) - local f_forecast=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f3) - f_index_performance="$(echo "scale=2; ${f_current}-${f_forecast}" | bc -l | sed -r 's/^(-?)\./\10./')" - f_index_performance_txt="${f_index_performance_txt}${f_eco_data}: ${f_index_performance}%; " - f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')" - f_index_performance_csv="${f_index_performance_csv},${f_index_performance}" + #local f_forecast=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f3) + #f_index_performance="$(echo "scale=2; ${f_current}-${f_forecast}" | bc -l | sed -r 's/^(-?)\./\10./')" + f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_current}" | bc -l | sed -r 's/^(-?)\./\10./')" + f_index_performance_csv="${f_index_performance_csv},${f_current}" done # price performance bitcoin @@ -147,9 +141,8 @@ function market_performance { ## calculate market performance f_market_performance=$(echo "scale=2; (${f_btc_forecast} + ${f_eth_forecast} + ${f_index_performance_added} + ${f_btc_performance} + ${f_eth_performance} + ${f_top250_marketcap_performance})" | bc -l | sed -r 's/^(-?)\./\10./' | xargs printf "%.2f") 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-INVERTED,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,US-CONSUMER-PRICE" if [ -s MARKET_PERFORMANCE.csv ] then sed -i -e 1c"$f_market_csv_headline" MARKET_PERFORMANCE.csv