more pure bash to speed up things

This commit is contained in:
olli 2023-11-15 16:54:52 +01:00
parent 2476e2ee72
commit 7eeabb270f
2 changed files with 18 additions and 22 deletions

View File

@ -85,7 +85,6 @@ function analyze {
# get time from market_performance # get time from market_performance
local f_time="${f_date%:*}" local f_time="${f_date%:*}"
f_time="${f_time//[^0-9]/}" f_time="${f_time//[^0-9]/}"
echo "$f_time"
# get markel_performance from array with time # get markel_performance from array with time
f_market_performance=${f_market_performace_array[${f_time}]} f_market_performance=${f_market_performace_array[${f_time}]}
@ -93,7 +92,6 @@ function analyze {
f_market_performance_before=${f_market_performance} f_market_performance_before=${f_market_performance}
echo "MARKET_PERF=$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}" ] if [ -f "${g_tmp}/open-${tmpfile}" ]
then then
if [ "${ANALYZE_VERBOSE}" -eq "0" ] if [ "${ANALYZE_VERBOSE}" -eq "0" ]
@ -112,24 +110,24 @@ function analyze {
check_buy_conditions ${g_tmp}/${tmpfile} check_buy_conditions ${g_tmp}/${tmpfile}
fi fi
fi fi
# Chart Part ## Chart Part
local f_intrade=0 #local f_intrade=0
local f_score=${f_buy_score} #local f_score=${f_buy_score}
local f_interim="0" #local f_interim="0"
[ -z "${f_buy_score}" ] && f_buy_score=0 #[ -z "${f_buy_score}" ] && f_buy_score=0
if [ -z "${f_sell_score}" ] #if [ -z "${f_sell_score}" ]
then #then
f_sell_score=0 # f_sell_score=0
else #else
f_score=${f_sell_score} # f_score=${f_sell_score}
f_intrade=1 # f_intrade=1
if [ -s ${g_tmp}/interim-${tmpfile} ] # if [ -s ${g_tmp}/interim-${tmpfile} ]
then # then
f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile}) # f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile})
f_interim=$(g_calc "${f_interim}-${FEE}") # f_interim=$(g_calc "${f_interim}-${FEE}")
fi # fi
fi #fi
echo "$f_line,${f_market_performance},${f_score},${f_buy_score},${f_sell_score},${f_intrade},${f_interim}" >>analyze-${analyzedate}/chart-${tmpfile} #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 # Chart Part End
done done

View File

@ -17,8 +17,6 @@ function get_vars_from_csv {
if [ -z "${f_last_lines_array}" ] if [ -z "${f_last_lines_array}" ]
then then
mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}") mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}")
else
echo "USING ARRAY"
fi fi
# if there are not four lines # if there are not four lines