From 9a14cd27a38cd4b0477e5d5023a474873b351ae8 Mon Sep 17 00:00:00 2001 From: olli Date: Thu, 23 Nov 2023 10:29:31 +0100 Subject: [PATCH] more pure bash to speed up things --- dabo/analyze.sh | 38 +++++++++++++------------- dabo/functions/check_buy_conditions.sh | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dabo/analyze.sh b/dabo/analyze.sh index 68b00f4..289e8c1 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -100,7 +100,7 @@ function analyze { # check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} # else #echo "SELL Checks" - time check_sell_conditions ${g_tmp}/${tmpfile} + check_sell_conditions ${g_tmp}/${tmpfile} # fi # fi # if ! [ -f "${g_tmp}/open-${tmpfile}" ] @@ -110,27 +110,27 @@ function analyze { # then # check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} # else - time check_buy_conditions ${g_tmp}/${tmpfile} + check_buy_conditions ${g_tmp}/${tmpfile} # fi fi ## Chart Part -# local f_intrade=0 -# local f_score=${f_buy_score} -# local f_interim="0" -# [ -z "${f_buy_score}" ] && f_buy_score=0 -# if [ -z "${f_sell_score}" ] -# then -# f_sell_score=0 -# else -# f_score=${f_sell_score} -# f_intrade=1 -# if [ -s ${g_tmp}/interim-${tmpfile} ] -# then -# f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile}) -# f_interim=$(g_calc "${f_interim}-${FEE}") -# fi -# fi -# echo "$f_line,${f_market_performance},${f_score},${f_buy_score},${f_sell_score},${f_intrade},${f_interim}" >>analyze-${analyzedate}/chart-${tmpfile} + local f_intrade=0 + local f_score=${f_buy_score} + local f_interim="0" + [ -z "${f_buy_score}" ] && f_buy_score=0 + if [ -z "${f_sell_score}" ] + then + f_sell_score=0 + else + f_score=${f_sell_score} + f_intrade=1 + if [ -s ${g_tmp}/interim-${tmpfile} ] + then + f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile}) + f_interim=$(g_calc "${f_interim}-${FEE}") + fi + fi + echo "$f_line,${f_market_performance},${f_score},${f_buy_score},${f_sell_score},${f_intrade},${f_interim}" >>analyze-${analyzedate}/chart-${tmpfile} ## Chart Part End done diff --git a/dabo/functions/check_buy_conditions.sh b/dabo/functions/check_buy_conditions.sh index 0617ecf..70a041c 100644 --- a/dabo/functions/check_buy_conditions.sh +++ b/dabo/functions/check_buy_conditions.sh @@ -122,7 +122,7 @@ function check_buy_conditions_strategy { #if [ -s "${f_strategy}" ] #then - . "${f_strategy}" || return 1 + time . "${f_strategy}" || return 1 #else # g_echo_note "${f_echo_prefix}Strategy file not found" # return 1