diff --git a/dabo/functions/market_performance.sh b/dabo/functions/market_performance.sh index 30be6a8..02c7cb8 100644 --- a/dabo/functions/market_performance.sh +++ b/dabo/functions/market_performance.sh @@ -58,7 +58,9 @@ function market_performance { #local f_back=240 #[[ $(date +%u) -eq 6 ]] && f_back=1500 #[[ $(date +%u) -eq 7 ]] && f_back=2940 - local f_from=$(tail -n 1440 asset-histories/MSCI-WORLD-INDEX.history.csv | grep -v ^[A-Z] | head -n1 | cut -d, -f2) + local f_msci_last_date=$(tail -n1 asset-histories/MSCI-WORLD-INDEX.history.csv | cut -d, -f1) + local f_from=$(egrep "^$(date -d "${f_msci_last_date} last week" "+%Y-%m-%d %H:" | cut -d, -f1 | tail -n1)" asset-histories/MSCI-WORLD-INDEX.history.csv | head -n1 | cut -d, -f2) + [ -z "${f_from}" ] && f_from=$(egrep "^$(date -d "${f_msci_last_date} last week" "+%Y-%m-%d " | cut -d, -f1 | tail -n1)" asset-histories/MSCI-WORLD-INDEX.history.csv | head -n1 | cut -d, -f2) local f_to=$(tail -n 1 asset-histories/MSCI-WORLD-INDEX.history.csv | cut -d, -f2) local f_exchange_rate_diff_percentage=$(g_percentage-diff ${f_from} ${f_to}) #local f_back=10080