From be5f2458fa84d0800f120cfc57cdee2d92b48c2f Mon Sep 17 00:00:00 2001 From: olli Date: Fri, 20 Oct 2023 17:39:57 +0200 Subject: [PATCH] now get_rate --- dabo/functions/get_fibonacci_indicator.sh | 48 ----------------------- 1 file changed, 48 deletions(-) delete mode 100644 dabo/functions/get_fibonacci_indicator.sh diff --git a/dabo/functions/get_fibonacci_indicator.sh b/dabo/functions/get_fibonacci_indicator.sh deleted file mode 100644 index 492a9bb..0000000 --- a/dabo/functions/get_fibonacci_indicator.sh +++ /dev/null @@ -1,48 +0,0 @@ -function get_fibonacci_indicator { - #g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" - # get histfile - local f_hist_file="$1" - local f_period="$2" - - f_fibonacci="" - - # Check for enough time periods in data - local f_period=$((f_period+1)) - local f_period_sum=$(tail -n${f_period} "${f_hist_file}" | cut -d, -f2 | grep "^[0-9]" | wc -l) - if ! [ ${f_period_sum} -ge ${f_period} ] - then - g_echo_note "${FUNCNAME} $@: Not enough data - waiting for more values and defaulting to 0. (${f_period} needed; ${f_period_sum} given)" - echo -n ",0" >>"${f_hist_file}" - return 0 - fi - - # get highest and lowest price in period and current price - local f_highest=$(tail -n${f_period} "${f_hist_file}" | cut -d"," -f2 | grep "^[0-9]" | sort -n | tail -n1) - local f_lowest=$(tail -n${f_period} "${f_hist_file}" | cut -d"," -f2 | grep "^[0-9]" | sort -n | head -n1) - local f_price=$(tail -n1 "${f_hist_file}" | cut -d"," -f2 | grep "^[0-9]") - # calculate range - local f_range=$(echo "${f_highest}-${f_lowest}" | bc -l) - - # calculate current difference to highest - local f_diff_to_highest=$(echo "${f_highest}-${f_price}" | bc -l) - local f_diff_to_highest_in_range=$(echo "${f_range}-${f_diff_to_highest}" | bc -l) - - # calculate fibonacci retracement value from range to difference of highest price - f_fibonacci=$(echo "scale=8; 1+(1/${f_range}*(${f_diff_to_highest_in_range}-${f_range}))" | bc | sed 's/^\./0./;' | xargs printf "%.3f") - #f_fibonacci=$(g_percentage-diff ${f_range} ${f_diff_to_highest_in_range}) - - echo -n ",${f_fibonacci}" >>"${f_hist_file}" - -# echo " -#Highest=$f_highest -#Lowest=$f_lowest -#Price=$f_price -#Range=$f_range -#highest-diff=$f_diff_to_highest -#highest-diff-range=$f_diff_to_highest_in_range -#" - - #g_echo_note "Fibonacci-Retracement: ${f_fibonacci}" - -} -