From 7eeabb270f22312b9d29f736f2af44b2c861b9c9 Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 15 Nov 2023 16:54:52 +0100 Subject: [PATCH] more pure bash to speed up things --- dabo/analyze.sh | 38 ++++++++++++++--------------- dabo/functions/get_vars_from_csv.sh | 2 -- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/dabo/analyze.sh b/dabo/analyze.sh index 3f1cb06..cd39ffe 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -85,7 +85,6 @@ function analyze { # get time from market_performance local f_time="${f_date%:*}" f_time="${f_time//[^0-9]/}" - echo "$f_time" # get markel_performance from array with time f_market_performance=${f_market_performace_array[${f_time}]} @@ -93,7 +92,6 @@ function analyze { f_market_performance_before=${f_market_performance} echo "MARKET_PERF=$f_market_performance" - #echo " ${f_line},${f_market_performance}" | perl -pe 's/([0-9].[0-9][0-9][0-9][0-9][0-9][0-9])[0-9]+/$1/g' | column -t -s, >>${g_tmp}/output-${tmpfile} if [ -f "${g_tmp}/open-${tmpfile}" ] then if [ "${ANALYZE_VERBOSE}" -eq "0" ] @@ -112,24 +110,24 @@ function analyze { 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} + ## 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} # Chart Part End done diff --git a/dabo/functions/get_vars_from_csv.sh b/dabo/functions/get_vars_from_csv.sh index 36e466a..7c95bec 100644 --- a/dabo/functions/get_vars_from_csv.sh +++ b/dabo/functions/get_vars_from_csv.sh @@ -17,8 +17,6 @@ function get_vars_from_csv { if [ -z "${f_last_lines_array}" ] then mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}") - else - echo "USING ARRAY" fi # if there are not four lines